Repository navigation
cmake: disable deprecated warning when building googletest - #62622
Merged
Merged
Conversation
In commit 986f691, we updated the googletest submodule to silence a CMake warning. However, this change broke the build due to a Clang issue where it warns about deprecated declarations even from system headers (see llvm/llvm-project#76515). Since we use `-Werror` in our compile options, these warnings become errors and fail the build. This change detects if we're affected by the specific combination of compiler, standard library, and compile options that triggers this issue. It then conditionally disables the `-Wdeprecated-declarations` warning when building googletest to resolve build failures caused by deprecated functions like `get_temporary_buffer<>` in the standard library. The build failure looks like: ``` FAILED: src/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o ... In file included from /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest-all.cc:38: In file included from /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:55: In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/memory:66: /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8: error: 'get_temporary_buffer<testing::TestInfo *>' is deprecated [-Werror,-Wdeprecated-declarations] 263 | std::get_temporary_buffer<value_type>(_M_original_len)); | ^ /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:4996:15: note: in instantiation of member function 'std::_Temporary_buffer<__gnu_cxx::__normal_iterator<testing::TestInfo **, std::vector<testing::TestInfo *>>, testing::TestInfo *>::_Temporary_buffer' requested here 4996 | _TmpBuf __buf(__first, (__last - __first + 1) / 2); | ^ /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:5070:23: note: in instantiation of function template specialization 'std::__stable_sort<__gnu_cxx::__normal_iterator<testing::TestInfo **, std::vector<testing::TestInfo *>>, __gnu_cxx::__ops::_Iter_comp_iter<(lambda at /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3024:20)>>' requested here 5070 | _GLIBCXX_STD_A::__stable_sort(__first, __last, | ^ /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3023:8: note: in instantiation of function template specializatio ``` Signed-off-by: Kefu Chai <[email protected]>
tchaikov
force-pushed
the
cmake-disable-deprecated-warning
branch
from
April 2, 2025 03:35
80e1ee2 to
27e9d56
Compare
Contributor
Author
|
see https://jenkins.ceph.com/job/ceph-pull-requests/155195/consoleFull#1176073283e4bfde06-44c1-4b3c-8379-d9ee175fb257 for an instance of the FTBFS addressed by this issue |
Contributor
Author
|
jenkins test make check arm64 |
cbodley
approved these changes
Apr 2, 2025
cbodley
left a comment
Contributor
There was a problem hiding this comment.
thanks. someday we'll be able use system packages
Contributor
Author
i'd love to drop the submodule as well. will try again on a rainy Sunday. |
4 of 14 tasks
idryomov
reviewed
Apr 2, 2025
| if(NOT COMPILER_IGNORES_DEPRECATED_DECL_IN_SYSTEM_HEADERS) | ||
| # See https://github.com/llvm/llvm-project/issues/76515 | ||
| set_property(DIRECTORY googletest | ||
| APPEND "-Wno-deprecated-declarations" |
Contributor
There was a problem hiding this comment.
Some make check jobs are now failing with:
CMake Error at src/CMakeLists.txt:772 (set_property):
set_property given invalid argument "-Wno-deprecated-declarations".
In particular, irvingi07 worker seems to be affected.
Contributor
Author
There was a problem hiding this comment.
Sorry for the regression, will take a look ASAP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In commit 986f691, we updated the googletest submodule to silence a CMake warning. However, this change broke the build due to a Clang issue where it warns about deprecated declarations even from system headers (see llvm/llvm-project#76515). Since we use
-Werrorin our compile options, these warnings become errors and fail the build.This change detects if we're affected by the specific combination of compiler, standard library, and compile options that triggers this issue. It then conditionally disables the
-Wdeprecated-declarationswarning when building googletest to resolve build failures caused by deprecated functions likeget_temporary_buffer<>in the standard library.The build failure looks like:
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job Definition