Subject: Re: static linking problem

Re: static linking problem

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 18 Oct 2010 23:59:26 -0700

On Tue, Oct 19, 2010 at 07:44:29AM +0100, may nothing wrote:
> Ok, my line now looks like: gcc -Wall -I/usr/include -I/usr/local/include
> -static sftptest.c -o sftptest -lssh2 -lssl -lcrypto -ldl -lz -lcrypto
>
> ... it just thows me one warning:
> /usr/lib/gcc/i586-suse-linux/4.4/../../../libcrypto.a(dso_dlfcn.o): In function
> `dlfcn_load':
> /usr/src/packages/BUILD/openssl-0.9.8k/crypto/dso/dso_dlfcn.c:159: warning:
> Using 'dlopen' in statically linked applications requires at runtime the shared
> libraries from the glibc version used for linking
>
> That might cause some problems since my compiling system is on Suse 11.0 and
> target is RHEL 4.5
> Is there a way to include this as well ?

This warning is to remind you that glibc is a lousy library when it comes
to statically linking. You basically can't do it entirely. Even though you
specified -static, glibc still needs some dynamic libraries for certain
functions, and those can't be compile statically. You either heed the
warning and ship your app with those dynamic libraries (if they're needed),
or you can use another libc that's better suited to static linking,
like uClibc.

>>> Dan
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-10-19