<div dir="ltr"><div><div><div><div><div>hi,<br><br></div>I've figured I would give syslog-ng cross compilation a spin to check if everything is all right with our sources.<br><br></div>Here's a description on how I've cross-compiled syslog-ng to arm64.<br><br></div><b>1) toolchain<br></b><br></div>I've used the docker based cross-compile toolchain from here: <a href="https://github.com/dockcross/dockcross">https://github.com/dockcross/dockcross</a></div><div><br></div><div>You'll need docker on your build machine, see <a href="http://docker.com">docker.com</a> for intallation instructions.<br></div><div><br></div><div>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.</div><div><br></div><div><b>2) sources</b></div><div><br></div><div>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).</div><div><br></div><div>I've used <a href="https://github.com/balabit/syslog-ng/releases/download/syslog-ng-3.12.1/syslog-ng-3.12.1.tar.gz">https://github.com/balabit/syslog-ng/releases/download/syslog-ng-3.12.1/syslog-ng-3.12.1.tar.gz</a></div><div><br></div><div>3) get the dockcross helper<br></div><div></div><div><br></div><div>```<br></div><div><div><div><div><div><div><div class="gmail_extra">$ docker run --rm dockcross/linux-arm64 > dockcross</div><div class="gmail_extra">$ chmod +x dockcross</div><div class="gmail_extra">```</div><div class="gmail_extra"><br></div><b>4) launch the cross-compile environment</b></div><div><br></div><div>Extract the sources (e.g. tar xvfz syslog-ng-3.12.1.tar.gz) into a directory, cd into it and launch the environment:</div><div><br></div><div>```<br></div><div>$ dockcross bash</div><div>```</div><div><br></div><div>This will give you a shell within the container, with a /work directory containing the sources.<br></div><div><br></div><div><b>5) install dependencies</b></div><div><br></div><div>```</div><div># this one fixes an issue within the container, "cpp" is unfortunately only available <br></div><div># with a versioned binary, which the configure script does not find.<br></div><div>$ sudo ln -s /usr/bin/aarch64-linux-gnu-cpp-4.9 /usr/bin/aarch64-linux-gnu-cpp</div><div><br></div><div># this is the minimal set of dependencies to compile syslog-ng, you might need others</div><div># the bundled sources should however give you a pretty ok feature set<br></div><div>$ sudo apt-get install libglib2.0-dev:arm64 pkg-config:arm64<br></div><div>```</div><div><br></div><div><b>6) build</b></div><div><br></div><div>```</div><div>$ mkdir build</div><div>$ cd build</div><div>$ /work/configure --host aarch64-linux-gnu</div><div><long configure output></div><div>$ make</div><div>```</div><div><br></div><div><b>7) install</b></div><div><b><br></b></div><div>```</div><div>$ make install DESTDIR=/work/build/install<br></div><div>```</div><div><br></div><div>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 become /work/build/install/usr/local/bin/syslog-ng)</div><div><br></div><div><b>8) collect binaries</b></div><div><b><br></b></div><div>Exit the docker container, your build products will be in the "build" subdirectory of your source tree, with build/install containing the final binaries.</div><div><br></div><div>bazsi@bzorp:~/src/syslog-ng-3.12.1/build/install$ file usr/local/sbin/syslog-ng<br>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, not stripped</div><div><br></div><div>I hope this helps.<br></div><div><br></div><div>-- <br><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr">Bazsi<br></div></div></div>
<br><div class="gmail_quote">On Thu, Oct 5, 2017 at 10:37 AM, Scheidler, Balázs <span dir="ltr"><<a href="mailto:balazs.scheidler@balabit.com" target="_blank">balazs.scheidler@balabit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>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.<br><br></div>BTW: the <code>AX_PREFIX_CONFIG_H macro is also part of autoconf-archive (<a href="https://www.gnu.org/software/autoconf-archive/ax_prefix_config_h.html" target="_blank">https://www.gnu.org/software/<wbr>autoconf-archive/ax_prefix_<wbr>config_h.html</a>), but probably a later version than what you have.<br><br></code></div><code>But you can always add these macros by downloading them explicitly and adding them to the m4 subdirectory.<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></code></div><div class="gmail_extra"><span class="gmail-HOEnZb"><font color="#888888"><br clear="all"><div><div class="gmail-m_-6535142974723391173gmail_signature"><div dir="ltr">-- <br>Bazsi<br></div></div></div></font></span><div><div class="gmail-h5">
<br><div class="gmail_quote">On Wed, Oct 4, 2017 at 4:35 PM, Benoit Duffez <span dir="ltr"><<a href="mailto:notifications@github.com" target="_blank">notifications@github.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p>I have not solved it. It accepts to compile but the linker seems to fail:</p>
<pre><code> CCLD lib/<a href="http://libsyslog-ng.la" target="_blank">libsyslog-ng.la</a>
libtool: link: warning: library `/opt/toolchains/sysroots/cort<wbr>exa9hf-neon-poky-linux-gnueabi<wbr>/usr/lib/<a href="http://libgmodule-2.0.la" target="_blank">libgmodule-2.0.la</a>' was moved.
libtool: link: warning: library `/opt/toolchains/sysroots/cort<wbr>exa9hf-neon-poky-linux-gnueabi<wbr>/usr/lib/<a href="http://libgthread-2.0.la" target="_blank">libgthread-2.0.la</a>' was moved.
libtool: link: warning: library `/opt/toolchains/sysroots/cort<wbr>exa9hf-neon-poky-linux-gnueabi<wbr>/usr/lib/<a href="http://libglib-2.0.la" target="_blank">libglib-2.0.la</a>' was moved.
libtool: link: warning: library `/opt/toolchains/sysroots/cort<wbr>exa9hf-neon-poky-linux-gnueabi<wbr>/usr/lib/<a href="http://libpcre.la" target="_blank">libpcre.la</a>' was moved.
libtool: link: warning: library `/opt/toolchains/sysroots/cort<wbr>exa9hf-neon-poky-linux-gnueabi<wbr>/usr/lib/<a href="http://libuuid.la" target="_blank">libuuid.la</a>' was moved.
sed: can't read /usr/lib/<a href="http://libglib-2.0.la" target="_blank">libglib-2.0.la</a>: No such file or directory
libtool: link: `=/usr/lib/<a href="http://libglib-2.0.la" target="_blank">libglib-2.0.la</a>' is not a valid libtool archive
Makefile:7092: recipe for target 'lib/<a href="http://libsyslog-ng.la" target="_blank">libsyslog-ng.la</a>' failed
make[2]: *** [lib/<a href="http://libsyslog-ng.la" target="_blank">libsyslog-ng.la</a>] Error 1
Makefile:16376: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:6285: recipe for target 'all' failed
make: *** [all] Error 2
</code></pre>
<p>I think it's a PATH issue because I do have this <a href="http://libglib-2.0.la" target="_blank">libglib-2.0.la</a> file, just not at <code>/usr/bin</code> (but in a subfolder of <code>/opt/toolchains</code>)</p><div class="gmail-m_-6535142974723391173HOEnZb"><div class="gmail-m_-6535142974723391173h5">
<p style="font-size:small;color:rgb(102,102,102)">—<br>You are receiving this because you are subscribed to this thread.<br>Reply to this email directly, <a href="https://github.com/balabit/syslog-ng/issues/1705#issuecomment-334176270" target="_blank">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AArldnMjDwe5Mfaj6m3FPTfidBvM_sC_ks5so5fCgaJpZM4PtokL" target="_blank">mute the thread</a>.<img alt="" src="https://github.com/notifications/beacon/AArldkjTlDSQaMv1Mnh3L33Gyg1XCsWcks5so5fCgaJpZM4PtokL.gif" width="1" height="1"></p>
<div>
<div>
</div>
</div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div></div></div></div></div>