This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
AIX 5.3 GCC 4.2.1 libstdc++ Linker Problems
- From: ericbambach1 at discover dot com
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 10 Sep 2007 16:57:54 -0500
- Subject: AIX 5.3 GCC 4.2.1 libstdc++ Linker Problems
Hello,
Please CC as I'm not subscribed. Hope line breaks are ok, I hate
Lotus Notes :)
I'm having a lot of trouble getting gcc 4.2.1 compiled and run on
AIX 5.3 on the power5 architecture. Even after GCC compiles successfully
it seems libstdc++.a isn't built correctly.
We have the IBM binary gcc-4.0.0 compiler installed in
/opt/freeware/bin so I know its possible to get GCC on here somehow.
It builds fine but compilation of this simple test program fails
with g++. gcc SEEMS to function ok but I havent checked it in depth yet.
Take a look at the session below (edited for readability + mask
user+hostname only) where it first fails to find libgcc_s even though the
configure script placed it in /sys/usr/lib just like I asked, Next it cant
link against libstdc++.a. Once I turn on the verbose output I see that
libstdc++.a has no symbols being imported! I dont know much about
compilers but it seems that I need SOME symbols from libstdc++ are needed.
Last, if I force it to link against IBM's libstdc++.a it works fine.
Am I building gcc wrong? I did build it with GNU make and the AIX
as+ld. I borrowed IBM's config flags from 4.0.0. Any additional info
needed?
============================================================
user@host:~/tmp/gcc$ cat hello.c
#include <cstdio>
int main(int argc, char *argv[]) {
printf("Hello, world!\n");
return(0);
}
============================================================
user@host:~/tmp/gcc$ g++ -o hello hello.c
ld: 0706-006 Cannot find or open library file: -l gcc_s
ld:open(): No such file or directory
ld: 0706-006 Cannot find or open library file: -l gcc_s
ld:open(): No such file or directory
collect2: ld returned 255 exit status
============================================================
user@host:~/tmp/gcc$ g++ -o hello hello.c -L/sys/usr/lib
ld: 0711-317 ERROR: Undefined symbol: __gxx_personality_v0
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
collect2: ld returned 8 exit status
user@host:~/tmp/gcc$ g++ -v -o hello hello.c -L/sys/usr/lib -Wl,-bnoquiet
Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: ../gcc-4.2.1/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/sys/usr/local --bindir=/sys/usr --enable-threads
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0 :
(reconfigured) ../gcc-4.2.1/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/sys/usr/local --with-slibdir=/sys/usr/lib --enable-threads
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0
Thread model: aix
gcc version 4.2.1
/sys/usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/cc1plus -quiet -v
-D_ALL_SOURCE hello.c -quiet -dumpbase hello.c -auxbase hello -version -o
/tmp//cc74R87c.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../../../powerpc-ibm-aix5.3.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++/powerpc-ibm-aix5.3.0.0
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++/backward
/sys/usr/local/include
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include
/usr/include
End of search list.
GNU C++ version 4.2.1 (powerpc-ibm-aix5.3.0.0)
compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=32768
Compiler executable checksum: 78fbba47446a0a80c5f794efa527285e
/usr/bin/as -u -mppc -o /tmp//cc05Pxwk.o /tmp//cc74R87c.s
/sys/usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/collect2
-bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -o hello /lib/crt0.o
-L/sys/usr/lib -L/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1
-L/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../..
/tmp//cc05Pxwk.o -bnoquiet -lstdc++ -lm -lgcc_s
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a -lc -lgcc_s
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a
(ld): halt 4
(ld): setopt r/o->w
(ld): setopt nodelcsect
(ld): setfflag 4
(ld): savename hello
(ld): filelist 8 1
(ld): i /lib/crt0.o
(ld): i /tmp//ccGrhJzA.o
(ld): i /tmp//cc05Pxwk.o
(ld): lib /sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libstdc++.a
(ld): lib /usr/lib/libm.a
(ld): lib /sys/usr/lib/libgcc_s.a
(ld): i /sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libstdc++.a[libstdc++.so.6]: 0 symbols imported.
LIBRARY: Shared object libgcc_s.a[shr.o]: 120 symbols imported.
LIBRARY: Shared object libc.a[shr.o]: 2820 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[posix_aio.o]: 20 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 14 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 5 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 8
(ld): initfini _GLOBAL__FI_hello _GLOBAL__FD_hello
(ld): resolve
RESOLVE: 70 of 4514 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 11 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
Symbol Inpndx TY CL Source-File(Object-File) OR
Import-File{Shared-object}
RLD: Address Section Rld-type Referencing
Symbol
----------------------------------------------------------------------------------------------
__gxx_personality_v0 [6] ER PR hello.c(/tmp//cc05Pxwk.o)
00000111 .data R_POS [24]
_GLOBAL__F_main_8A711DF0
ER: The return code is 8.
ld: 0711-317 ERROR: Undefined symbol: __gxx_personality_v0
collect2: ld returned 8 exit status
============================================================
user@host:~/tmp/gcc$ g++ -v -o hello hello.c -L/sys/usr/lib -Wl,-bnoquiet
-L/opt/freeware/lib//gcc/powerpc-ibm-aix5.3.0.0/4>
Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: ../gcc-4.2.1/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/sys/usr/local --bindir=/sys/usr --enable-threads
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0 :
(reconfigured) ../gcc-4.2.1/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/sys/usr/local --with-slibdir=/sys/usr/lib --enable-threads
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.3.0.0
Thread model: aix
gcc version 4.2.1
/sys/usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/cc1plus -quiet -v
-D_ALL_SOURCE hello.c -quiet -dumpbase hello.c -auxbase hello -version -o
/tmp//ccAbwnda.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../../../powerpc-ibm-aix5.3.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++/powerpc-ibm-aix5.3.0.0
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include/c++/backward
/sys/usr/local/include
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/include
/usr/include
End of search list.
GNU C++ version 4.2.1 (powerpc-ibm-aix5.3.0.0)
compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=32768
Compiler executable checksum: 78fbba47446a0a80c5f794efa527285e
/usr/bin/as -u -mppc -o /tmp//ccYZ9iZe.o /tmp//ccAbwnda.s
/sys/usr/local/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/collect2
-bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -o hello /lib/crt0.o
-L/sys/usr/lib -L/opt/freeware/lib//gcc/powerpc-ibm-aix5.3.0.0/4.0.0/
-L/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1
-L/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../..
/tmp//ccYZ9iZe.o -bnoquiet -lstdc++ -lm -lgcc_s
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a -lc -lgcc_s
/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a
(ld): halt 4
(ld): setopt r/o->w
(ld): setopt nodelcsect
(ld): setfflag 4
(ld): savename hello
(ld): filelist 8 1
(ld): i /lib/crt0.o
(ld): i /tmp//cc2v4Err.o
(ld): i /tmp//ccYZ9iZe.o
(ld): lib /opt/freeware/lib//gcc/powerpc-ibm-aix5.3.0.0/4.0.0//libstdc++.a
(ld): lib /usr/lib/libm.a
(ld): lib /sys/usr/lib/libgcc_s.a
(ld): i /sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/libgcc.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libstdc++.a[libstdc++.so.6]: 1161 symbols imported.
LIBRARY: Shared object libgcc_s.a[shr.o]: 120 symbols imported.
LIBRARY: Shared object libc.a[shr.o]: 2820 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[posix_aio.o]: 20 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 14 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 5 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 8
(ld): initfini _GLOBAL__FI_hello _GLOBAL__FD_hello
(ld): resolve
RESOLVE: 71 of 5675 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 11 symbols.
(ld): er full
ER: There are no unresolved symbols.
(ld): mismatch
MISMATCH: No type mismatches exist.
(ld): comprld
COMPRLD: Kept 113 of 113 relocation entries.
(ld): origin page 0x10000000 0x20000000
(ld): libpath
/sys/usr/lib:/opt/freeware/lib//gcc/powerpc-ibm-aix5.3.0.0/4.0.0/:/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1:/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../..:/usr/lib:/lib
LIBPATH: Library path set to
/sys/usr/lib:/opt/freeware/lib//gcc/powerpc-ibm-aix5.3.0.0/4.0.0/:/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1:/sys/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.1/../../..:/usr/lib:/lib
(ld): save 1L .
SAVE: Section sizes = 8094+934+32 (0x1F9E+0x3A6+0x20 hex)
SAVE: Size of TOC: 140 (0x8C hex)
SAVE: No .loader section relocation entries exist for the .text section.
(ld): rc
RC: Highest return code was 0.
============================================================
user@host:~/tmp/gcc$ ./hello
Hello, world!