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

build: add compiler and C++ standard compatibility checks #2463

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

tchaikov
Copy link
Contributor

@tchaikov tchaikov commented Oct 1, 2024

we install SeastarConfig.cmake so that a Seastar project can consume the Seastar libraries using find_package(Seastar). this CMake config file checks for the dependencies used by CMake, and defines the Seastar libraries to be consumed by the parent project. one of the dependence is detected using FindSourceLocation.cmake, which is also shipped along with Seastar, this find module is provided so that we can detect the C++ compiler support of std::source_location related features. But the result of the detection depends on the C++ standard used, which is default to the one configured by the used C++ compiler if not specified. if the parent project consumes precompiled Seastar libraries, and use a differnt C++ standard, the parent project could fail to build, because Seastar and parent project are using different compiling options.

mismatches in C++ standards or compilers between Seastar and the parent project can lead to build failures or runtime issues. while not always problematic, these mismatches can cause unexpected behavior.

in this change, we detect

  • the C++ standards used by the parent project and Seastar
  • the C++ compiler used by the parent project and Seastar

warnings are non-fatal as compatibility is possible in some cases, but developers should be aware of potential issues and test thoroughly.

Fixes #2181
Signed-off-by: Kefu Chai [email protected]

@tchaikov tchaikov force-pushed the build-check-compiler-standard branch 2 times, most recently from 18a4379 to 8675d56 Compare October 1, 2024 08:44
we install `SeastarConfig.cmake` so that a Seastar project can consume
the Seastar libraries using `find_package(Seastar)`. this CMake config
file checks for the dependencies used by CMake, and defines the Seastar
libraries to be consumed by the parent project. one of the dependence
is detected using FindSourceLocation.cmake, which is also shipped along
with Seastar, this find module is provided so that we can detect the
C++ compiler support of `std::source_location` related features. But
the result of the detection depends on the C++ standard used, which
is default to the one configured by the used C++ compiler if not
specified. if the parent project consumes precompiled Seastar libraries,
and use a differnt C++ standard, the parent project could fail to build,
because Seastar and parent project are using different compiling options.

mismatches in C++ standards or compilers between Seastar and the parent project
can lead to build failures or runtime issues. while not always problematic,
these mismatches can cause unexpected behavior.

in this change, we detect

- the C++ standards used by the parent project and Seastar
- the C++ compiler used by the parent project and Seastar

warnings are non-fatal as compatibility is possible in some cases, but
developers should be aware of potential issues and test thoroughly.

Fixes scylladb#2181
Signed-off-by: Kefu Chai <[email protected]>
@tchaikov tchaikov force-pushed the build-check-compiler-standard branch from 8675d56 to 4738bf8 Compare October 1, 2024 09:50
@tchaikov tchaikov added the build build system label Oct 1, 2024
@avikivity
Copy link
Member

Rather than check compatibility, can we inherit the compiler/standard from the parent project? I can't think of a reason why they'd be different.

@tchaikov
Copy link
Contributor Author

tchaikov commented Oct 1, 2024 via email

@avikivity avikivity merged commit 52dab12 into scylladb:master Oct 1, 2024
15 checks passed
@tchaikov tchaikov deleted the build-check-compiler-standard branch October 4, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined reference to `seastar::logger::failed_to_log
2 participants