This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: compiling with shared libraries
Per Bothner writes:
> Andrew Haley wrote:
> > I think I may know what causes this. Please try one experiment:
> > compile everything PIC, including the executable.
>
> That worked. Thanks! The key is that the jvgenmain-generated .o file
> also needs to be compiled with -fPIC. Would it make sense to make -fPIC
> the default when compiling that .o file?
Probably. The cause of the problem is that only PIC code may be
linked against libraries linked with -Bsymbolic, but -Bsymbolic is
required for correct resolution of Java name spaces. It's a weird
one, for sure.
I guess, at least, we need a FAQ for this.
> I then had to figure out how to coax automake+libtool to add the -fPIC.
> My quick-and-dirty fix:
> AC_DISABLE_STATIC (in configure.in)
> AM_CFLAGS = -fPIC
>
> And add $(AM_CLFAGS) to the command to link the executable.
Andrew.