[CMake] unexpected INSTALL problems

Andreas Naumann Andreas-Naumann at gmx.net
Wed Jun 15 17:07:10 EDT 2011


Am 15.06.2011 22:28, schrieb Andreas Naumann:
> Am 15.06.2011 22:16, schrieb Dominik Szczerba:
>>> I use Debian SID 64bit which is similar to Ubuntu, but not the same :)
>>> The "problem" (if it really is one) is that debian does ship the 
>>> libraries
>>> with another naming, so FindBoost will select the library without 
>>> version
>>> number.
>> That's very interesting. My Boost_LIBRARIES according to cmake are:
>> "optimized;/usr/lib/libboost_thread-mt.so;debug;/usr/lib/libboost_thread-mt.so" 
>>
>> but my stuff gets linked to the ones with versions in the name, proved
>> by ldd:
>>
>>> ldd bin/vtkmyFilteringPython.so | grep boost
>>     libboost_thread.so.1.40.0 =>  /usr/lib/libboost_thread.so.1.40.0
>> (0x00007f51c7a8e000)
>>
>> Very strange.
>>
>>> I looked in the script FindBoost.cmake and saw the problem in the 
>>> lines 717
>>> - 723 (and 728 - 735). Here, the libraries with the version number are
>>> listed before the ones without version number.
>>> Does one always prefer the libraries with version number? Or should the
>>> order changed?
>>> I think the best way is to use both:
>>> If the user wants exactly this version, the find-library command 
>>> should use
>>> ONLY libraries with names, and if not it should look for libraries 
>>> without
>>> the number first.
>>>
>>> What do you think about this idea?
>> I see advantages and disadvantages of both options and I do agree with
>> you that a user should have a choice to pick one.
>>
>> Best regards,
>> Dominik
>>
> This behavior is really strange and I tested it in the last 10 minutes.
> CMake says:
> boost libs: /usr/lib/libboost_system-mt.so
>
> Compiling and linking with verbose reveals the link command:
> /usr/bin/c++      CMakeFiles/test.dir/test.cpp.o  -o test -rdynamic 
> -lboost_system-mt
>
> But a ldd on test gives:
> andreas[515:3]:ldd test
>         linux-vdso.so.1 =>  (0x00007fff2fb4a000)
>         libboost_system.so.1.46.1 => 
> /usr/lib/libboost_system.so.1.46.1 (0x00007f525e8c7000)
>         libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f525e5bd000)
>         libm.so.6 => /lib/libm.so.6 (0x00007f525e33a000)
>         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f525e124000)
>         libc.so.6 => /lib/libc.so.6 (0x00007f525ddc3000)
>         librt.so.1 => /lib/librt.so.1 (0x00007f525dbba000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0x00007f525d99e000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f525eaf5000)
>
> I don't install, only build the executable.
>
> Does anybody have an idea?
>
> Regards,
> Andreas
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
It seems to be a feature of the linker. If the library has the DT_SONAME 
field, the linker will use this field as library to link against instead 
of the filename... I did not find an option to avoid this behavior. Is 
there any? Even the IMPORTED feature of add_library does not help.

Regards
Andreas


More information about the CMake mailing list