[cmake-developers] Apple tests for target_link_libraries failing

Rolf Eike Beer eike at sf-mail.de
Thu Oct 13 12:34:21 EDT 2011


Am Donnerstag, 13. Oktober 2011, 18:00:23 schrieb Rolf Eike Beer:
> > Rolf Eike Beer wrote:
> >>> 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'
> >> 
> >> Maybe this is just the default setting for your binutils. Try
> >> LDFLAGS=-Wl,--copy-dt-needed-entries,-no-as-needed and see what
> >> happens.
> >> I
> >> bet this will change the behavior on your system.
> > 
> > ld now gives a new error:
> > 
> > /usr/bin/ld: error: --copy-dt-needed-entries is not supported but is
> > required for liblibA.so in lib/liblibC.so
> > 
> > Here's a more complete fragment:
> > 
> > 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++      -Wl,--copy-dt-needed-entries,-no-as-needed
> > 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
> > /usr/bin/ld: error: --copy-dt-needed-entries is not supported but is
> > required for liblibA.so in lib/liblibC.so
> > CMakeFiles/exec.dir/main.cpp.o:main.cpp:function main: error: undefined
> > reference to 'classB::classB()'
> > collect2: ld returned 1 exit status
> > 
> > I also ran ctest -V -R target_link_librares with those flags and many
> > more tests failed.
> > 
> > I have no idea what those flags do, so I don't know if that new error is
> > a lead.
> 
> This may be new in my binutils version. Can you just try
> LDFLAGS=-Wl,-no-as-needed?

And since you don't run the newest binutils version: what about building them 
and installing in some local directory, then putting them first in path and 
running those tests (with and without the flags) again? Does everything still 
work as expected?

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111013/59868c76/attachment.sig>


More information about the cmake-developers mailing list