Linker problem using systemd library at C application for yocto

I make a yocto image for ConectCore 6UL with systemd (working and tested ok)

Also installed libsystemd-dev at my developing computer.

Added -lsystemd to the compiler and linker flags at Digi eclipse application.

At my project I have:

#include
#include
#include
#include

sd_notify(0, “WATCHDOG=1”);

But the linker complains:
real-ld: cannot find -lsystemd

also tried with -llibsystemd with the same luck :frowning:

Any help welcomed!

SOLVED!! :slight_smile:

Copied the header systemd folder of installed libsystemd-dev library (/usr/include/systemd) to my project:

project/
└src/
. ├systemd/
. └main.c

As I need the arch compiled library I take directly the systemd library of my generated yocto image (/lib/libsystemd.so.0.23.0) and put it at systemd folder:

project/
└src/
. ├systemd/
. │ └libsystemd.so.0.23.0
. └main.c

At project properties went to the C/C++ Build -> Settings -> GCC C Linker -> Miscellaneous. In the Other objects added the path to libsystemd.so.0.23.0 “${workspace_loc:/${ProjName}/src/systemd/libsystemd.so.0.23.0}”

And it compiles and links without errors :slight_smile:

Hope this helps someone!

1 Like