Originally posted by: SystemAdmin
I tried the IBM site's RPM package of gcc-4.0.0 and the latest gcc-4.1.1 from ftp.gnu.org with the same issues. C programs compile and run fine but C++ programs compiled with the current release of libstdc++ built from the gcc RPMS and/or the gnu package fail at the link stage when compiling LIBTFF-3.8.2 or GMP.
Here is the final section of the build log:
Making all in port
make[1]: Entering directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/port'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/port'
Making all in libtiff
make[1]: Entering directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/libtiff'
/opt/freeware/bin/make all-am
make[2]: Entering directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/libtiff'
/bin/sh ../libtool --mode=link /opt/freeware/bin/g++ -g -O2 -o libtiffxx.la -rpath /opt/freeware/lib -no-undefined -version-number 3:8:2 tif_stream.lo ../libtiff/libtiff.la ../port/libport.la -ljpeg -lz -lm -lc
libtool: link: rm -fr .libs/libtiffxx.exp
libtool: link: generating symbol list for `libtiffxx.la'
libtool: link: /bin/nm -BCpg .libs/tif_stream.o ../port/.libs/libport.a | awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B")) && (substr($ 3,1,1) != ".")) { print $ 3 } }' | sort -u > .libs/libtiffxx.exp
libtool: link: /opt/freeware/bin/g++ -shared -o .libs/libtiffxx.so.3 .libs/tif_stream.o ../port/.libs/libport.a -Wl,-blibpath:/usr/src/packages/BUILD/tiff-3.8.2/libtiff/.libs:/opt/freeware/lib:/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1:/usr/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1:/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/../../..:/usr/lib:/lib -L../libtiff/.libs -ltiff -ljpeg -lz -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1 -L/usr/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1 -L/opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.1.1/../../.. -lstdc++ -lm -lc -lgcc_s -Wl,-bnoentry -Wl,-bE:.libs/libtiffxx.exp -Wl,-bernotok
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::tellp()
ld: 0711-317 ERROR: Undefined symbol: .std::basic_istream<char, std::char_traits<char> >::tellg()
ld: 0711-317 ERROR: Undefined symbol: .std::basic_istream<char, std::char_traits<char> >::read(char*, long)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::write(char const*, long)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::seekp(long long, std::_Ios_Seekdir)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::seekp(std::fpos<char*>)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_istream<char, std::char_traits<char> >::seekg(long long, std::_Ios_Seekdir)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_istream<char, std::char_traits<char> >::seekg(std::fpos<char*>)
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)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::put(char)
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
make[2]: ***
http://libtiffxx.la Error 1
make[2]: Leaving directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/libtiff'
make[1]: ***
all Error 2
make[1]: Leaving directory `/opt/freeware/src/packages/BUILD/tiff-3.8.2/libtiff'
make: ***
all-recursive Error 1
I am using the most current releases of the supporting toolsets, which successfully built with gcc 4.1.1.1 after a bit of tweaking:
autoconf-2.59-5
automake-1.9.5-1
libtool-1.5.22.multilib2-3
m4-1.4.8-1
This is the configure command that I used with libtiff-3.8.2:
./configure --prefix=/opt/freeware --disable-largefile --enable-static --enable-shared --with-cc=/opt/freeware/bin/gcc --with-cxx=/opt/freeware/bin/g++ --with-ld=/bin/ld --with-ranlib=/bin/ranlib --with-make=/opt/freeware/bin/make --with-ar=/bin/ar --with-as=/bin/as --with-nm=/opt/freeware/bin/nm
Having successfully built LIBTIFF-3.7.2 on AIX 5.0 using the then current gcc-2.95 RPMS for AIX, I learned that you must:
1) Disable largefile as the macros used to define fseek for large files get undefined. Since AIX supports largefiles anyway, there is actually no loss
of functionality
2) use the AIX linker /bin/ld instead of the GNU linker at least for past versions of gnu ld
3) only a current version of GNU nm seems to be able to properly handle the weak symbols in libstdc++ correctly. Using the -C flag to demangle the symbols shows that only the wchar_t versions of the symbols are present, the regular <char> char_traits types are missing. Running the same command on the version of libstdc++.so reveals the missing symbols ARE present there and of course LIBTIFF builds correctly in that environment.
/opt/freeware/bin/nm -C libstdc++.a | grep seekg
0000000010076730 t .std::istream::seekg(std::fpos<char*>)
0000000010076730 W .std::istream::seekg(std::fpos<char*>)
00000000100765d0 W .std::istream::seekg(long long, std::_Ios_Seekdir)
00000000100765d0 t .std::istream::seekg(long long, std::_Ios_Seekdir)
0000000010076b9c t .std::basic_istream<wchar_t, std::char_traits<wchar_t> >::seekg(std::fpos<char*>)
0000000010076b9c W .std::basic_istream<wchar_t, std::char_traits<wchar_t> >::seekg(std::fpos<char*>)
0000000010076a18 W .std::basic_istream<wchar_t, std::char_traits<wchar_t> >::seekg(long long, std::_Ios_Seekdir)
0000000010076a18 t .std::basic_istream<wchar_t, std::char_traits<wchar_t> >::seekg(long long, std::_Ios_Seekdir)
I've posted to LIBTIFF's bugzilla, but this is not really a LIBTIFF issue. It also occurs with GMP on AIX. I think that it has to do with the LIBTOOL build mechanism's code to export symbols or the LIBCXXFLAGS="-O2 -fno-implicit-templates" flag in the IBM gcc-4.0.0.0 spec file. I've built with and without this flag with the same result. Since the symbols don't show up in libstdc++ on AIX, I'd have to blame the gcc build mechanism, but I can't track it down.
#AIX-Forum