For our project CMake ends up creating a command like:
/usr/bin/c++ -Wall -Wextra -Wno-missing-field-initializers -Werror -Wno-unused-parameter -pipe -fPIC -mtune=core2 -mfpmath=sse -g -O0 -lXxf86vm CMakeFiles/BulkDataEditor.dir/BulkDataEditor.cpp.o CMakeFiles/BulkDataEditor.dir/BulkDataEditorMain.cpp.o CMakeFiles/BulkDataEditor.dir/BulkDataEditorRegistration.cpp.o CMakeFiles/BulkDataEditor.dir/DiscreteValueManager.cpp.o CMakeFiles/BulkDataEditor.dir/moc_BulkDataEditor.cxx.o -o ../../../bin/BulkDataEditor -Wl,--start-group -rdynamic -L/mnt/data/Projects/WeatherscapeXT/trunk/Build/ThirdParty/lib -lz
<bunch of third party libraries>
-Wl,--end-group
This built fine in 11.04 but under 11.10 it fails with:
undefined reference to symbol 'inflateInit2_'
/usr/bin/ld: note: 'inflateInit2_' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libz.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libz.so: could not read symbols: Invalid operation
During cmake build step I can see zlib has been found successfully using cmake 2.8.5
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.3.4")
Removing the -lz from the build line I get a bunch of errors showing that zlib isn't referenced (as I would expect). So what is special about inflateInit2_?
../../Components/Zip/liblibZip.a(ZipArchive.cpp.o): In function `WeatherscapeXT::ZipArchive::open()':
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:53: undefined reference to `unzOpen'
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:61: undefined reference to `zipOpen'
../../Components/Zip/liblibZip.a(ZipArchive.cpp.o): In function `WeatherscapeXT::ZipArchive::close()':
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:79: undefined reference to `unzCloseCurrentFile'
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:84: undefined reference to `zipClose'
../../Components/Zip/liblibZip.a(ZipArchive.cpp.o): In function `WeatherscapeXT::ZipArchive::listFiles()':
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:93: undefined reference to `unzGetGlobalInfo'
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:101: undefined reference to `unzGoToFirstFile'
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:108: undefined reference to `unzGetCurrentFileInfo'
/mnt/data/Projects/WeatherscapeXT/trunk/Source/Components/Zip/ZipArchive.cpp:125: undefined reference to `unzGoToNextFile'
Thanks