[Insight-users] Debian/Linux linking
Neil Killeen
Neil.Killeen@atnf.csiro.au
Tue, 4 Feb 2003 13:42:00 +1100 (EST)
Hi
I have been attempting to build ITK on a Debian Linux system.
I get a linker error (below) when building the Testing directory. It is
related to streams. This is a libstdc++ linking issue. In our system
we have gone to a lot of trouble because different versions of gcc require
different versions of libstdc++. Here are some notes
from our system on handling this issue:
% more /usr/local/gnu/lib/libstdc++.README
"g++ 2.95.3 requires libstdc++.so.2.10.0, but
g++ 3.1.1 requires libstdc++.so.4.0.1.
Do not create symlinks for libstdc++.so or libstdc++.a in this directory
(/usr/local/gnu/lib) because apparently the GNU compilers look here for
libstdc++.{a,so} before the version-specific directory,
/usr/local/gnu/lib/gcc-lib/<platform>/<version>/.
Hence, symlinks have been created in the version-specific directories
so that each version of g++ finds the correct version of
libstdc++.{a,so}."
Now, I have checked via the g++ verbose switch, that the correct version
of libstdc++ is being picked up. What seems to be happening is that
some symbols have preprended underscores on them, and these do not
exist in the libstdc++
The actual linker error (one example) is
g++-3.1.1 -rdynamic -Wno-deprecated -ftemplate-depth-50 itkIOTests.o
itkConvertBufferTest.o itkDicomImageIOTest.o itkMetaImageIOTest.o
itkPNGImageIOTest.o itkVOLImageIOTest.o itkVTKImageIOTest.o
itkRawImageIOTest.o itkRawImageIOTest2.o itkRawImageIOTest3.o
itkRawImageIOTest4.o -L/nfs/mid/NKILLEEN/itk/binary/linux/bin -lpthread
-ldl -lVXLNumerics -lm -lITKIO -litkpng -litkzlib -lITKMetaIO -lITKCommon
-lVXLNumerics -lm -lpthread -ldl
-Wl,-rpath,/nfs/mid/NKILLEEN/itk/binary/linux/bin -o
/nfs/mid/NKILLEEN/itk/binary/linux/bin/itkIOTests
/nfs/mid/NKILLEEN/itk/binary/linux/bin/libITKIO.a(itkDicomImageIO.o): In function `itk::DicomImageIO::CheckTagTable(std::basic_ifstream<char,
std::char_traits<char> >&, std::list<Bal, std::allocator<Bal> >&) const':
itkDicomImageIO.o(.text+0x5e6): undefined reference to `std::basic_istream<char, std::char_traints<char>
>::seekg(std::fpos<__mbstate_t>)'
Now of these symbols, look at the last line
`std::basic_istream<char, std::char_traints<char> >::seekg(std::fpos<__mbstate_t>)'
you see the __mbstate_t variable in the call to seekg.
Now, in our libstdc++ library we see
% nm libstdc++.so.4.0.1 | c++filt | more
00049d20 W std::basic_istream<char, std::char_traints<char> >::seekg(std::fpos<mbstate_t>)
you can see that there are no leading underscores... I think this is the
problem but don't know how to resolve it.
Any thoughts on why this naming mismatch is occuring ?
thanks
Neil