[syslog-ng] Building syslog with cmake as external project
Antal Nemes (anemes)
Antal.Nemes at oneidentity.com
Wed Nov 6 07:38:11 UTC 2019
I think this is normal.
Cmake tries to detect if struct cmsgcred is available in the system or not. This is done by generating a test file ("STRUCT_CMSGCRED.C") and try to compile it. If struct cmsgcred is not available the compilation will fail. If your cmake call does not work, I do not think this is the reason. I can see the exact same errors on my ubuntu xenial machine, and the compilation works for me.
Br,
Antal
________________________________
From: syslog-ng <syslog-ng-bounces at lists.balabit.hu> on behalf of Alexandre Santos <alexandre.rosas.santos at gmail.com>
Sent: Tuesday, November 5, 2019 15:42
To: Syslog-ng users' and developers' mailing list <syslog-ng at lists.balabit.hu>
Subject: Re: [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 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.log
Determining 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/CMakeTmp
Run 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/build
make[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' failed
make[4]: *** [CMakeFiles/cmTC_05392.dir/STRUCT_CMSGCRED.c.o] Error 1
make[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' failed
make[3]: *** [cmTC_05392/fast] Error 2
make[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<mailto: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<mailto:syslog-ng-bounces at lists.balabit.hu>> on behalf of Alexandre Santos <alexandre.rosas.santos at gmail.com<mailto:alexandre.rosas.santos at gmail.com>>
Sent: Monday, November 4, 2019 19:40
To: syslog-ng at lists.balabit.hu<mailto:syslog-ng at lists.balabit.hu> <syslog-ng at lists.balabit.hu<mailto: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<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7CAntal.Nemes%40oneidentity.com%7Cce40087f5652459a83f708d761fe73fa%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637085617819424804&sdata=vUtHsLqSqwyEe%2FBgEFLYPuS2lhDfYyepCl6PrMrQMGs%3D&reserved=0>
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7CAntal.Nemes%40oneidentity.com%7Cce40087f5652459a83f708d761fe73fa%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637085617819434806&sdata=4QjGC0TF2NHz4dYbzr5mhT08uUk1xDW4aWBz2qBiMMw%3D&reserved=0>
FAQ: http://www.balabit.com/wiki/syslog-ng-faq<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7CAntal.Nemes%40oneidentity.com%7Cce40087f5652459a83f708d761fe73fa%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637085617819434806&sdata=sjxXLZ6F38eNFlLKqErx1QPkyrse9XEkofd5DiToLXE%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20191106/684578cd/attachment-0001.html>
More information about the syslog-ng
mailing list