Yocto Project Discussions
 help / color / mirror / Atom feed
From: "Bel Hadj Salem Talel" <bhstalel@gmail.com>
To: yocto@lists.yoctoproject.org
Subject: Re: sd-bus.h not found even with DEPENDS += "systemd"
Date: Sat, 26 Sep 2020 12:58:30 -0700	[thread overview]
Message-ID: <1379.1601150310877010917@lists.yoctoproject.org> (raw)
In-Reply-To: <KGlH.1601145148652845133.saWp@lists.yoctoproject.org>

[-- Attachment #1: Type: text/plain, Size: 3558 bytes --]

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-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/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/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  ?= gcc
AS  ?= as
LD  ?= ld
AR  ?= ar

# Paths, including trailing path separator
SOURCEPREFIX   := source/
BUILDPREFIX    := build/

# This example needs the mesh lib
MESH_LIB_FOLDER := c-mesh-api/lib/
MESH_LIB := $(MESH_LIB_FOLDER)build/mesh_api_lib.a

# General compiler flags
CFLAGS  := -std=gnu99 -Wall -Werror -O

# Targets definition
MAIN_APP := sinkService

TARGET_APP := $(BUILDPREFIX)$(MAIN_APP)

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

# Add systemd lib as needed for sd-bus
LDFLAGS += -lsystemd

# Add current directory for headers
CFLAGS  += -I$(SOURCEPREFIX)

# Specific sources for this application
SOURCES := $(SOURCEPREFIX)main.c
SOURCES += $(SOURCEPREFIX)config.c
SOURCES += $(SOURCEPREFIX)data.c
SOURCES += $(SOURCEPREFIX)otap.c

OBJECTS := $(patsubst $(SOURCEPREFIX)%,                     \
$(BUILDPREFIX)%,                          \
$(SOURCES:.c=.o))

# Functions

# Also create the target directory if it does not exist
define COMPILE
echo "  CC $(2)"
mkdir -p $(dir $(1))
$(CC) $(CFLAGS) -c -o $(1) $(2)
endef

define LINK
echo "  Linking $(1)"
$(CC) $(CFLAGS) -o $(1) $(2) $(MESH_LIB) $(LDFLAGS)
endef

define CLEAN
echo "  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 := $(patsubst $(SOURCEPREFIX)%.c, $(BUILDPREFIX)%.d, $(SOURCES))

ifeq ($(V),1)
# "V=1" 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

[-- Attachment #2: Type: text/html, Size: 4799 bytes --]

  reply	other threads:[~2020-09-26 19:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26 18:32 sd-bus.h not found even with DEPENDS += "systemd" Bel Hadj Salem Talel
2020-09-26 19:58 ` Bel Hadj Salem Talel [this message]
2020-09-27 12:42   ` Bel Hadj Salem Talel
2020-09-28  7:41     ` [yocto] " Josef Holzmayr-Khosh Amoz
2023-12-19  6:27       ` ashujoshi35
2023-12-19 17:07         ` Khem Raj
2024-01-09 10:12           ` ashujoshi35
2024-01-09 15:33             ` Khem Raj
2024-01-10 17:11               ` ashujoshi35
2024-01-10 19:39                 ` Khem Raj
2024-01-11  8:44                   ` ashujoshi35
2024-01-11 12:17                     ` Ross Burton
2024-01-12  9:08                       ` ashujoshi35
2024-01-12 10:46                         ` Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379.1601150310877010917@lists.yoctoproject.org \
    --to=bhstalel@gmail.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox