[cmake-developers] Apple tests for target_link_libraries failing

Stephen Kelly steveire at gmail.com
Thu Oct 13 11:35:31 EDT 2011


Rolf Eike Beer wrote:

>>> Stephen Kelly wrote:
>>>
>>>> The tests can be enabled on APPLE again later, I've flipped the if
>>>> condition so we can see why it fails on some non-APPLE platforms too.
>>>>
>>>
>>> This is even more interesting now.
>>>
>>> http://www.cdash.org/CDash/testDetails.php?test=118872016&build=1620094
>>>
>>> On gentoo, the build of the exec executable succeeds, even though it
>>> only
>>> links to libC, and that only links to libA, even though it uses classB
>>> from
>>> libB (which is not linked to).
>>
>> libB is in the needed section (see below). The only special thing that I
>> can think of is the -Wl,--unique=.text.* flag I put into C_FLAGS, as
>> CMake itself would otherwise not link because of a binutils breakage. No
>> idea if that is related.
> 
> Ok, it is not related. I rebuild only that testcase without that flag and
> it did not change anything.
> 
> But I noticed another thing. In the dashboard above 2 tests are failing:
> 19 and 20. I think the test #20 is actually wrong, as it seems to depend
> on linker flags that may just be activated by default on the machines you
> use. If I manually specify
> LDFLAGS=-Wl,--no-copy-dt-needed-entries,--as-needed when I call CMake for
> the first time #20 succeeds for me. So it looks like this is just
> "accidentially" working, but in fact you may need to pass these flags
> yourself to make sure they are always there.
> 

You mean everyone needs to specify them if they use 

LINK_INTERFACE_LIBRARIES ""

anywhere, right? 

If that's true then setting that variable to empty should maybe add those 
flags automatically.

I'm not certain that's correct though. Those flags don't seem to be used 
when I build. I also don't know what those flags do.

Linking CXX executable exec
/home/stephen/dev/qt48/kde/bin/cmake -E cmake_link_script 
CMakeFiles/exec.dir/link.txt --verbose=1                                         
/usr/lib/icecc/bin/c++       CMakeFiles/exec.dir/main.cpp.o  -o exec -
rdynamic lib/liblibC.so -Wl,-rpath,/home/stephen/cmaketest/test19/build/lib 
-Wl,-rpath-link,/home/stephen/cmaketest/test19/build/lib 
CMakeFiles/exec.dir/main.cpp.o:main.cpp:function main: error: undefined 
reference to 'classB::classB()'
collect2: ld returned 1 exit status
make[2]: *** [exec] Error 1
make[2]: Leaving directory `/home/stephen/cmaketest/test19/build'

Thanks,

Steve.





More information about the cmake-developers mailing list