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 1.81 not working (on macOS) - non-default boost location not supported by CMakeLists #35

Closed
peter-d opened this issue Feb 3, 2023 · 3 comments · Fixed by #42
Closed

Comments

@peter-d
Copy link
Collaborator

peter-d commented Feb 3, 2023

Hi,

I've had some issues for Olympia to build on macOs (M1, running Ventura 13.1), not sure if the issue is present in other systems: default boost installed with brew install boost gives v1.81, which has issues in Phoenix which cause it to fail with duplicate symbols when linking (boostorg/phoenix#111). (also Sparta build fails on this)

Just for other people running into this, here's my journey on this issue:

First of all: not to worry, I've also got boost v1.76 via homebrew, but it's not in a default location. So I had to build Sparta, Olympia and so also sta_lib with a non default boost location.

Then it got a bit complicated:

  • Sparta build needs -DBoost_DIR=/opt/homebrew/Cellar/[email protected]/1.76.0_3/lib/cmake/Boost-1.76.0 to point it to the cake folder for the right boost version. (it does not, for some reason, use the cmake default included files to find boost)
  • Olympia includes sparta-config.cmake so needs the same command line option for make to find Boost.
  • But Olympia includes sty_lib in the build tree as a submodule, which does use the cmake default scripts, and they need another define on the command line: -DBOOST_ROOT=/opt/homebrew/Cellar/[email protected]/1.76.0_3

Which makes for a cmake command that gets a bit verbose:

cmake -S . -B Release -DCMAKE_BUILD_TYPE=Release -DSPARTA_BASE=$HOME/src/map/sparta \
   -DBOOST_ROOT=/opt/homebrew/Cellar/[email protected]/1.76.0_3 \
   -DBoost_DIR=/opt/homebrew/Cellar/[email protected]/1.76.0_3/lib/cmake/Boost-1.76.0

Which then passes cmake but fails at build, because boost is not added as an include for core and mss.

Which I've fixed in the respective CMakeLists.txt, PR incoming soon.

But more generally: it would be nice to harmonise the boost config across Sparta, Olympia and stf_lib, so only 1 command line arg is needed to use it if it's in a non-default place. This avoids the double command line args needed in cmake.

I am willing to file a PR against Sparta as well to harmonise it to the standard cmake way of finding boost, but the comments in the CMakeLists.txt there seem to hint the custom way is there for (historic) reasons.

@peter-d
Copy link
Collaborator Author

peter-d commented Feb 3, 2023

According to the boostorg/phoenix#112 (comment) a workaround for the whole 1.81 issue is to do -DBOOST_PHOENIX_STL_TUPLE_H_ which might have other issues. If we go this route, this would need to be added to Sparta and stf_lib...

@ghost
Copy link

ghost commented Feb 3, 2023

Hi Peter, totally agree. The Boost cmake "finding policy" is a mess between the libraries and should be sync'ed. Yes, please file a PR against sparta removing the APPLE constraints on Boost. I'll do a little testing on the side and if all good, will approve and we can remove this nightmare.

Thanks!

@peter-d
Copy link
Collaborator Author

peter-d commented Feb 4, 2023

Hi Knute,

I'll let you know once I got it all lined up nicely in the PRs before we merge.

I'd like to review and clean up the boost include settings in the cmake too, in Sparta, it's added globally instead of specific targets, which makes you include boost when it might not be needed.

peter-d added a commit that referenced this issue May 8, 2023
This fixes #35 and tracks the changes in Sparta
[PR397(sparcians/map#397), which are merges into Sparta main already. 

---------

Signed-off-by: Peter Debacker <[email protected]>
Signed-off-by: Knute Lingaard <[email protected]>
Co-authored-by: Peter Debacker <[email protected]>
Co-authored-by: Knute Lingaard <[email protected]>
Co-authored-by: Knute Lingaard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant