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

Nitish Saboo nitish.saboo55 at gmail.com
Thu Feb 6 08:39:20 UTC 2020


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> 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%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496910785&sdata=%2BCP70RsY0LJmfH0K%2FEy5bhxD6HKgzNU4FEdiMCaccTI%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%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&sdata=1Q%2FUex04eQ4kDcQoGwIm%2FersEqit7W8qil6aEC20lag%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%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&sdata=Od7XVpPtuxyu8igzSjXrLhJ5iuVjIDV9sjSOSy3Oxic%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%7C0a9ab8afa67a4c47891908d7aa3291d6%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637165006496960760&sdata=vKLhRgRAQqEruzIYWW7m3zIyWOY4FBKlMHlVNBaYVho%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/20200206/ae26a76e/attachment-0001.html>


More information about the syslog-ng mailing list