From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: sd-bus.h not found even with DEPENDS += "systemd" To: yocto@lists.yoctoproject.org From: "Bel Hadj Salem Talel" X-Originating-Location: TN (197.27.17.252) X-Originating-Platform: Linux Firefox 80 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Sat, 26 Sep 2020 12:58:30 -0700 References: In-Reply-To: Message-ID: <1379.1601150310877010917@lists.yoctoproject.org> Content-Type: multipart/alternative; boundary="vraeFtQ21ycOHJQyZdWh" --vraeFtQ21ycOHJQyZdWh Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable HI Again, The systemd issue is solved by installing the libsystemd in my native host= , but I got another problem linking the lib with "ld" : | /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/wirepas-s= ink-tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libe= xec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-api/lib/buil= d/mesh_api_lib.a(logger.o): Relocations in generic ELF (EM: 62) | /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/wirepas-s= ink-tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libe= xec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-api/lib/buil= d/mesh_api_lib.a(logger.o): Relocations in generic ELF (EM: 62) | /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/wirepas-s= ink-tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libe= xec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-api/lib/buil= d/mesh_api_lib.a: error adding symbols: file in wrong format | collect2: error: ld returned 1 exit status | makefile:102: recipe for target 'build/sinkService' failed Here is the Makefile: --------------------------- # Makefile for Wirepas Dbus Sink module # Toolchain CC=C2=A0 ?=3D gcc AS=C2=A0 ?=3D as LD=C2=A0 ?=3D ld AR=C2=A0 ?=3D ar # Paths, including trailing path separator SOURCEPREFIX=C2=A0=C2=A0 :=3D source/ BUILDPREFIX=C2=A0=C2=A0=C2=A0 :=3D build/ # This example needs the mesh lib MESH_LIB_FOLDER :=3D c-mesh-api/lib/ MESH_LIB :=3D $(MESH_LIB_FOLDER)build/mesh_api_lib.a # General compiler flags CFLAGS=C2=A0 :=3D -std=3Dgnu99 -Wall -Werror -O # Targets definition MAIN_APP :=3D sinkService TARGET_APP :=3D $(BUILDPREFIX)$(MAIN_APP) # Add Api header (including logger files) CFLAGS=C2=A0 +=3D -I$(MESH_LIB_FOLDER)api # Add pthtread lib as needed by Mesh Lib LDFLAGS +=3D -pthread # Add Reentrant flag as using pthread CFLAGS=C2=A0 +=3D -D_REENTRANT # Add systemd lib as needed for sd-bus LDFLAGS +=3D -lsystemd # Add current directory for headers CFLAGS=C2=A0 +=3D -I$(SOURCEPREFIX) # Specific sources for this application SOURCES :=3D $(SOURCEPREFIX)main.c SOURCES +=3D $(SOURCEPREFIX)config.c SOURCES +=3D $(SOURCEPREFIX)data.c SOURCES +=3D $(SOURCEPREFIX)otap.c OBJECTS :=3D $(patsubst $(SOURCEPREFIX)%,=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= = =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 \ $(BUILDPREFIX)%,=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 \ $(SOURCES:.c=3D.o)) # Functions # Also create the target directory if it does not exist define COMPILE echo "=C2=A0 CC $(2)" mkdir -p $(dir $(1)) $(CC) $(CFLAGS) -c -o $(1) $(2) endef define LINK echo "=C2=A0 Linking $(1)" $(CC) $(CFLAGS) -o $(1) $(2) $(MESH_LIB) $(LDFLAGS) endef define CLEAN echo "=C2=A0 Cleaning up" $(RM) -r $(BUILDPREFIX) make -C $(MESH_LIB_FOLDER) clean endef # Target rules # Use dependency files automatically generated by GCC. # First collect all C source files AUTODEPS :=3D $(patsubst $(SOURCEPREFIX)%.c, $(BUILDPREFIX)%.d, $(SOURCES)= ) ifeq ($(V),1) # "V=3D1" on command line, print commands. else # Default, do not print commands. .SILENT: endif .PHONY: all all: app app: $(TARGET_APP) .PHONY: clean clean: $(call CLEAN) $(MESH_LIB_FOLDER): $(error Please add the c-mesh-api library under c-mesh-api folder.\ It is needed to handle dualmcu protocol) .PHONY: $(MESH_LIB) $(MESH_LIB): $(MESH_LIB_FOLDER) make -C $(MESH_LIB_FOLDER) $(BUILDPREFIX)%.o: $(SOURCEPREFIX)%.c $(call COMPILE,$@,$<) $(BUILDPREFIX)$(MAIN_APP): $(OBJECTS) $(MESH_LIB) $(call LINK,$@,$^) --------------------------- What is wrong ? Thanks ,Talel --vraeFtQ21ycOHJQyZdWh Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable HI Again,

The systemd issue is solved by installing the libsyste= md in my native host, but I got another problem linking the lib with "ld" :=

| /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linu= x/wirepas-sink-tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux= /../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-a= pi/lib/build/mesh_api_lib.a(logger.o): Relocations in generic ELF (EM: 62)<= br />| /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/wirep= as-sink-tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../= libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-api/lib/= build/mesh_api_lib.a(logger.o): Relocations in generic ELF (EM: 62)
| = /media/talel/data/menzu-zeus/menzu/tmp/work/aarch64-poky-linux/wirepas-sink= -tool/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec= /aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/ld: c-mesh-api/lib/build/m= esh_api_lib.a: error adding symbols: file in wrong format
| collect2: = error: ld returned 1 exit status
| makefile:102: recipe for target 'bu= ild/sinkService' failed

Here is the Makefile:

-------= --------------------

# Makefile for Wirepas Dbus Sink module

# Toolchain
CC  ?=3D gcc
AS  ?=3D as
LD&nb= sp; ?=3D ld
AR  ?=3D ar

# Paths, including trailing pa= th separator
SOURCEPREFIX   :=3D source/
BUILDPREFIX&nb= sp;   :=3D build/

# This example needs the mesh libMESH_LIB_FOLDER :=3D c-mesh-api/lib/
MESH_LIB :=3D $(MESH_LIB_FOLDE= R)build/mesh_api_lib.a

# General compiler flags
CFLAGS = ; :=3D -std=3Dgnu99 -Wall -Werror -O

# Targets definition
M= AIN_APP :=3D sinkService

TARGET_APP :=3D $(BUILDPREFIX)$(MAIN_AP= P)

# Add Api header (including logger files)
CFLAGS  += = =3D -I$(MESH_LIB_FOLDER)api
# Add pthtread lib as needed by Mesh Lib<= br />LDFLAGS +=3D -pthread
# Add Reentrant flag as using pthread
= CFLAGS  +=3D -D_REENTRANT

# Add systemd lib as needed for s= d-bus
LDFLAGS +=3D -lsystemd

# Add current directory for he= aders
CFLAGS  +=3D -I$(SOURCEPREFIX)

# Specific source= s for this application
SOURCES :=3D $(SOURCEPREFIX)main.c
SOURCES= +=3D $(SOURCEPREFIX)config.c
SOURCES +=3D $(SOURCEPREFIX)data.c
= SOURCES +=3D $(SOURCEPREFIX)otap.c

OBJECTS :=3D $(patsubst $(SOU= RCEPREFIX)%,          &nb= sp;          \
 &nbs= p;            &= nbsp;   $(BUILDPREFIX)%,       = ;            &n= bsp;      \
     &nb= sp;            $(SOU= RCES:.c=3D.o))

# Functions

# Also create the target d= irectory if it does not exist
define COMPILE
    e= cho "  CC $(2)"
    mkdir -p $(dir $(1))
&nbs= p;   $(CC) $(CFLAGS) -c -o $(1) $(2)
endef

define= LINK
    echo "  Linking $(1)"
   =  $(CC) $(CFLAGS) -o $(1) $(2) $(MESH_LIB) $(LDFLAGS)
endef
<= br />define CLEAN
    echo "  Cleaning up"
&n= bsp;   $(RM) -r $(BUILDPREFIX)
    make -C $(= MESH_LIB_FOLDER) clean
endef

# Target rules

# Us= e dependency files automatically generated by GCC.
# First collect all= C source files
AUTODEPS :=3D $(patsubst $(SOURCEPREFIX)%.c, $(BUILDPR= EFIX)%.d, $(SOURCES))

ifeq ($(V),1)
# "V=3D1" on command li= ne, print commands.
else
# Default, do not print commands.
.= SILENT:
endif

.PHONY: all
all: app

app: $(T= ARGET_APP)

.PHONY: clean
clean:
    $(c= all CLEAN)

$(MESH_LIB_FOLDER):
    $(error P= lease add the c-mesh-api library under c-mesh-api folder.\
  = ;          It is needed to handle dualmc= u protocol)

.PHONY: $(MESH_LIB)
$(MESH_LIB): $(MESH_LIB_FOL= DER)
    make -C $(MESH_LIB_FOLDER)

$(BUILDP= REFIX)%.o: $(SOURCEPREFIX)%.c
    $(call COMPILE,$@,$&l= t;)

$(BUILDPREFIX)$(MAIN_APP): $(OBJECTS) $(MESH_LIB)
 = ;   $(call LINK,$@,$^)

---------------------------

What is wrong ?

Thanks ,Talel --vraeFtQ21ycOHJQyZdWh--