[syslog-ng] Building syslog with cmake as external project
Alexandre Santos
alexandre.rosas.santos at gmail.com
Tue Nov 5 14:42:43 UTC 2019
Hi Antal,
Thank you for your feedback. I finally discovered the cmake variable
equivalent for DESTDIR which is CMAKE_STAGING_PREFIX.
So:
set(EXEC_PREFIX "/usr")
set(SYSLOG_NG_CMAKE_ARGS
${CCACHE_LAUNCH_RULE}
-DCMAKE_INSTALL_PREFIX=${EXEC_PREFIX}
-DCMAKE_STAGING_PREFIX=${SYSLOG_NG_INSTALL_DIR}
)
And then use this CMAKE_ARGS in the External project.
Now I running into another issue:
*root at 5526d87140af:/thanos/src/target/build# cat
/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeError.logDetermining
size of struct cmsgcred failed with the following output:Change Dir:
/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeTmpRun
Build Command:"/usr/bin/make" "cmTC_05392/fast"make[3]: Entering directory
'/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeTmp'/usr/bin/make
-f CMakeFiles/cmTC_05392.dir/build.make
CMakeFiles/cmTC_05392.dir/buildmake[4]: Entering directory
'/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeTmp'Building
C object CMakeFiles/cmTC_05392.dir/STRUCT_CMSGCRED.c.o/usr/bin/cc
-D_GNU_SOURCE=1 -fPIE -o CMakeFiles/cmTC_05392.dir/STRUCT_CMSGCRED.c.o
-c
/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:19:22:
error: invalid application of 'sizeof' to incomplete type 'struct
cmsgcred' #define SIZE (sizeof(struct cmsgcred))
^/thanos/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:21:12:
note: in expansion of macro 'SIZE' ('0' + ((SIZE / 10000)%10)),
^~~~/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:19:22:
error: invalid application of 'sizeof' to incomplete type 'struct
cmsgcred' #define SIZE (sizeof(struct cmsgcred))
^/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:22:12:
note: in expansion of macro 'SIZE' ('0' + ((SIZE / 1000)%10)),
^~~~/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:19:22:
error: invalid application of 'sizeof' to incomplete type 'struct
cmsgcred' #define SIZE (sizeof(struct cmsgcred))
^/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:23:12:
note: in expansion of macro 'SIZE' ('0' + ((SIZE / 100)%10)),
^~~~/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:19:22:
error: invalid application of 'sizeof' to incomplete type 'struct
cmsgcred' #define SIZE (sizeof(struct cmsgcred))
^/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:24:12:
note: in expansion of macro 'SIZE' ('0' + ((SIZE / 10)%10)),
^~~~/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:19:22:
error: invalid application of 'sizeof' to incomplete type 'struct
cmsgcred' #define SIZE (sizeof(struct cmsgcred))
^/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CheckTypeSize/STRUCT_CMSGCRED.c:25:12:
note: in expansion of macro 'SIZE' ('0' + (SIZE % 10)),
^~~~CMakeFiles/cmTC_05392.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_05392.dir/STRUCT_CMSGCRED.c.o' failedmake[4]: ***
[CMakeFiles/cmTC_05392.dir/STRUCT_CMSGCRED.c.o] Error 1make[4]: Leaving
directory
'/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeTmp'Makefile:126:
recipe for target 'cmTC_05392/fast' failedmake[3]: *** [cmTC_05392/fast]
Error 2make[3]: Leaving directory
'/home/src/target/build_sim_cc_x86_64/syslog-ng-ext/src/syslog-ng-ext-build/CMakeFiles/CMakeTmp'*
It seems something related with the definition of __linux__ and __FreeBSD__.
Can you help me?
Thanks in advance,
Alex
On Tue, Nov 5, 2019 at 7:43 AM Antal Nemes (anemes) <
Antal.Nemes at oneidentity.com> wrote:
> Hi Alex,
>
> There are two concepts: CMAKE_INSTALL_PREFIX and DESTDIR, that I think you
> need to apply now.
>
> As a refresher, here is my understanding. CMAKE_INSTALL_PREFIX must be set
> to the directory, where the artifacts should reside in the custom os. That
> is most probably "/usr". That should set the the RPATH correctly.
>
> However, from packaging point of view, this causes a little trouble.
> Because when someone calls make install, the artifacts will be installed to
> CMAKE_INSTALL_PREFIX, merging the new files with the build OS files. And
> from that it is very hard to collect the artifacts properly.
>
> That is what DESTDIR is intended to resolve. Instead of calling make
> install, one needs to call make DESTDIR=<abs path to artifact directory>
> install. That will create the same structure that would have been created
> in CMAKE_INSTALL_PREFIX, just in $DESTDIR/$CMAKE_INSTALL_PREFIX. From that
> you can call targz or anything on the directory to collect the artifacts.
>
> For example: after
> $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_JAVA=no
> $ make -j
> $ mkdir /tmp/result
> $ make DESTDIR=/tmp/result install
>
> created a /tmp/result/usr/sbin/syslog-ng etc files, but with RPATH:
>
> $ objdump -x /tmp/result/usr/sbin/syslog-ng |grep RPATH
> RPATH /usr/lib
>
> as expected.
>
> I am afraid I do not know how to translate these into ExternalProject_add
> though.
>
> Br,
> Antal
> ------------------------------
> *From:* syslog-ng <syslog-ng-bounces at lists.balabit.hu> on behalf of
> Alexandre Santos <alexandre.rosas.santos at gmail.com>
> *Sent:* Monday, November 4, 2019 19:40
> *To:* syslog-ng at lists.balabit.hu <syslog-ng at lists.balabit.hu>
> *Subject:* [syslog-ng] Building syslog with cmake as external project
>
> CAUTION: This email originated from outside of the organization. Do not
> follow guidance, click links, or open attachments unless you recognize the
> sender and know the content is safe.
>
> Hi All,
>
> I am trying to build syslog-ng with cmake to add it to a custom Linux
> distribution.
>
> The problem is that when the syslog-ng is compiled it gets the RPATH of
> the location where it has been generated:
>
> *root at 5526d87140af:/home/src/**chassisx/build# ldd
> syslog-ng-install/sbin/syslog-*
>
> *ng linux-vdso.so.1 (0x00007fff151ed000)
> libsyslog-ng.so.3.24.1 => /home/src/target/build/**syslog-ng-install/lib/*
> *libsyslog-ng.so.3.24.1 (0x00007f81baf89000) libeventlog.so =>
> /home/src/target/build/**syslog-ng-install/lib/*
> *libeventlog.so (0x00007f81bad84000) libgmodule-2.0.so.0 =>
> /usr/lib/x86_64-linux-gnu/*
> *libgmodule-2.0.so.0 (0x00007f81bab80000) libgthread-2.0.so.0 =>
> /usr/lib/x86_64-linux-gnu/*
> *libgthread-2.0.so.0 (0x00007f81ba97e000) libglib-2.0.so.0 =>
> /lib/x86_64-linux-gnu/libglib-*
> *2.0.so.0 (0x00007f81ba66a000) libivykis.so.0 =>
> /home/src/target/build/**syslog-ng-install/lib/*
> *libivykis.so.0 (0x00007f81ba45b000) libpcre.so.3 =>
> /lib/x86_64-linux-gnu/libpcre.*
> *so.3 (0x00007f81ba1e8000) libresolv.so.2 =>
> /lib/x86_64-linux-gnu/*
> *libresolv.so.2 (0x00007f81b9fd1000) libssl.so.1.1 =>
> /usr/lib/x86_64-linux-gnu/*
> *libssl.so.1.1 (0x00007f81b9d65000) libcrypto.so.1.1 =>
> /usr/lib/x86_64-linux-gnu/*
> *libcrypto.so.1.1 (0x00007f81b98cc000) libsecret-storage.so =>
> /home/src/target/build/**syslog-ng-install/lib/*
> *libsecret-storage.so (0x00007f81b96c8000) libpthread.so.0 =>
> /lib/x86_64-linux-gnu/*
> *libpthread.so.0 (0x00007f81b94ab000) libc.so.6 =>
> /lib/x86_64-linux-gnu/libc.so.*
>
> *6 (0x00007f81b910c000) /lib64/ld-linux-x86-64.so.2
> (0x00007f81bb48e000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.**so.2
> (0x00007f81b8f08000)*
>
> I am using the cmake file in attachment.
>
> Can you help me?
> Thanks in advance,
>
> Alex
>
>
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation:
> http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20191105/dda140dc/attachment.html>
More information about the syslog-ng
mailing list