[cmake-developers] Apple tests for target_link_libraries failing

Stephen Kelly steveire at gmail.com
Tue Oct 11 11:26:37 EDT 2011


Bill Hoffman wrote:

> On 10/11/2011 2:33 AM, Stephen Kelly wrote:
>>
>> Hi,
>>
>> I'm trying to find out why the target_link_libraries unit tests are
>> failing on some platforms (but not mine...). I'm enabling one platform at
>> a time. I enabled the failing tests for APPLE, so if you want to try it
>> out, you need to comment out the if(APPLE).
>>
> 
> So, the test is still failing on the dashboard now right?  I see it
> failed last night on all the macs, and on the continuous this morning.
>   So, what do we need to comment out?  Are you going to at least
> temporarily fix the dashboard test failures today?  Did you mean to say
> if(NOT APPLE) maybe?


Nope, a few days ago it failed on more than just macs, it also failed on 
some windows and BSD, but I don't know why. Rather than make the whole 
dashboard light up, I only enabled the tests for APPLE first. I guess that 
once we find out why that does not work as expected, the fix will fix all 
other platforms too.

> 
> 
> The test output from these tests are very hard for me to parse:
> 
> http://www.cdash.org/CDash/testDetails.php?test=118663911&build=1614189
> 
> Something is failing but I have no idea what.  Perhaps you could
> annotate the tests a bit more so that it prints out a test name or
> something.
> 
> "Testing link with CLEAR_LINK_INTERFACE_LIBRARIES=TRUE,
> SPECIFY_LINK_INTERFACE_LIBRARIES = TRUE
> test # 2.
> 
> Or maybe even put a name into the expect_fail calls so that when it
> fails you can easily go back to the line in the CMakeLists.txt where the
> expect_fail is called.    Maybe the test should print out the
> CMakeLists.txt file that was generated for it?
> 
> 

I can look into doing these things. Seems like a good idea. 

> 
> 
> So, in this case:
> http://www.cdash.org/CDash/testDetails.php?test=118663911&build=1614189
> 
> What is it you can not see in your output?
> 
> It looks to me that for each of them it is linking everything:
> 
>   /usr/bin/g++-4.2 -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
>   -Wunused
>    -Wpointer-arith -Winvalid-pch -Wcast-align -Wdisabled-optimization
>    -Wnewline-eof -fdiagnostics-show-option -Woverloaded-virtual -Wshadow
>    -Wwrite-strings -g -fstack-protector-all -D_FORTIFY_SOURCE=2 -arch ppc
>    -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-search_paths_first
>    -Wl,-headerpad_max_install_names CMakeFiles/exec.dir/main.cpp.o -o exec
>  
> /Users/builder/kitware/CMake-gcc-dbg-
ppc/Tests/CMakeCommands/target_link_libraries/libs_build_True_True/liblibC.dylib
>  
> /Users/builder/kitware/CMake-gcc-dbg-
ppc/Tests/CMakeCommands/target_link_libraries/libs_build_True_True/liblibA.dylib
>  
> /Users/builder/kitware/CMake-gcc-dbg-
ppc/Tests/CMakeCommands/target_link_libraries/libs_build_True_True/liblibB.dylib
> 
> If that is true, then the issue must be in the generator some how...
> 

It indeed looks like it is linking against everything, but it should not be.

> However, I am not really sure if I am looking at the right link line....
> 

I think you are.

> 
> Bottom line, can you make the test pass again, and what experiment do
> you want someone on a mac to do for you?
> 

I have attached a tarball. For me it fails when linking the executable.


CMakeFiles/exec.dir/main.cpp.o:main.cpp:function main: error: undefined 
reference to 'classB::classB()'


This is the expected result because I have used 


set(CMAKE_LINK_INTERFACE_LIBRARIES "")


It should work on all platforms as far as I know. Commenting out the test 
would make it look like the feature works, though it does not work on APPLE 
and maybe others.

If that builds on APPLE for you, please check why the line in cmTarget.cxx:

  this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);

introduced in commit ac4dd41bcc3818f010fc19e28b2e76e2407d2a09 is not having 
the desired effect on APPLE.

Thanks,

Steve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build_should_fail.tar.gz
Type: application/x-compressed-tar
Size: 1034 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111011/6da113f7/attachment-0002.bin>


More information about the cmake-developers mailing list