-
Notifications
You must be signed in to change notification settings - Fork 187
Boost library link dependencies are incorrect #141
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
Comments
Could you try deleting your hunter folder and with : include(HunterGate)
HunterGate(
URL "https://github.com/nxxm/hunter/archive/feature/fix-boost-1.72-cmake-package-configs.zip"
SHA1 "039b7abd220e4368d3fcbf7df520279678089cca"
) Just to check if the fix I did for 1.72.0 is not fixing this one as well, because normally it should as far as I remeber then we use the FindBoost support. |
I checked it and it does work as you expect it with my fixes. You've been fooled by the Boost package config files that I remove in my PR #140 I think. See run on my machine :
|
Looks like you're right! Awesome! I hope your fix gets merged in without many issues. |
So far all tests passed and the changes are small, so I hope it get merged soon 😄. Your report here means we are concerned by #133 for a longer time. |
It actually even is somehow a duplicate of #133 I think. |
Hi fellas, Is there any chance you could let me know when the fix to this problem will be merged to master and released? It's holding me back from upgrading to boost-1.72 in my hunter demos of Boost. I'm a maintainer of Boost.Beast, and I use Hunter to demonstrate code to people would have issues or queries with the Boost.Beast library. It would be great to have a solution. Please note that using the patch mentioned above did not work for me (Fedora Linux 31, gcc9.2, CLion) The SHA1 for the patch download on linux is With patch:
Demo repo: https://github.com/test-scenarios/latest-hunter Regards, Richard |
Hi @madmongo1 it is great to see that someone from the "somehow official" ;-) is also using hunter :-) … I have the feeling that when I every year on the Meeting C++ conference and met people like Jon K. or when I hear Cpp-Chat or Cpp-Cast that everyone uses or only know the "other" package manager approach :-) There is a PR #140 (I think you saw this). Unfortunately it is not merged yet because there are some findings. But you write this patch is not working for you? You mean with patch that PR #140 ? I try to reproduced the error with your demo repo. I use my C++ build environment in my ubuntu docker, image (from Dockerhub ). This works for me! I will try with different toolchains .... In the meanwhile, can you try following, add following line in your CMakeLists.txt:
And can you enable the "boost debugging" with:
and post the output here. Thanks. |
@madmongo1 Btw. you should know that boost is providing a "Boost Config" modul for cmake since 1.70. This is unfortunately not yet used in hunter. Hunter provides it's own "Boost Config" modul. That's why you must add manually and also in the right order all link depended library on |
@Bjoe I'm aware of the effort to cmake-ify boost. Peter Dimov is leading the work. I know that he's been trying to ensure that the boost-created cmake packages are close enough to the behaviour of the kitware FindBoost.cmake script to be compatible, but I also know that boost cmake scripts create a target for each boost sub-library, whether header-only or not. ...Well that's odd. I've just nuked my
Thanks for looking into this. By the way, I often bore my colleagues in the Please do continue the good work. Hunter is the package manager that c++ always needed. |
@madmongo1 ok you are faster then me :-)
Hm Peter Dimov ... I think I saw/met/know him ....
Should not happen that you had to nuked your Btw. I also use your example and add/change following:
to test my solution and it also works :-) Last thing, this solution file(GLOB_RECURSE ... I think you know that this has a number of drawbacks and is actively discouraged by the CMake documentation (See Note in: https://cmake.org/cmake/help/latest/command/file.html#glob) or?
Hm I should more reading my Slack channels :-) ... thanks for pointing to
|
Points noted, thank you. However...
This has been fixed in cmake 3.16+ with the addition of the Also, I've made sure Hunter gets a mention in my C++ Alliance bio (see bottom of page): |
@madmongo1 Thanks for the report and praise. 😄 As @Bjoe correctly pointed out, the PR for Boost does not yet update |
I created a PR to enable via
original cmake config modul from boost .... #154 needs tester/reviewer, thanks :-) |
Solved by #140 I think |
Did you test this before closing it? I don't think it's solved. It doesn't work for me at least. Running the test CMakelists.txt from the description with the latest Hunter release produces the same results as before: One of the changes between the solution provided in @daminetreg's original comment and the merged PR seems to have undone the fix. (The artifact from the comment has since been updated so I can't repeat the test) @daminetreg: Do you know what might have caused this? |
Normally the same should just work, that's pretty strange that you experience this regression. But indeed it might then be due to the FindBoost.cmake inside the hunter project. |
I'll check to solve it definitely. |
Just to be sure did you update the link to huntergate in the description comment ? |
Indeed this one doesn't work anymore. I'll dig in it tonight. |
Thanks @daminetreg . I'm not familiar enough with the details to know what might have changed here. @rbsheth could you please re-open the issue? |
Re-opening. I tried the newest Boost on my laptop and it worked so I'm unsure as well. |
I'm confused .... it should not surprise you guys! ... that's what I mean with my comment #133 (comment) The fix from @daminetreg is absolutly fine ... hunter is now working like before ! The real problem is, I can repeat it again: Hunter is introduced a not well maintained Now you should ask me, why is hunter using I introduced in the hunter boost-log test build a debug output:
This means, you should add the dependecies your self! See also the boost examples in hunter like If you should use my PR #154 then you have all dependencies well defined. See https://travis-ci.org/Bjoe/hunter/jobs/652334970#L6178 Now you should ask me, why Again, try my PR #154 and it should solve your problem ... if not, let me know ... or you should add the dependency your self. Somebody should find out, why |
Dear @Bjoe the problem is that it did work with the version I had made at some point. After diffing the findboost yesterday, I suspect that sometimes, for some odd reason cmake uses the official CMake FindBoost instead of the packaged one. I will try to reproduce it to fully understand it. But apart from that the FindBoost.cmake we have in hunter and the one in cmake is almost identical, there are some hunter paths and msvc platform specific fixes though, so I will backport them. I'll also add the test we have here in this description to the hunter project, to ensure we don't fail again.
I think at some point when your PR is done and we have feedback on big existing codebase we could remove fully the FindBoost, but in the meantime I'll try to update it, as it sounds like a 1h work. |
1 similar comment
Dear @Bjoe the problem is that it did work with the version I had made at some point. After diffing the findboost yesterday, I suspect that sometimes, for some odd reason cmake uses the official CMake FindBoost instead of the packaged one. I will try to reproduce it to fully understand it. But apart from that the FindBoost.cmake we have in hunter and the one in cmake is almost identical, there are some hunter paths and msvc platform specific fixes though, so I will backport them. I'll also add the test we have here in this description to the hunter project, to ensure we don't fail again.
I think at some point when your PR is done and we have feedback on big existing codebase we could remove fully the FindBoost, but in the meantime I'll try to update it, as it sounds like a 1h work. |
Sorry for the inconvenience if I express my self in a "wrong way" ... maybe I'm to hysteric but I'm bit afraid that we do the same error like the cmake <-> android/google guys ... ;-)
Yep, I think so because I use hunter since one year. Since that I added the dependencies manually like the examples in hunter.
Have you find out from which cmake version
That sounds like a plan ;-) |
One thing to keep in mind is that the solution should work for older versions of Boost as well. There are users, myself included, who cannot use the latest version for various reasons. |
#154 is merged, can this Issue be closed? |
I believe #154 only helps for the latest versions of boost. The problem still exists for all previous versions. |
Yep @BenWhetton is right. I'm not sure since when Boost is introduced the cmake package configuration. I verified it with Boost 1.72 but maybe it is also possible to use an earlier version. @BenWhetton You need Boost 1.71 ? |
I'm trying to use Boost 1.67 and link dependencies don't work there either. As @Bjoe mentioned, the problem is that the call to I'm only evaluating Hunter, but the fact that it is "subsuming" the standard CMake Deleting Hunter's custom |
@shoreadmin Which CMake version are you using? Maybe hunter should decide which "FindBoost.cmake" they used based on cmake version? |
@Bjoe - My comment was from a while ago, but I'm pretty sure we were (and still are) using CMake 3.16.4. I haven't looked into Hunter any further recently. |
hunter_add_package
/find_package
API used by me in the example is the same as in documentation. [Yes]URL
/SHA1
. [Yes](cmake/Hunter/config.cmake contains
hunter_config(Boost VERSION 1.71.0-p0)
to avoid issues with boost 1.72)Here is the log until first error reported by Hunter, option
HUNTER_STATUS_DEBUG
isOFF
(it doesn't add anything):As you can see,
Boost::log
only links toBoost::boost
, which is not correct.I'm using the next command line on generate step:
As you can see, hunter doesn't find and link dependent libraries.
On the other hand, if we link to system boost without using Hunter, it finds all the correct link dependencies:
This is a major issue because Boost libraries must be linked in specific orders to avoid linking errors and CMake may optimise the linking order and break the build in the process if there are no explicit link dependencies between libraries.
It looks like CMake's FindBoost.cmake file contains logic for setting the dependencies up correctly. I think Boost are also implementing find CONFIG mode support from v1.70.
The text was updated successfully, but these errors were encountered: