using -static

David Daney ddaney@avtrex.com
Tue Oct 17 14:56:00 GMT 2006


Andrew Haley wrote:
> Marco Trudel writes:
> /home/Marco/.eclipse_workspace/GCC-source/libjava/gnu/classpath/natSystemProperties.cc:97: 
> > warning: Using 'getpwuid_r' in statically linked applications requires 
> > at runtime the shared libraries from the glibc version used for linking
> > /home/Marco/Desktop/compile-lin-lin/gcc-4.2.0-lin-lin/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../libgcj.a(natInetAddress.o): 
> > In function `hidden alias for JArray<java::net::InetAddress*>* 
> > java::net::InetAddress::lookup(java::lang::String*, 
> > java::net::InetAddress*, bool)':
> > java/net/natInetAddress.cc:206: warning: Using 'gethostbyaddr_r' in 
> > statically linked applications requires at runtime the shared libraries 
> > from the glibc version used for linking
> > java/net/natInetAddress.cc:153: warning: Using 'gethostbyname_r' in 
> > statically linked applications requires at runtime the shared libraries 
> > from the glibc version used for linking
> > 
> > This warnings occur when compiling a simple System.out.println("hello") 
> > application with "-static".
>> That's interesting. It tells you that you really shouldn't link
> statically against libc, but I don't think that's news.
>Certainly it is not new news. I might suggest the shiny new (4.2 only) 
-static-libgcj compile time option as an alternative.
As time passes, libgcj is doing more and more dynamic linking. A static 
libc does not work well with dynamic linking. Static linking against 
libc really only makes sense in the situation where there is only a 
single executable image running in the entire system (ala busybox). 
Unless you are working on small embedded systems, it is almost always 
the wrong thing to do.
David Daney


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /