[syslog-ng]syslog-ng 1.9.2/1.6.5 static linking

Jose Pedro Oliveira syslog-ng@lists.balabit.hu
Fri, 21 Jan 2005 15:22:18 +0000


Roberto,

>> The attachment is a new patch against syslog-1.6.5 configure.in.
>> It will static link the flex, the tcpwrappers and libnet libraries.
> 
> 
> I'm not sure I understand your patch but to me the essential part seems 
> to be:
> 
>> -LIBS="$LIBS $LEXLIB $LIBOL_LIBS"
>> +LIBS="$LIBS -Wl,-static $LEXLIB $LIBWRAP_LIBS $LIBNET_LIBS 
>> -Wl,-call_shared $LIBOL_LIBS"
>>  AC_SUBST(YFLAGS)
>>  
>>  AC_SUBST(MAKE_CLASS)
> 
> 
> I wonder however why you need this, as it's perfectly ok (at least for 
> me) to statically link syslog-ng and its components setting the LDFLAGS 
> when calling make:
> 
> # ./configure ...
> # make LDFLAGS=-static
> # ldd src/src/syslog-ng
>         not a dynamic executable
> 
> What am I missing?

Using the "-static" option you static linking *every* library,
including the ones installed in /lib (eg: libc).

With the patch you are only static linking libraries that
have been installed under the /usr directory (/usr/lib,
/usr/local/lib, ...).  You probably don't need to static
link libc and other /lib libraries.

Result (with the patched configure):
$ ldd syslog-ng
         libnsl.so.1 => /lib/libnsl.so.1 (0x043ee000)
         libresolv.so.2 => /lib/libresolv.so.2 (0x00614000)
         libc.so.6 => /lib/tls/libc.so.6 (0x002b5000)
         /lib/ld-linux.so.2 (0x0029c000)


Regards,
jpo
-- 
José Pedro Oliveira