[syslog-ng] cross compiling syslog-ng
balazs.scheidler at balabit.com
Thu Oct 5 12:35:33 UTC 2017
I've figured I would give syslog-ng cross compilation a spin to check if
everything is all right with our sources.
Here's a description on how I've cross-compiled syslog-ng to arm64.
I've used the docker based cross-compile toolchain from here:
You'll need docker on your build machine, see docker.com for intallation
To use that, you'll only need to launch a docker command line and it would
automatically fetch the image from the docker registry. I've used
linux-arm64 as an example, but I guess the others would also work.
You will need the release tarball. Please note that you can download both
the release tarball and a git snaphot from github, but you'll definitely
need the release tarball if you don't have all the build requirements
installed (automake, libtool and friends).
3) get the dockcross helper
$ docker run --rm dockcross/linux-arm64 > dockcross
$ chmod +x dockcross
*4) launch the cross-compile environment*
Extract the sources (e.g. tar xvfz syslog-ng-3.12.1.tar.gz) into a
directory, cd into it and launch the environment:
$ dockcross bash
This will give you a shell within the container, with a /work directory
containing the sources.
*5) install dependencies*
# this one fixes an issue within the container, "cpp" is unfortunately only
# with a versioned binary, which the configure script does not find.
$ sudo ln -s /usr/bin/aarch64-linux-gnu-cpp-4.9
# this is the minimal set of dependencies to compile syslog-ng, you might
# the bundled sources should however give you a pretty ok feature set
$ sudo apt-get install libglib2.0-dev:arm64 pkg-config:arm64
$ mkdir build
$ cd build
$ /work/configure --host aarch64-linux-gnu
<long configure output>
$ make install DESTDIR=/work/build/install
The resulting set of binaries you will find in /work/build/install, as if
it was installed in the root system (e.g. /usr/local/bin/syslog-ng would
*8) collect binaries*
Exit the docker container, your build products will be in the "build"
subdirectory of your source tree, with build/install containing the final
bazsi at bzorp:~/src/syslog-ng-3.12.1/build/install$ file
usr/local/sbin/syslog-ng: ELF 64-bit LSB executable, ARM aarch64, version 1
(SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for
GNU/Linux 3.7.0, BuildID[sha1]=424c7a32112262725b267e6043c25bd40d039568,
I hope this helps.
On Thu, Oct 5, 2017 at 10:37 AM, Scheidler, Balázs <
balazs.scheidler at balabit.com> wrote:
> This might actually be a libtool issue, trying to locate the file in an
> invalid location. Do you have libtool in your toolchain? In order to use
> the one in your toolchain, you will need the complete set of autotools and
> rerun autogen.sh to regenerate all build files.
> BTW: the AX_PREFIX_CONFIG_H macro is also part of autoconf-archive (
> but probably a later version than what you have.
> But you can always add these macros by downloading them explicitly and
> adding them to the m4 subdirectory.
> On Wed, Oct 4, 2017 at 4:35 PM, Benoit Duffez <notifications at github.com>
>> I have not solved it. It accepts to compile but the linker seems to fail:
>> CCLD lib/libsyslog-ng.la
>> libtool: link: warning: library `/opt/toolchains/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libgmodule-2.0.la' was moved.
>> libtool: link: warning: library `/opt/toolchains/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libgthread-2.0.la' was moved.
>> libtool: link: warning: library `/opt/toolchains/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libglib-2.0.la' was moved.
>> libtool: link: warning: library `/opt/toolchains/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libpcre.la' was moved.
>> libtool: link: warning: library `/opt/toolchains/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libuuid.la' was moved.
>> sed: can't read /usr/lib/libglib-2.0.la: No such file or directory
>> libtool: link: `=/usr/lib/libglib-2.0.la' is not a valid libtool archive
>> Makefile:7092: recipe for target 'lib/libsyslog-ng.la' failed
>> make: *** [lib/libsyslog-ng.la] Error 1
>> Makefile:16376: recipe for target 'all-recursive' failed
>> make: *** [all-recursive] Error 1
>> Makefile:6285: recipe for target 'all' failed
>> make: *** [all] Error 2
>> I think it's a PATH issue because I do have this libglib-2.0.la file,
>> just not at /usr/bin (but in a subfolder of /opt/toolchains)
>> You are receiving this because you are subscribed to this thread.
>> Reply to this email directly, view it on GitHub
>> or mute the thread
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the syslog-ng