[bug] transient linkage with pure cmake_find_package
See original GitHub issueAs seen in this slack: https://cpplang.slack.com/archives/C41CWV9HA/p1631005375278900
According to the docs it is recommended to ... not need to specify or include anything related with Conan at all; just rely on the find_package feature ...
. This seems to be not true, as it seems that conan_basic_setup()
is still somehow required to get 100% of conans functionality, especially if multiple, chained shared libraries are involved (I guess the LD_LIBRARY_PATH is missing).
Environment Details (include every applicable attribute)
- Operating System+version: Ubuntu 18.04
- Compiler+version: gcc7
- Conan version: 1.40+
- Python version: 3.6.9
Steps to reproduce (Include if Applicable)
clone https://github.com/blackliner/conan_transient_linkage run build.sh
@ericLemanissier 's PR fixes it, while loosing CMake purity: https://github.com/blackliner/conan_transient_linkage/pull/1
Logs (Executed commands with output) (Include/Attach if Applicable)
...
[ 75%] Building CXX object tests/CMakeFiles/lib_a_test.dir/lib_a_test.cpp.o
[100%] Linking CXX executable lib_a_test
/usr/bin/ld: warning: liblib_c.so, needed by //home/fberchtold/.conan/data/lib_b/1.0.0/_/_/package/436fa0a6d3ec3ce29639456d6db8d06cd9bf62c9/lib/liblib_b.so, not found (try using -rpath or -rpath-link)
//home/fberchtold/.conan/data/lib_b/1.0.0/_/_/package/436fa0a6d3ec3ce29639456d6db8d06cd9bf62c9/lib/liblib_b.so: undefined reference to `lum::lib_c::SayHello[abi:cxx11]()'
collect2: error: ld returned 1 exit status
tests/CMakeFiles/lib_a_test.dir/build.make:98: recipe for target 'tests/lib_a_test' failed
make[2]: *** [tests/lib_a_test] Error 1
CMakeFiles/Makefile2:881: recipe for target 'tests/CMakeFiles/lib_a_test.dir/all' failed
make[1]: *** [tests/CMakeFiles/lib_a_test.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
lib_a/1.0.0:
lib_a/1.0.0: ERROR: Package '4c3f20be28cf1be70e428d9fc0e689236ff00f59' build failed
lib_a/1.0.0: WARN: Build folder /home/fberchtold/.conan/data/lib_a/1.0.0/_/_/build/4c3f20be28cf1be70e428d9fc0e689236ff00f59
ERROR: lib_a/1.0.0: Error in build() method, line 52
cmake.build()
ConanException: Error 2 while executing cmake --build '/home/fberchtold/.conan/data/lib_a/1.0.0/_/_/build/4c3f20be28cf1be70e428d9fc0e689236ff00f59' '--' '-j24'
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
CMake FIND_PACKAGE succeeds but returns wrong path
This problem occurs when using some older versions of boost with cmake-2.8.6-rc2 or later, where the boost package finding code was changed.
Read more >find_package — CMake 3.25.1 Documentation
The REQUIRED option stops processing with an error message if the package ... In pure Config mode, the command skips Module mode search...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nice, thanks, I think thats it for today 😃
There are linkers that will skip a library if it doesn’t match its expected architecture, looking like it didn’t found a library that is there, you can find in the filesystem, but it keeps telling you library not found. I have verified this a couple of times, cannot be sure if it is the current issue, but worth at least considering.