Linking problems with gcc 4.2.2 and AIX 5.2

Thomas Mittelstaedt T.Mittelstaedt@cadenas.de
Mon Jan 28 22:38:00 GMT 2008


Have you tried to build with the system assembler and system linker? I 
recently built gcc 4.2.2 on aix 5.2 successfully with the following
configuration:


export CONFIG_SHELL=/usr/local/bin/bash ## So configure scripts don't 
run so slowly
$ gcc -v
Using built-in specs.
Target: powerpc-ibm-aix5.2.0.0
Configured with: ../gcc-4.2.2/configure 
--enable-version-specific-runtime-libs --enable-static --enable-shared 
--enable-threads --with-as=/usr/bin/as --without-gnu-ld 
--with-ld=/usr/bin/ld --prefix=/opt/gcc-4.2.2 --disable-nls --with-pic 
--disable-symvers --enable-symvers=no --enable-languages=c,c++,objc
Thread model: aix
gcc version 4.2.2

make CFLAGS='-O' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2 
-fno-implicit-templates' bootstrap

Jonathan Saxton schrieb:
> A newbie gcc builder here.
>
> I’ve found reports of similar problems from a year or so back but no real
> resolution so I have to ask again.
>
> Recently I used gcc 4.0.0 to compile gcc 4.2.2 on AIX 5.2.  Compiler seems
> to work fine until I go to link something, then I get some fairly basic STL
> things unresolved.  My test program is taken from the introductory chapters
> of C++ Template Metaprogramming by Abrahams & Gurtovoy.
>
> #include <iostream>
>
> template <unsigned long N>
> struct binary
> {
>     static unsigned const long value =
>         binary<N/10>::value * 2 + N%10;
> };
>
> template <>
> struct binary<0>
> {
>     static unsigned const long value = 0L;
> };
>
> int main()
> {
>     std::cout
>        << "The answer to the question of Life, the Universe and Everything
> is "
>        << binary<101010>::value
>        << std::endl;
> }
>
> The command “g++ -o demo422 demo422.cpp” yields six link errors:
>
> $ g++ -o demo422 demo422.cpp
> ld: 0711-317 ERROR: Undefined symbol: .std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >::size() const
> ld: 0711-317 ERROR: Undefined symbol: .std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >::operator[](unsigned long)
> const
> ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char,
> std::char_traits<char> >& std::operator<< <std::char_traits<char>
>   
>> (std::basic_ostream<char, std::char_traits<char> >&, char const*)
>>     
> ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char,
> std::char_traits<char> >::operator<<(unsigned long)
> ld: 0711-317 ERROR: Undefined symbol: std::basic_ostream<char,
> std::char_traits<char> >& std::endl<char, std::char_traits<char>
>   
>> (std::basic_ostream<char, std::char_traits<char> >&)
>>     
> ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char,
> std::char_traits<char> >::operator<<(std::basic_ostream<char,
> std::char_traits<char> >& (*)(std::basic_ostream<char,
> std::char_traits<char> >&))
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> information.
> collect2: ld returned 8 exit status
>
> Adding –Wl,-bnoquiet doesn’t really give anything that seems particularly
> helpful (well, to me, anyway) but using the –v flag suggests that the
> correct libstdc++.a is being found and also shows the (rather minimal) way I
> configured gcc 4.2.2 when I built it.
>
> $ g++ -v -o demo422 demo422.cpp
> Using built-in specs.
> Target: powerpc-ibm-aix5.2.0.0
> Configured with: /home.local/jsaxton/gcc-4.2.2/configure
> --prefix=/opt/freeware : (reconfigured)
> /home.local/jsaxton/gcc-4.2.2/configure --prefix=/opt/freeware
> --enable-languages=c,c++
> Thread model: aix
> gcc version 4.2.2
>  /opt/freeware/libexec/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/cc1plus -quiet -v
> -D_ALL_SOURCE demo422.cpp -quiet -dumpbase demo422.cpp -auxbase demo422
> -version -o /tmp//ccPpunCt.s
> ignoring nonexistent directory
> "/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/../../../../powerpc-ibm-
> aix5.2.0.0/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/../../../../include/c++/
> 4.2.2
>  /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/../../../../include/c++/
> 4.2.2/powerpc-ibm-aix5.2.0.0
>  /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/../../../../include/c++/
> 4.2.2/backward
>  /usr/local/include
>  /opt/freeware/include
>  /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/include
>  /usr/include
> End of search list.
> GNU C++ version 4.2.2 (powerpc-ibm-aix5.2.0.0)
>         compiled by GNU C version 4.2.2.
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=32768
> Compiler executable checksum: 757566dd4c47f91799c975df3ba00055
>  as -u -mppc -o /tmp//ccRMMUUA.o /tmp//ccPpunCt.s
>  /opt/freeware/libexec/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/collect2
> -bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -o demo422 /lib/crt0.o
> -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2
> -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/../../..
> /tmp//ccRMMUUA.o -lstdc++ -lm -lgcc_s
> /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/libgcc.a -lc -lgcc_s
> /opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/libgcc.a
>
> (At this point the error messages shown earlier are displayed so I didn’t
> bother to include them again.)
>
> If my double-dot counting is correct, the library path devolves to
> /opt/freeware/lib and there are four libstc++.a files thereunder, all
> freshly created by the install.  I cannot see any trace of any library left
> over from 4.0.0.
>
> 2008-01-25 16:15:01 nextferry:/opt/freeware/lib
> $ find . -name libstdc++.a
> ./pthread/ppc64/libstdc++.a
> ./pthread/libstdc++.a
> ./ppc64/libstdc++.a
> ./libstdc++.a
>
> I’m a bit stuck.
>
> If I really need to rebuild gcc with different configuration options then
> with a bit of work I can do that.  Meanwhile “which ld”  yields /usr/lbin/ld
> which is a symlink to the native AIX linker (/usr/ccs/buin/ld).  There is no
> gcc version of ld anywhere.  It is my understanding that this is correct for
> AIX 5.x.
>
> Advice eagerly sought.  I can generate the –bnoquiet output if needed but
> this is already a very long message.
>
>   



More information about the Gcc-help mailing list