This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcj problem with -static option


FERANDELLE Pascal writes:
 > > I'd like to get the zoo of options available to gcj users reduced to
 > > the set that we think may have some chance of working.  Certainly,
 > > being able to suggest "don't use -static, use -static-libgcj" is an
 > > improvement over what we had before.
 > >
 > > Pascal, let us know if this solves your problem.
 > >
 > > Andrew.
 > 
 > I can't try in GCJ 4.2, but in 4.1, I try different options to compile and link regarding the wiki.
 > There is no static version of libgcc_s, so I have to keep it dynamic.
 > 
 > When I compile with :
 > 
 > gcc -o HelloWorld HelloWorld.o HelloWorldmain.i -shared-libgcc -Wl,-non_shared -lgcj -lz -lm -ldl -Wl,-call_shared -lgcc_s -lpthread -lc
 > it'ok when running HelloWorld;

Sounds good.

 > If I compile with :
 > 
 > gcc -o HelloWorld HelloWorld.o HelloWorldmain.i -shared-libgcc -Wl,-non_shared -lgcj -lz -lpthread -lc -lm -ldl -Wl,-call_shared -lgcc_s
 > I have a segmentation fault due to the pthread_create call, in boehm-gc/pthread_support.c;

As expected, becasue libpthread needs to be dynamically linked.

 > And if I try :
 > 
 > gcc -o HelloWorld HelloWorld.o HelloWorldmain.i -shared-libgcc -Wl,-non_shared -lgcj -lz -lc -lm -ldl -Wl,-call_shared -lgcc_s -lpthread
 > I have :
 > ./HelloWorld: relocation error: ./HelloWorld: symbol __pthread_initialize, version GLIBC_PRIVATE not defined in file libpthread.so.0 with link time reference

Uh, OK.  Don't statically link against libc.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]