Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[boost] Boost.System is linked but does not appear as package dependency #7431

Closed
planetmarshall opened this issue Sep 27, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@planetmarshall
Copy link
Contributor

planetmarshall commented Sep 27, 2021

This appears to have been introduced by #7290

If you link to the Boost System library then a link is created by the executable but it does not appear as a dependency in the json manifest which can lead to runtime failures for downstream tools using the manifest to build a deployable package.

Steps to Reproduce

Build the attached example:

$ tar -xf conan-test.tar.gz
$ mkdir conan-test/build
$ cd conan-test/build
$ conan install ..
$ cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON
$ cmake --build .

Observe that libboost_system.so appears in the list of linked libraries, it can also be checked in the output of ldd

However, it does not appear in the dependency list in the json manifest

$ grep -c boost_system conanbuildinfo.json
0

Expected Behaviour:

Libraries linked by the executable should appear in the dependencies of the json manifest so that downstream tools can use the manifest to create a package (eg https://docs.conan.io/en/latest/integrations/custom.html)

Actual Behaviour

boost_system is linked by the executable but does not appear in the json manifest. If the manifest is used to create a deployable package, the executable will fail with a linking error at runtime.

@planetmarshall planetmarshall added the bug Something isn't working label Sep 27, 2021
@planetmarshall planetmarshall changed the title Boost: Boost.System is linked but does not appear as package dependency [boost] Boost.System is linked but does not appear as package dependency Sep 27, 2021
@madebr
Copy link
Contributor

madebr commented Sep 27, 2021

When you run cmake .. in your terminal, you are not adding the cmake module path and prefix path.
You need to add the arguments which conan's CMake build helper automatically adds for you:

cmake .. -DCMAKE_MODULE_PATH=$PWD -DCMAKE_PREFIX_PATH=$PWD

You were running cmake's FindBoost.cmake, not the one generated by conan.

I think conan 2.0 will have the same "problem" with running from terminal, but then wou will need to do cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake (or something similar).

@planetmarshall
Copy link
Contributor Author

When you run cmake .. in your terminal, you are not adding the cmake module path and prefix path.
You need to add the arguments which conan's CMake build helper automatically adds for you:

Yes, I was getting some linking errors related to boost system and I thought that this was the cause. Turned out to be a red herring as you describe - the actual cause is that some of the boost libraries are built with dependencies on the boost::system stub library. I'll close this bug and log another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants