libtool: link order problem affecting gij

Bryce McKinlay bryce@waitaki.otago.ac.nz
Sat May 12 06:25:00 GMT 2001


There is a libtool problem which is breaking threading (and subsequently
Runtime.exec() and stack traces) for java programs started with gij.
libtool inserting lib flags ("-lgcc_s -lc -lgcc_s") into the gcj link
command line _before_ other lib flags which we are passing to it. This
means that libc is being linked before libpthread, which is bad:

$ ldd `which gij`
        libgcj.so.2 => /home/bryce/gcc31/lib/libgcj.so.2 (0x40018000)
        libm.so.6 => /lib/i686/libm.so.6 (0x404a3000)
        libgcc_s.so.0 => /home/bryce/gcc31/lib/libgcc_s.so.0
(0x404c7000)
        libc.so.6 => /lib/i686/libc.so.6 (0x404d1000)
        libdl.so.2 => /lib/libdl.so.2 (0x40601000)
        libgcjgc.so.1 => /home/bryce/gcc31/lib/libgcjgc.so.1
(0x40605000)
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40625000)
        libzgcj.so.0 => /home/bryce/gcc31/lib/libzgcj.so.0 (0x4063b000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

/bin/sh ./libtool --mode=link /home/bryce/cvs/gcc/build/gcc/gcj
-B/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/
-B/home/bryce/cvs/gcc/build/gcc/
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava -ffloat-store -g
-O2  -o gij -rpath /home/bryce/gcc31/lib -shared-libgcc gij.o libgcj.la
./../boehm-gc/libgcjgc.la
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/../boehm-gc/.libs
-lpthread ./../zlib/libzgcj.la
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/../zlib/.libs
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/.libs
/home/bryce/cvs/gcc/build/gcc/gcj
-B/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/
-B/home/bryce/cvs/gcc/build/gcc/ -ffloat-store -g -O2 -o .libs/gij
-shared-libgcc gij.o
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava ./.libs/libgcj.so
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libstdc++-v3/src
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -lm
-L/home/bryce/cvs/gcc/build/gcc
-L/home/bryce/gcc31/lib/gcc-lib/i686-pc-linux-gnu/3.1
-L/home/bryce/gcc31/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../.. -lgcc_s
-lc -lgcc_s -ldl ./../boehm-gc/.libs/libgcjgc.so
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/../boehm-gc/.libs
-lpthread ./../zlib/.libs/libzgcj.so
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/../zlib/.libs
-L/home/bryce/cvs/gcc/build/i686-pc-linux-gnu/libjava/.libs -Wl,--rpath
-Wl,/home/bryce/gcc31/lib

I don't understand why libtool is adding these flags or where they are
coming from. Is this a libtool bug? Should we be using libtool to link
the "gij" and "jv-convert" binaries, or should we just call the compiler
directly?

I think this problem only affects the trunk.

regards

  [ bryce ]




More information about the Java mailing list