[systemd-devel] Reusing systemd utils in a non-systemd application?

Chaiken, Alison Alison_Chaiken at mentor.com
Mon Oct 20 00:19:42 PDT 2014


There are some very useful functions in systemd/src/shared that are tempting to reuse in other, unrelated applications.    My first attempt is like this:

/usr/bin/gcc -g -Wall -Wextra -std=gnu99 -I../systemd/src/systemd -I../systemd/src/shared -I/usr/include/x86_64-linux-gnu/python2.7/ someprogram.c  ../systemd/src/shared/log.c -I. ../systemd/src/shared/util.c -o someprogram 

but the result doesn't come close to compiling:
===
In file included from ../systemd/src/shared/log.c:33:0:
../systemd/src/shared/util.h:51:4: error: #error Unknown pid_t size
 #  error Unknown pid_t size
    ^
In file included from ../systemd/src/shared/util.h:87:0,
                 from ../systemd/src/shared/log.c:33:
../systemd/src/shared/missing.h:282:6: error: #error "neither secure_getenv nor __secure_getenv are available"
 #    error "neither secure_getenv nor __secure_getenv are available"
      ^
===
and so on.    Is it necessary to understand libtool to proceed in this direction, or has someone already figured out how to refer to src/shared functions in a plain old Makefile for compilation outside of the systemd source tree?

Thanks,
Alison


More information about the systemd-devel mailing list