-
Notifications
You must be signed in to change notification settings - Fork 186
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 1.72.0-p0 fails on Boost::boost #133
Comments
I will look into it. @michaeldkroener thx |
@michaeldroener what is strange, all the test did pass and https://github.com/cpp-pm/hunter/blob/master/examples/Boost/CMakeLists.txt#L16 |
@dan-42 Thanks for picking this up. @michaeldkroener What toolchain are you using? |
Boost 1.72 requires CMake 3.16.2 or newer. |
I wonder if the cmake version is really the issue, I see the Boost::headers / Boost::boost target being set to the Hunter For example hunter generated for current released version # Generated by Boost 1.72.0
if(TARGET Boost::headers)
return()
endif()
if(Boost_VERBOSE OR Boost_DEBUG)
message(STATUS "Found boost_headers ${boost_headers_VERSION} at ${boost_headers_DIR}")
endif()
# Compute the include and library directories relative to this file.
get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
# If the computed and the original directories are symlink-equivalent, use original
if(EXISTS "/Users/daminetreg/.hunter/_Base/b13c867/13d43d3/e844a7d/Build/Boost/__filesystem/Install/lib/cmake")
get_filename_component(_BOOST_CMAKEDIR_COMPUTED "${_BOOST_CMAKEDIR}" REALPATH)
get_filename_component(_BOOST_CMAKEDIR_ORIGINAL "/Users/daminetreg/.hunter/_Base/b13c867/13d43d3/e844a7d/Build/Boost/__filesystem/Install/lib/cmake" REALPATH)
if(_BOOST_CMAKEDIR_COMPUTED STREQUAL _BOOST_CMAKEDIR_ORIGINAL)
set(_BOOST_CMAKEDIR "/Users/daminetreg/.hunter/_Base/b13c867/13d43d3/e844a7d/Build/Boost/__filesystem/Install/lib/cmake")
endif()
unset(_BOOST_CMAKEDIR_COMPUTED)
unset(_BOOST_CMAKEDIR_ORIGINAL)
endif()
get_filename_component(_BOOST_INCLUDEDIR "${_BOOST_CMAKEDIR}/../../../Source/" ABSOLUTE)
get_filename_component(_BOOST_LIBDIR "${_BOOST_CMAKEDIR}/../" ABSOLUTE)
# Create imported target Boost::headers
add_library(Boost::headers INTERFACE IMPORTED)
set_target_properties(Boost::headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_BOOST_INCLUDEDIR}"
INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB"
)
unset(_BOOST_LIBDIR)
unset(_BOOST_INCLUDEDIR)
unset(_BOOST_CMAKEDIR)
mark_as_advanced(boost_headers_DIR)
|
Just to confirm I deleted the hunter cache and did everything with cmake 3.16.2 on mac catalina and I have the same exact result as above. I see if I can tweak boost cmake integration to avoid using the Source dir. |
Sorry for the late response. |
@michaeldkroener
And you can reproduce it with a minimal test-project? hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
add_executable(foo foo.cpp)
target_link_libraries(foo PUBLIC Boost::boost) like in the boost-uuid example (https://github.com/cpp-pm/hunter/blob/master/examples/Boost-uuid/CMakeLists.txt) |
It turns out if I do just use Boost::boost there is no problem but as soon as I use a component like program_options the problem occurs CMake File
foo.cpp is from I get
The same with Boost_USE_STATIC_LIBS=ON results in
|
I'm a bit concerned by the use of the cmake package config support that was added to Boost in 1.70, the one that @ruslo had done were way better thought for the need hunter has. Currently the Boost cmake support generates non relocatable files and which search for shared libs by default, while hunter builds static by cmake default. @ruslo is there a reason why you switched to the boost provided package configs ? We could go back and disable their installation (there is a cli switch for b2 |
Ah okay, sorry for my misunderstanding so it's acutally the plan of @ruslo to not use the boost generated package config. I saw in commit 7ca0ec0 that there are scripts to clean them up, the script just doesn't work anymore because they seem to have been renamed after the library name. I tried a local build with hunter passing |
So PR #140 should fix that, builds are in progress. |
@michaeldkroener you can try for yourself locally if it works with : include(HunterGate)
HunterGate(
URL "https://github.com/nxxm/hunter/archive/feature/fix-boost-1.72-cmake-package-configs.zip"
SHA1 "039b7abd220e4368d3fcbf7df520279678089cca"
) Remove your hunter folder first perhaps, to avoid that the lying BoostConfig.cmake don't mistaken your cmake. |
Can confirm it works perfectly with the fix after removing the hunter folder. |
Thank you very much. We may need to up some revisions to ensure it gets rebuilt automatically for users that already had the previous version. Because just changing the schemes files doesn’t account for a new config shasum I believe. Or am I wrong ? |
Hi @ALL .... I try to reproduced the Anyway ... what my biggest concern is, I'm not sure if it is the right way to still "remove" the original I think the best way is to fix the wrong "path" in boost. Then we can use the config modul from boost and we have lesser to maintain to easier update to newest boost version... I will try to find the root cause of the "wrong path" and will create a PR in boost .... |
Yes still, this is the same issue, I think it depends of the lexical sorting of directory names when cmakes hunts for the package-config.cmake files. In one case it finds the BoostConfig.cmake from boost and in the other where it works you happily end up with the FindBoost support. By the way did you tried on which OS ? I even wonder if locale doesn't play a role when cmake traverses the directories.
Sure but one step at a time. If we wait for boost to accept our change or patch boost install cmakes in bjam in hunter it costs way more times before we can actually use boost 1.72. It also needs a bigger effort and testing, to make cmakelists that worked previously with FindBoost to work with integrated boost cmake. There are many things to be solved at the Boost cmake support, it's really only an early support that they deliver, and things that they do, like forcing shared library search is also a problem.
I wanted to do the PR to the boost build repo whenever I get the time of it, but I'm happy someone else will tackle this ^^. For the moment with the time I have for this I just wanted to ensure existing hunter based cmake builds further. Because it's not just that PATH, you will have many other compatibility issues. |
By the way @Bjoe IMHO it's good to continue supporting boost as always for the moment. Because
Transitioning is good only when the fixes are applied in upstream Boost ( and I encourage you applying them ). I think this early boost support is only to test adoption and they didn't intend to break existing builds by just adding some files (but cmake is really awfully greedy when it comes to filesystem search). |
@daminetreg Last year on the Meeting C++ conference Deniz Bahadir recommended in his talk to use the Boost config moduls from boost and not any more the FindBoost.cmake maintained from cmake. He gives a reason in his talk. The BoostConfig module exists since boost 1.70, so I think they will never ever an "official statement" from the boost community because what I heard and know about boost and cmake there was in the past to many "destructive" discussion about cmake ... that's my assumption. So in my opinion, the BoostConfig modul is released in 1.72. so it should be usable :-) We can quickly fix the issue in hunter ... but maybe it shows us a problem "in hunter" how we build boost in hunter ? Maybe if we can introduce an easily alias to But as soon as possible, we should use BoostConfig from the boost project, I think. |
@Bjoe I honer your position to use what boost provides, but exactly the BoostConfig is the one that causes the problems. So for the next boost version we can have a look if the CMake support improved and use the one provided by boost, or we stick to what we have. But for now we need to have the PR #140 to make it work |
I quickly tried to understand what is going wrong and my assumption was correct. I change this in But this is also not a proper solution, because as the comment said:
Now it install the headers twice :-( But I don't find the boost build process in hunter not that "proper" anyway ... why is hunter for every boost lib create an own "build process" .... I my opinion that can be improved. But this is an other discussion. |
I created a PR to enable via
original cmake config modul from boost .... #154 needs tester/reviewer, thanks :-) |
Should be solved by #140 |
Reported by @michaeldkroener on PR #113
The text was updated successfully, but these errors were encountered: