<div dir="ltr">Hi Kokan,<div><br><div><div>Today, I compiled syslog-ng-3.7.1 on a Ubuntu 14.04 'Desktop' version(on a VM).Then I tried compiling my CGO project  with syslog-ng dependecies on a Ubuntu 14.04 'Server' and it failed with the same error:</div><div><br></div><div>[11:50:29][shellscript] lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so: file not recognized: File truncated<br>[11:50:29][shellscript] collect2: error: ld returned 1 exit status<br>[11:50:29][shellscript] make: *** [main] Error 2<br></div><div><br></div><div>Is it possible that the syslog-ng was compiled on a Ubuntu 14.04 Desktop version and then compiling the CGO project on a Ubuntu 14.04 Server causing this error ?</div></div></div><div>There is no architecture difference between Ubuntu Desktop version and Ubuntu server but I am not sure if that can cause issue with this libsyslog-ng.so shared object.</div><div><br></div><div>Thanks,</div><div>Nitish</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020 at 2:09 PM Nitish Saboo <<a href="mailto:nitish.saboo55@gmail.com">nitish.saboo55@gmail.com</a>> wrote:<br></div><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 dir="ltr">Hi Kokan,<div><br></div><div>1)Have you verified if both file is the same (no transport issue) ? (check sha256sum)</div><div><br></div><div>Yes, the checksum of the file is same on the machine(Ubuntu 16.04) where I compiled syslog-ng3.7.1 and on the machine(Ubuntu 14.04) where I am trying to compile my CGO project.</div><div><br></div><div>2)What was the exact linker option it was called with ? (you can ask gcc/clang to emit such information with -### option)</div><div><br></div><div>Are you asking for the following options that I am using to compile the project ?:</div><div><br></div><div>//#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/<br>//#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/build<br>//#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/include/<br>//#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/include/syslog-ng<br>//#cgo LDFLAGS: -L${SRCDIR}/../deps/syslog/ssyslog-ng-3.7.1/install/lib -lsyslog-ng<br>//#cgo LDFLAGS: -L${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/lib/syslog-ng -ldbparser<br>//#cgo pkg-config: eventlog<br>//#cgo CFLAGS: -I/usr/include/glib-2.0<br>//#cgo CFLAGS: -I/usr/lib/x86_64-linux-gnu/glib-2.0/include<br>//#include <stdlib.h><br>//void callback(char *key, char *value, size_t value_len, int mapid);// Forward Declaration.<br>//#include "syslog-node1.h"<br></div><div><br></div><div>3)Could other tools - that understands elf - read that library ?</div><div><br></div><div>>>I don't think so there is anything else reading that library apart from my CGO project.</div><div><br></div><div>4)One thing I noticed is when I try to compile the CGO project on a Ubuntu 18.04 machine the compilation goes fine.</div><div>But when I try to compile the project on a Ubuntu 14.04 it is failing with the error mentioned in earlier mail.</div><div><br></div><div>Do I have to compile syslog-ng against Ubuntu 14.04  and then try compiling my CGO project on Ubuntu 14.04 ?</div><div>Since I compiled syslog-ng on Ubuntu 16.04 and then compiling my CGO project on Ubuntu 14.04, can this be the cause of the issue ?Just a thought, I am not sure if my understanding is correct.</div><div><br></div><div>Thanks,</div><div>Nitish</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020 at 5:40 PM Peter Kokai (pkokai) <<a href="mailto:Peter.Kokai@oneidentity.com" target="_blank">Peter.Kokai@oneidentity.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
Have you verified if both file is the same (no transport issue) ? (check sha256sum)<br>
Could other tools - that understands elf - read that library ? (readelf -a syslog..so)<br>
<br>
What was the exact linker option it was called with ? (you can ask gcc/clang to emit such information with -### option)<br>
<br>
--<br>
Kokan<br>
On Wed, Feb 05, 2020 at 05:27:09PM +0530, Nitish Saboo wrote:<br>
> 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.<br>
> <br>
> Hi,<br>
> <br>
> I compiled the syslog-ng-3.7.1.tar.gz on a Ubuntu 16.04 machine .The syslog-ng got compiled successfully on this machine.<br>
> <br>
> ----------------------------------------------------------------------<br>
> Libraries have been installed in:<br>
>    /home/anassa/nitish/syslog-ng-3.7.1/install/lib<br>
> <br>
> If you ever happen to want to link against installed libraries<br>
> in a given directory, LIBDIR, you must either use libtool, and<br>
> specify the full pathname of the library, or use the `-LLIBDIR'<br>
> flag during linking and do at least one of the following:<br>
>    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable<br>
>      during execution<br>
>    - add LIBDIR to the `LD_RUN_PATH' environment variable<br>
>      during linking<br>
>    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag<br>
>    - have your system administrator add LIBDIR to `/etc/ld.so.conf'<br>
> <br>
> See any operating system documentation about shared libraries for<br>
> more information, such as the ld(1) and ld.so(8) manual pages.<br>
> ----------------------------------------------------------------------<br>
> <br>
> <br>
> <br>
> --------------------------------------------------------------------Libraries have been installed in:<br>
>    /home/anassa/nitish/syslog-ng-3.7.1/install/lib/syslog-ng<br>
> <br>
> If you ever happen to want to link against installed libraries<br>
> in a given directory, LIBDIR, you must either use libtool, and<br>
> specify the full pathname of the library, or use the `-LLIBDIR'<br>
> flag during linking and do at least one of the following:<br>
>    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable<br>
>      during execution<br>
>    - add LIBDIR to the `LD_RUN_PATH' environment variable<br>
>      during linking<br>
>    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag<br>
>    - have your system administrator add LIBDIR to `/etc/ld.so.conf'<br>
> <br>
> See any operating system documentation about shared libraries for<br>
> more information, such as the ld(1) and ld.so(8) manual pages.<br>
> ----------------------------------------------------------------------<br>
> <br>
> <br>
> -Ubuntu:~/nitish/syslog-ng-3.7.1/install/lib$ gcc --version<br>
> gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609<br>
> Copyright (C) 2015 Free Software Foundation, Inc.<br>
> This is free software; see the source for copying conditions.  There is NO<br>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>
> <br>
> <br>
> My project got compiled in 'syslog-ng-3.7.1' folder on machine Ubuntu 16.04.<br>
> <br>
> I have a different machine  with Ubuntu 14.04.I copied 'syslog-ng-3.7.1' folder on this machine (Ubuntu 14.04). In this machine I tried compiling my CGO project (Go and C) where my Go code is calling the C wrapper code that internally call syslog-ng api's.<br>
> I have defined all the CFLAGS and LDFLAGS in my Go code for the run-timne dependencies. At the time of compilation it is failing with the following error:<br>
> <br>
> Error<br>
> =====<br>
> <br>
> lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so: file not recognized: File truncated<br>
> [11:36:44][shellscript] collect2: error: ld returned 1 exit status<br>
> [11:36:44][shellscript] make: *** [main] Error 2<br>
> <br>
> <br>
> The file 'libsyslog-ng.so' is present  at the  location 'lib/../deps/syslog/syslog-ng-3.7.1/install/lib/':<br>
> <br>
> total 3152<br>
> drwxrwxr-x 2 anassa anassa    4096 Feb  5 16:47 pkgconfig<br>
> -rwxr-xr-x 1 anassa anassa 3208176 Feb  5 16:47 libsyslog-ng-3.7.so.0.0.0<br>
> lrwxrwxrwx 1 anassa anassa      25 Feb  5 16:47 libsyslog-ng.so -> libsyslog-ng-3.7.so.0.0.0<br>
> -rwxr-xr-x 1 anassa anassa    1155 Feb  5 16:47 <a href="http://libsyslog-ng.la" rel="noreferrer" target="_blank">libsyslog-ng.la</a><<a href="https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Flibsyslog-ng.la&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496910785&amp;sdata=%2BCP70RsY0LJmfH0K%2FEy5bhxD6HKgzNU4FEdiMCaccTI%3D&amp;reserved=0" rel="noreferrer" target="_blank">https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Flibsyslog-ng.la&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496910785&amp;sdata=%2BCP70RsY0LJmfH0K%2FEy5bhxD6HKgzNU4FEdiMCaccTI%3D&amp;reserved=0</a>><br>
> lrwxrwxrwx 1 anassa anassa      25 Feb  5 16:47 libsyslog-ng-3.7.so.0 -> libsyslog-ng-3.7.so.0.0.0<br>
> drwxrwxr-x 3 anassa anassa    4096 Feb  5 16:47 python2.7<br>
> drwxrwxr-x 3 anassa anassa    4096 Feb  5 16:47 syslog-ng<br>
> <br>
> Can someone please guide me what could be the possible reasons to get this error ? What am I missing here ?<br>
> <br>
> <br>
> Thanks,<br>
> Nitish<br>
<br>
<br>
> ______________________________________________________________________________<br>
> Member info: <a href="https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=1Q%2FUex04eQ4kDcQoGwIm%2FersEqit7W8qil6aEC20lag%3D&amp;reserved=0" rel="noreferrer" target="_blank">https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=1Q%2FUex04eQ4kDcQoGwIm%2FersEqit7W8qil6aEC20lag%3D&amp;reserved=0</a><br>
> Documentation: <a href="https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=Od7XVpPtuxyu8igzSjXrLhJ5iuVjIDV9sjSOSy3Oxic%3D&amp;reserved=0" rel="noreferrer" target="_blank">https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=Od7XVpPtuxyu8igzSjXrLhJ5iuVjIDV9sjSOSy3Oxic%3D&amp;reserved=0</a><br>
> FAQ: <a href="https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=vKLhRgRAQqEruzIYWW7m3zIyWOY4FBKlMHlVNBaYVho%3D&amp;reserved=0" rel="noreferrer" target="_blank">https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&amp;data=02%7C01%7CPeter.Kokai%40oneidentity.com%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&amp;sdata=vKLhRgRAQqEruzIYWW7m3zIyWOY4FBKlMHlVNBaYVho%3D&amp;reserved=0</a><br>
> <br>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" rel="noreferrer" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div></div>
</blockquote></div>