This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: using -static
Marco Trudel writes:
> Andrew Haley wrote:
> > Marco Trudel writes:
> >
> > > Do the following two configuration create the same executables?
> > > 1. shared GCJ, compiling with "gcj -static"
> > > 2. disable-shared GCJ, compiling with just "gcj"
> >
> > Should do.
>
> Cool :-)
>
> > > Both will create static executables, but the first one will print some
> > > warnings which do not occur with the second configuration.
> >
> > Why are you keeping these warnings secret from us?
>
>
> Well, I assumed that they either create different executables or the
> warnings are known. So I was too lazy to invest the 5 minutes... Sorry
> about that.
>
> But here we go:
>
> /home/Marco/Desktop/compile-lin-lin/gcc-4.2.0-lin-lin/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../libgcj.a(ltdl.o):
> In function `sys_dl_open':
> /home/Marco/.eclipse_workspace/GCC-source/libjava/libltdl/ltdl.c:1114:
> warning: Using 'dlopen' 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(natSystemProperties.o):
> In function `getpwuid_adaptor<__uid_t, passwd, char, size_t>':
> /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.
Andrew.