[syslog-ng] Getting error : .../libsyslog-ng.so: file not recognized: File truncated

Nitish Saboo nitish.saboo55 at gmail.com
Tue Feb 11 10:55:57 UTC 2020


Hi Kokan,

I am not sure if my previous message was posted on this group because I got
a reply stating that the message size was greater than 200KB.

Thank you  Kokan for you esteemed guidance.I will follow all the possible
ideas that you have suggested.In the mean time I did the following:

1) DO check with other tools if your .so is sane: readelf, objdump, nm or
whatever

>> I checked the libsyslog-ng.so using the readelf command and looks like
it is sane.

2)As you pointed out,  looks like libsyslog-ng.so which is a symlink is an
issue.
If the other machine where I am compiling my CGO project is not able to
identify the libsyslog-ng.so symlink, I can convert that symlink to the
target file (i.e. a copy of the symlink target) and try compiling ..right
?Can we have this workaround ?

/Desktop/syslog/syslog-ng-3.7.1/install/lib$ ls -lrt
total 9124
-rwxr-xr-x 1 ubuntu ubuntu 3105687 Feb  7 01:17 libsyslog-ng-3.7.so.0.0.0
-rwxr-xr-x 1 ubuntu ubuntu    1170 Feb  7 01:17 libsyslog-ng.la
drwxrwxr-x 3 ubuntu ubuntu    4096 Feb  7 01:17 python2.7
drwxrwxr-x 3 ubuntu ubuntu    4096 Feb  7 01:17 syslog-ng
drwxrwxr-x 2 ubuntu ubuntu    4096 Feb  7 01:17 pkgconfig
-rwxr-xr-x 1 ubuntu ubuntu 3105687 Feb  8 11:01 libsyslog-ng.so
-rwxr-xr-x 1 ubuntu ubuntu 3105687 Feb  8 11:02 libsyslog-ng-3.7.so.0

I used the following command to convert symlink to a target file :

cp --remove-destination `readlink libsyslog-ng.so` libsyslog-ng.so

Thanks,
Nitish

On Fri, Feb 7, 2020 at 6:56 PM Peter Kokai (pkokai) <
Peter.Kokai at oneidentity.com> wrote:

> Hello,
>
> > [11:50:29][shellscript]
> lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so: file not
> recognized: File truncated
> > [11:50:29][shellscript] collect2: error: ld returned 1 exit status
> > [11:50:29][shellscript] make: *** [main] Error 2
>
> According to your linker the
> lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so is not a
> binary format it can recognise.
> It tries so hard to find the correct one[1]: elf (usually on linx), Mac-O,
> Coff, XCoff
>
> BTW I would not build one project on two different machine (it should just
> compile fine on either one of them).
>
> Possible ideas:
> 1) DO check with other tools if your .so is sane: readelf, objdump, nm or
> whatever
> 2) Check if symlinks does not screw up your build  (by default
> libsyslog-ng.so is just a symlink)
> 3) Somehow convince your GO compiler to either list the exact GCC steps it
> does (with linker options etc) and not your CFLAGS, the exact commands GO
> compiler calls gcc with (internet can help here)
> 4) Provide the socurce/build system and/or binary
>
> [1]
> https://github.com/gcc-mirror/gcc/blob/3c7a03bc360c3511fae3747a71e579e9fd0824f9/libiberty/simple-object.c#L166-L186
>
> --
> Kokan
>
>
> On Fri, Feb 07, 2020 at 05:38:51PM +0530, Nitish Saboo wrote:
> > 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 Kokan,
> >
> > 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:
> >
> > [11:50:29][shellscript]
> lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so: file not
> recognized: File truncated
> > [11:50:29][shellscript] collect2: error: ld returned 1 exit status
> > [11:50:29][shellscript] make: *** [main] Error 2
> >
> > 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 ?
> > 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.
> >
> > Thanks,
> > Nitish
> >
> > On Thu, Feb 6, 2020 at 2:09 PM Nitish Saboo <nitish.saboo55 at gmail.com
> <mailto:nitish.saboo55 at gmail.com>> wrote:
> > Hi Kokan,
> >
> > 1)Have you verified if both file is the same (no transport issue) ?
> (check sha256sum)
> >
> > 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.
> >
> > 2)What was the exact linker option it was called with ? (you can ask
> gcc/clang to emit such information with -### option)
> >
> > Are you asking for the following options that I am using to compile the
> project ?:
> >
> > //#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/
> > //#cgo CFLAGS: -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/build
> > //#cgo CFLAGS:
> -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/include/
> > //#cgo CFLAGS:
> -I${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/include/syslog-ng
> > //#cgo LDFLAGS: -L${SRCDIR}/../deps/syslog/ssyslog-ng-3.7.1/install/lib
> -lsyslog-ng
> > //#cgo LDFLAGS:
> -L${SRCDIR}/../deps/syslog/syslog-ng-3.7.1/install/lib/syslog-ng -ldbparser
> > //#cgo pkg-config: eventlog
> > //#cgo CFLAGS: -I/usr/include/glib-2.0
> > //#cgo CFLAGS: -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> > //#include <stdlib.h>
> > //void callback(char *key, char *value, size_t value_len, int mapid);//
> Forward Declaration.
> > //#include "syslog-node1.h"
> >
> > 3)Could other tools - that understands elf - read that library ?
> >
> > >>I don't think so there is anything else reading that library apart
> from my CGO project.
> >
> > 4)One thing I noticed is when I try to compile the CGO project on a
> Ubuntu 18.04 machine the compilation goes fine.
> > But when I try to compile the project on a Ubuntu 14.04 it is failing
> with the error mentioned in earlier mail.
> >
> > Do I have to compile syslog-ng against Ubuntu 14.04  and then try
> compiling my CGO project on Ubuntu 14.04 ?
> > 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.
> >
> > Thanks,
> > Nitish
> >
> >
> > On Wed, Feb 5, 2020 at 5:40 PM Peter Kokai (pkokai) <
> Peter.Kokai at oneidentity.com<mailto:Peter.Kokai at oneidentity.com>> wrote:
> > Hello,
> >
> > Have you verified if both file is the same (no transport issue) ? (check
> sha256sum)
> > Could other tools - that understands elf - read that library ? (readelf
> -a syslog..so)
> >
> > What was the exact linker option it was called with ? (you can ask
> gcc/clang to emit such information with -### option)
> >
> > --
> > Kokan
> > On Wed, Feb 05, 2020 at 05:27:09PM +0530, Nitish Saboo wrote:
> > > 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,
> > >
> > > 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.
> > >
> > > ----------------------------------------------------------------------
> > > Libraries have been installed in:
> > >    /home/anassa/nitish/syslog-ng-3.7.1/install/lib
> > >
> > > If you ever happen to want to link against installed libraries
> > > in a given directory, LIBDIR, you must either use libtool, and
> > > specify the full pathname of the library, or use the `-LLIBDIR'
> > > flag during linking and do at least one of the following:
> > >    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
> > >      during execution
> > >    - add LIBDIR to the `LD_RUN_PATH' environment variable
> > >      during linking
> > >    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
> > >    - have your system administrator add LIBDIR to `/etc/ld.so.conf'
> > >
> > > See any operating system documentation about shared libraries for
> > > more information, such as the ld(1) and ld.so(8) manual pages.
> > > ----------------------------------------------------------------------
> > >
> > >
> > >
> > >
> --------------------------------------------------------------------Libraries
> have been installed in:
> > >    /home/anassa/nitish/syslog-ng-3.7.1/install/lib/syslog-ng
> > >
> > > If you ever happen to want to link against installed libraries
> > > in a given directory, LIBDIR, you must either use libtool, and
> > > specify the full pathname of the library, or use the `-LLIBDIR'
> > > flag during linking and do at least one of the following:
> > >    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
> > >      during execution
> > >    - add LIBDIR to the `LD_RUN_PATH' environment variable
> > >      during linking
> > >    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
> > >    - have your system administrator add LIBDIR to `/etc/ld.so.conf'
> > >
> > > See any operating system documentation about shared libraries for
> > > more information, such as the ld(1) and ld.so(8) manual pages.
> > > ----------------------------------------------------------------------
> > >
> > >
> > > -Ubuntu:~/nitish/syslog-ng-3.7.1/install/lib$ gcc --version
> > > gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
> > > Copyright (C) 2015 Free Software Foundation, Inc.
> > > This is free software; see the source for copying conditions.  There
> is NO
> > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> > >
> > >
> > > My project got compiled in 'syslog-ng-3.7.1' folder on machine Ubuntu
> 16.04.
> > >
> > > 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.
> > > 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:
> > >
> > > Error
> > > =====
> > >
> > > lib/../deps/syslog/syslog-ng-3.7.1/install/lib/libsyslog-ng.so: file
> not recognized: File truncated
> > > [11:36:44][shellscript] collect2: error: ld returned 1 exit status
> > > [11:36:44][shellscript] make: *** [main] Error 2
> > >
> > >
> > > The file 'libsyslog-ng.so' is present  at the  location
> 'lib/../deps/syslog/syslog-ng-3.7.1/install/lib/':
> > >
> > > total 3152
> > > drwxrwxr-x 2 anassa anassa    4096 Feb  5 16:47 pkgconfig
> > > -rwxr-xr-x 1 anassa anassa 3208176 Feb  5 16:47
> libsyslog-ng-3.7.so.0.0.0
> > > lrwxrwxrwx 1 anassa anassa      25 Feb  5 16:47 libsyslog-ng.so ->
> libsyslog-ng-3.7.so.0.0.0
> > > -rwxr-xr-x 1 anassa anassa    1155 Feb  5 16:47 libsyslog-ng.la<
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Flibsyslog-ng.la&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497489141&sdata=%2Fi8zLEZKTtFsQ8JpRUwstQTuJOwZvsA%2FG85MrsQiwvE%3D&reserved=0
> ><
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Flibsyslog-ng.la&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497489141&sdata=%2Fi8zLEZKTtFsQ8JpRUwstQTuJOwZvsA%2FG85MrsQiwvE%3D&reserved=0
> >
> > > lrwxrwxrwx 1 anassa anassa      25 Feb  5 16:47 libsyslog-ng-3.7.so.0
> -> libsyslog-ng-3.7.so.0.0.0
> > > drwxrwxr-x 3 anassa anassa    4096 Feb  5 16:47 python2.7
> > > drwxrwxr-x 3 anassa anassa    4096 Feb  5 16:47 syslog-ng
> > >
> > > Can someone please guide me what could be the possible reasons to get
> this error ? What am I missing here ?
> > >
> > >
> > > Thanks,
> > > Nitish
> >
> >
> > >
> ______________________________________________________________________________
> > > Member info:
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497489141&sdata=PogwUoYyrTlAD2DeJfdMMP995HCO6avOEBtrVbchmqU%3D&reserved=0
> > > Documentation:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497489141&sdata=8xF0sK%2FMSbZdUzgIbWMajne02WPrpeALlUqMNKDne1k%3D&reserved=0
> > > FAQ:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497489141&sdata=rccdWsB90%2Bei3I%2BcFilaK00o72fnT5S%2FyPLQFI518Mo%3D&reserved=0
> > >
> >
> ______________________________________________________________________________
> > Member info:
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497499138&sdata=IP%2FbhDzmnyTXG2yYdQQjAfmG1tm0gvwTan7eDmSHxQc%3D&reserved=0
> > Documentation:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497499138&sdata=mg2LRmdmVtMpTV%2F5TYnIHKbqxaIAmaP6uqyozKkVSV4%3D&reserved=0
> > FAQ:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497499138&sdata=1%2FL3BgxpTo0RdOvumd8k68v89cw7Dg67IWV90UMwi78%3D&reserved=0
> >
>
> >
> ______________________________________________________________________________
> > Member info:
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497589077&sdata=N5P6Blja2sXVwq%2BveGVxNXizm1Wo%2BwzZa8Hgz9mQjO0%3D&reserved=0
> > Documentation:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497589077&sdata=hnJlfGG5A14Hd4qudqc51mmL2aITlGYV8OMcgc%2FIuvY%3D&reserved=0
> > FAQ:
> https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7Cpeter.kokai%40oneidentity.com%7Cf65c300855534b9c1de408d7abc68835%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637166741497589077&sdata=nJSzGtEGCoWwaHxx2VMZOg2TqOVXMuEry5vZWUTU18s%3D&reserved=0
> >
>
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation:
> http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20200211/9d715268/attachment-0001.html>


More information about the syslog-ng mailing list