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

Work around boost failure to build in clang 15 #5495

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

geoffrey4444
Copy link
Contributor

Proposed changes

Workaround for boost not building with clang 15: adds -D_HAS_AUTO_PTR_ETC=0 to CMAKE_CXXX_FLAGS if clang version >= 15.0.0. This fix is necessary to build with latest Xcode/AppleClang.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

set(CMAKE_CXX_FLAGS "-D_HAS_AUTO_PTR_ETC=0 ${CMAKE_CXX_FLAGS}")
endif()
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use if/elseif here, even though it duplicates a line, to avoid lines over 80 characters. I tried continuing the if line with , but make complained

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe CMake ignores newlines outside of strings (except as generic whitespace), so you should be able to wrap it just like C++.

(To any other readers: The previous comment contains a backslash before the last comma, but GitHub isn't displaying it.)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "15.0.0")
set(CMAKE_CXX_FLAGS "-D_HAS_AUTO_PTR_ETC=0 ${CMAKE_CXX_FLAGS}")
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "15.0.0")
set(CMAKE_CXX_FLAGS "-D_HAS_AUTO_PTR_ETC=0 ${CMAKE_CXX_FLAGS}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this to SetupBoost.cmake please, to the boost target using target_compile_definitions.

@geoffrey4444
Copy link
Contributor Author

Ready for another look when you get a chance...thanks for the reviews! It's such a short PR that I squashed immediately.

Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only became a problem with recent versions of boost (the code builds fine with boost 1.74 and clang 15 in the container, though I don't see an obvious reason why). It is fixed in boost 1.83. Therefore I suggest to add the condition BOOST_VERSION VERSION_LESS 1.83.0.

@geoffrey4444
Copy link
Contributor Author

This only became a problem with recent versions of boost (the code builds fine with boost 1.74 and clang 15 in the container, though I don't see an obvious reason why). It is fixed in boost 1.83. Therefore I suggest to add the condition BOOST_VERSION VERSION_LESS 1.83.0.

Note that brew has not yet updated boost to 1.83.0, so until they do, this workaround still matters for macOS users running the latest AppleClang

Comment on lines +127 to +128
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "15.0.0" OR
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "15.0.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that GREATER_EQUAL also exists, and this could also be combined with the above if (not requesting this).

@nilsvu
Copy link
Member

nilsvu commented Sep 25, 2023

Thanks for fixing this @geoffrey4444 !

@nilsvu nilsvu added bugfix build system CMake build system labels Sep 25, 2023
@nilsvu nilsvu merged commit b63891c into sxs-collaboration:develop Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix build system CMake build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants