This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Still failing to bootstrap on Solaris (CONFIG_SHELL doesn't help)


Richard Henderson writes:

> > ld: fatal: file /sw/test/gcc/SunOS/lib/gcc-lib/sparc-sun-solaris2.8/3.0/../../../libgcj.so: recording name `libgcj.so.2' matches that provided by file ./.libs/libgcj.so
> 
> But what prompted it to go looking in /sw/test/ in the first place?
> The -L option should have directed the search for -lgcj to ./.libs/.

jv-convert is build like this (OBJ is the build dir, PFX $prefix, ARCH is
sparc-sun-solaris2.8):

/bin/ksh ./libtool --tag=GCJ --mode=link /OBJ/gcc/gcj
-B/OBJ/ARCH/libjava/ -B/OBJ/gcc/ -L/OBJ/ARCH/libjava
-g -O2  -o jv-convert --main=gnu.gcj.convert.Convert
-rpath /PFX/lib -shared-libgcc
libgcj.la -L/OBJ/ARCH/libjava/.libs 

libtool expands this to

/OBJ/gcc/gcj -B/OBJ/ARCH/libjava/ -B/OBJ/gcc/
-g -O2 -o .libs/jv-convert --main=gnu.gcj.convert.Convert -shared-libgcc
-L/OBJ/ARCH/libjava ./.libs/libgcj.so
-L/OBJ/ARCH/libstdc++-v3/src -L/OBJ/ARCH/libstdc++-v3/src/.libs
-lpthread -lrt -ldl
-L/OBJ/gcc -L/PFX/lib/gcc-lib/ARCH/3.1 -L/usr/ccs/bin -L/usr/ccs/lib
-L/PFX/lib/gcc-lib/ARCH/3.1/../../..
-lgcc_s -lgcc_s
-L/OBJ/ARCH/libjava/.libs
-Wl,-R -Wl,/PFX/lib

All those additional -L switches stem from libgcj.la, but haven't been
passed explicitly when building libgcj.la.  Instead I've found

compiler_lib_search_path="
-L/OBJ/ARCH/libstdc++-v3/src -L/OBJ/ARCH/libstdc++-v3/src/.libs
-L/OBJ/gcc -L/PFX/lib/gcc-lib/ARCH/3.1 -L/usr/ccs/bin -L/usr/ccs/lib
-L/PFX/lib/gcc-lib/ARCH/3.1/../../.."

in the libtool built/used to create libgcj.la.

The problem obviously is that -L/OBJ/ARCH/libjava/.libs is placed *after*
libgcj.la, so the different copy in /PFX/lib is found first instead.  This
happens in libjava/Makefile.am:

## We explicitly link in the libraries we need.  This way we don't
## need -nodefaultlibs, so we can still rely on gcj picking up the
## system libraries we need (via the specs file).
## We need the -L so that gcj can find libgcj with `-lgcj'.
## FIXME: should be _libs on some systems.
jv_convert_LDADD = libgcj.la -L$(here)/.libs

Changing the order here (and in a couple of other places) should fix
things.  The -L is clearly necessary here for gcj's implicit -lgcj to
work.  All this doesn't seem to be an issue for libstdc++ since, unlike
libgcj, no executables are built during a bootstrap.

	Rainer


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