[syslog-ng] Building syslog with cmake as external project

Antal Nemes (anemes) Antal.Nemes at oneidentity.com
Tue Nov 5 07:43:29 UTC 2019


 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20191105/540addea/attachment.html>


More information about the syslog-ng mailing list