GCJ 4.1.1 and static linking - SEGV

David Daney ddaney@avtrex.com
Wed Aug 16 19:18:00 GMT 2006


Thomas Aeby wrote:
> On Wed, 2006-08-16 at 09:13 -0700, David Daney wrote:
> 
>>Static linking with libgcj is a bit tricky.  Perhaps the information on 
>>in the Wiki would be of use:
>>
>>http://gcc.gnu.org/wiki/Statically_linking_libgcj
>>
>>I have had problems with statically linking to libc, but if you are 
>>careful, static linking to libgcj with a dynamic libc seems to work well.
> 
> 
> Actually, with 4.1.1 linking partially static works like a charm when
> having built gcc with --disable-shared:
> 
>   # gcj --main=test test.java
> 
> does the trick:
> 
>   # ldd a.out
>         libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7fc4000)
>         libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0
> (0xb7fb3000)
>         libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7fb0000)
>         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e7b000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fea000)
> 
> However, I am trying to build a completely statically linked binary. I'm
> not even new to this kind of problem - I'm building the project in
> question statically and more or less successfully since GCC 3.4.0 (using
> a glibc built with --enable-static-nss). 
> 
> That's why I am very surprised to fail miserably with 4.1.1 and cannot
> believe it is just broken. I assume, 4.1.1 must have introduced some new
> trap I fell into.
> 

As I said before, I have had problems with static glibc and libgcj.

Off the top of my head (and thus probably totally off base), I think the 
GC is doing something here in its attempts to monitor and interact with 
pthreads.

David Daney



More information about the Java mailing list