This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
3.3.2 collect2 on AIX with .so libraries
- From: Albert Chin <gcc at mlists dot thewrittenword dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 25 Oct 2004 09:08:09 -0500
- Subject: 3.3.2 collect2 on AIX with .so libraries
- Reply-to: gcc at gcc dot gnu dot org
[Initially posted to gcc-help but I didn't receive a response so I'm
trying here]
I tried building libsigc++-2.0.6 (http://libsigc.sourceforge.net/) on
AIX 5.2 with GCC 3.3.2 and 3.4.2. GCC 3.4.2 worked fine. However, with
GCC 3.3.2, I ran into the following problem:
..
/bin/sh ../libtool --mode=link g++ -O2 -mcpu=common
-Wl,-blibpath:/opt/TWWfsw/gcc332r/lib -Wl,-brtl -Wl,-blibpath:/usr/lib
-o test_trackable test_trackable.o ../sigc++/libsigc-2.0.la
g++ -O2 -mcpu=common -Wl,-blibpath:/opt/TWWfsw/gcc332r/lib
-Wl,-brtl -Wl,-blibpath:/usr/lib -o .libs/test_trackable test_trackable.o
-L../sigc++/.libs -lsigc-2.0 -L/opt/TWWfsw/gcc332/lib -lstdc++
-Wl,-blibpath:/opt/TWWfsw/libsigc++20/lib/gcc32:\
/opt/TWWfsw/gcc332/lib:/opt/TWWfsw/gcc332r/lib:/usr/lib
ld: 0711-317 ERROR: Undefined symbol: _GLOBAL__F_signal.ccAo6sTo
ld: 0711-317 ERROR: Undefined symbol: _GLOBAL__F_functors_slot.cccL3Cqq
Because I set LDFLAGS="-Wl,-brtl" during the ./configure state,
libtool will create a static and shared version of the libsigc++
library. The two undefined symbols, _GLOBAL__F_signal.ccAo6sTo and
_GLOBAL__F_functors_slot.cccL3Cqq, come from the static version of the
libsigc++ library, ../sigc++/.libs/libsigc-2.0.a. I thought it odd the
linker would use ../sigc++/.libs/libsigc-2.0.a rather than
../sigc++/.libs/libsigc-2.0.so. However, after adding "-v -Wl,-v" to
the final link command, I found the following:
g++ -v -Wl,-v -O2 -mcpu=common -Wl,-blibpath:/opt/TWWfsw/gcc332r/lib
-Wl,-brtl -Wl,-blibpath:/usr/lib -o .libs/test_trackable test_trackable.o
-L../sigc++/.libs -lsigc-2.0 -L/opt/TWWfsw/gcc332/lib -lstdc++
-Wl,-blibpath:/opt/TWWfsw/libsigc++20/lib/gcc32:\
/opt/TWWfsw/gcc332/lib:/opt/TWWfsw/gcc332r/lib:/usr/lib
...
/opt/TWWfsw/gcc332/bin/g++ -x c -c -o /tmp//ccI74qdc.o -mcpu=common
-fno-exceptions -w /tmp//ccgMXWab.c
...
Looking at the /tmp/ccgMXWab.c file, I see:
extern void *x13 __asm__ ("_GLOBAL__F_signal.ccAo6sTo");
extern void *x19 __asm__ ("_GLOBAL__F_functors_slot.cccL3Cqq");
If I change these two lines to match the corresponding entries in
../sigc++/.libs/libsigc-2.0.so:
extern void *x13 __asm__ ("_GLOBAL__F_signal.ccKvSdiF");
extern void *x19 __asm__ ("_GLOBAL__F_functors_slot.ccHOMFb6");
then the link step that failed above succeeds.
So, is the error because collect2 is not honoring -brtl and reading
../sigc++/.libs/libsigc-2.0.a rather than
../sigc++/.libs/libsigc-2.0.so? If so, what is the solution?
BTW, GCC 3.4.2 doesn't seem to have this problem because it never
generates the _GLOBAL__F_signal or _GLOBAL__F_functors_slot entries.
Also, the "ccKvSdiF" extension to _GLOBAL__F_signal changes at every
compilation so we cannot rely on it as a constant value.
--
albert chin (china@thewrittenword.com)