Home/Support/Support Forum/Linker problem using systemd library at C application for yocto
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Linker problem using systemd library at C application for yocto

0 votes
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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <systemd/sd-daemon.h>
...
sd_notify(0, "WATCHDOG=1");
...

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

also tried with -llibsystemd with the same luck :(

Any help welcomed!
asked Jul 27 in Linux by TCRobotics New to the Community (5 points)

Please log in or register to answer this question.

1 Answer

+1 vote
 
Best answer
SOLVED!! :)

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 :)

Hope this helps someone!
answered Jul 28 by TCRobotics New to the Community (5 points)
selected Jul 28 by LeonidM
...