-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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: GCC-12 build improvements #25436
Conversation
c8b788a
to
f1df4dd
Compare
GUIX hashes x86:
arm64:
|
These occur when building with GCC 12.1. It might be the case that these would be suppressed by updating the package, but that would also require installing new build tools (meson), as well as potentially more dependencies (wayland). ```bash In function 'ExprCreateBoolean', inlined from 'BoolVarCreate' at src/xkbcomp/ast-build.c:316:19: src/xkbcomp/ast-build.c:119:23: error: array subscript 'ExprDef[0]' is partly outside array bounds of 'unsigned char[32]' [-Werror=array-bounds] 119 | expr->boolean.set = set; | ~~~~~~~~~~~~~~~~~~^~~~~ In function 'ExprCreate', inlined from 'ExprCreateBoolean' at src/xkbcomp/ast-build.c:118:5, inlined from 'BoolVarCreate' at src/xkbcomp/ast-build.c:316:19: src/xkbcomp/ast-build.c:75:21: note: object of size 32 allocated by 'malloc' 75 | ExprDef *expr = malloc(size); | ^~~~~~~~~~~~ ```
Boost conatiner_hash (included via functional -> multi_index) uses std::unary_function, which was deprecated in C++11, and "removed" in C++17. It's use causes wanrings with newer compilers, i.e GCC 12.1. ```bash /bitcoin/depends/aarch64-unknown-linux-gnu/include/boost/container_hash/hash.hpp:131:33: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 131 | struct hash_base : std::unary_function<T, std::size_t> {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/12/bits/unique_ptr.h:37, from /usr/include/c++/12/memory:76, from ./init.h:10, from init.cpp:10: /usr/include/c++/12/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function ``` Use the MACRO outlined in boostorg/container_hash#22, to prevent it's use. BOOST_NO_CXX98_FUNCTION_BASE: > The standard library no longer supports std::unary_function and std::binary_function. > They were deprecated in C++11 and is removed from C++14. See: boostorg/config#430 https://en.cppreference.com/w/cpp/utility/functional/unary_function https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html
f1df4dd
to
880d4aa
Compare
I've also played with updating the libxkbcommon package, which requires changing build systems (meson/ninja), there's a work in progress branch here, fanquake@adb123d, but it doesn't yet work properly. If someone wanted to play with that, they could, but I also don't think we should block building depends with GCC 12 on updating libxkbcommon. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This is fine imo. I mean we only use libxkbcommon to link against, it doesn't really matter what the version is (older is better, probably, from a compat point of view). |
Code review ACK 880d4aa |
880d4aa build: use BOOST_NO_CXX98_FUNCTION_BASE to suppress warnings (fanquake) 1bdbbbd build: suppress array-bounds errors in libxkbcommon (fanquake) Pull request description: 2 changes to better support building with GCC 12, which out of the box, is currently broken if you want to build using depends. Prevent `-Warray-bounds` errors when building libxkbcommon. i.e: ```bash src/xkbcomp/ast-build.c:82:27: error: array subscript 'ExprDef[0]' is partly outside array bounds of 'unsigned char[32]' [-Werror=array-bounds] 82 | expr->expr.value_type = type; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ src/xkbcomp/ast-build.c:75:21: note: object of size 32 allocated by 'malloc' 75 | ExprDef *expr = malloc(size); | ^~~~~~~~~~~~ ``` It might be the case that these would be fixed by updating the package, but that would also require installing new build tools (meson), as well as potentially more dependencies (wayland), and it'd need testing with Qt. For now, just turn the errors into wanrings. Define `BOOST_NO_CXX98_FUNCTION_BASE` to prevent GCC warning about the use of `std::unary_function`. i.e: ```bash /bitcoin/depends/aarch64-unknown-linux-gnu/include/boost/container_hash/hash.hpp:131:33: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 131 | struct hash_base : std::unary_function<T, std::size_t> {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/12/bits/unique_ptr.h:37, from /usr/include/c++/12/memory:76, from ./init.h:10, from init.cpp:10: /usr/include/c++/12/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function ``` Boost `container_hash` (included via functional -> multi_index) uses [`std::unary_function`, which was deprecated in C++11](https://en.cppreference.com/w/cpp/utility/functional/unary_function), and "removed" in C++17. It's use causes warnings with newer compilers, i.e GCC 12.1. Use the MACRO outlined in boostorg/container_hash#22, and added to Boost Config for GCC 12 in boostorg/config#430, to prevent it's use. [BOOST_NO_CXX98_FUNCTION_BASE](https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html): > The standard library no longer supports std::unary_function and std::binary_function. > They were deprecated in C++11 and is removed from C++14. Guix Build (x86_64): ```bash ``` Guix Build (arm64): ```bash ``` ACKs for top commit: laanwj: Code review ACK 880d4aa Tree-SHA512: 10c4679c3eb788e9279acc4960731c55ae1568bd3df525d3c46f97d8b0319e7d8450b1638b6777d98111b5991dba5c787e95d80b1ac932e0b4779d4b8e74875e
880d4aa build: use BOOST_NO_CXX98_FUNCTION_BASE to suppress warnings (fanquake) 1bdbbbd build: suppress array-bounds errors in libxkbcommon (fanquake) Pull request description: 2 changes to better support building with GCC 12, which out of the box, is currently broken if you want to build using depends. Prevent `-Warray-bounds` errors when building libxkbcommon. i.e: ```bash src/xkbcomp/ast-build.c:82:27: error: array subscript 'ExprDef[0]' is partly outside array bounds of 'unsigned char[32]' [-Werror=array-bounds] 82 | expr->expr.value_type = type; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ src/xkbcomp/ast-build.c:75:21: note: object of size 32 allocated by 'malloc' 75 | ExprDef *expr = malloc(size); | ^~~~~~~~~~~~ ``` It might be the case that these would be fixed by updating the package, but that would also require installing new build tools (meson), as well as potentially more dependencies (wayland), and it'd need testing with Qt. For now, just turn the errors into wanrings. Define `BOOST_NO_CXX98_FUNCTION_BASE` to prevent GCC warning about the use of `std::unary_function`. i.e: ```bash /bitcoin/depends/aarch64-unknown-linux-gnu/include/boost/container_hash/hash.hpp:131:33: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 131 | struct hash_base : std::unary_function<T, std::size_t> {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/12/bits/unique_ptr.h:37, from /usr/include/c++/12/memory:76, from ./init.h:10, from init.cpp:10: /usr/include/c++/12/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function ``` Boost `container_hash` (included via functional -> multi_index) uses [`std::unary_function`, which was deprecated in C++11](https://en.cppreference.com/w/cpp/utility/functional/unary_function), and "removed" in C++17. It's use causes warnings with newer compilers, i.e GCC 12.1. Use the MACRO outlined in boostorg/container_hash#22, and added to Boost Config for GCC 12 in boostorg/config#430, to prevent it's use. [BOOST_NO_CXX98_FUNCTION_BASE](https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html): > The standard library no longer supports std::unary_function and std::binary_function. > They were deprecated in C++11 and is removed from C++14. Guix Build (x86_64): ```bash ``` Guix Build (arm64): ```bash ``` ACKs for top commit: laanwj: Code review ACK 880d4aa Tree-SHA512: 10c4679c3eb788e9279acc4960731c55ae1568bd3df525d3c46f97d8b0319e7d8450b1638b6777d98111b5991dba5c787e95d80b1ac932e0b4779d4b8e74875e
880d4aa build: use BOOST_NO_CXX98_FUNCTION_BASE to suppress warnings (fanquake) 1bdbbbd build: suppress array-bounds errors in libxkbcommon (fanquake) Pull request description: 2 changes to better support building with GCC 12, which out of the box, is currently broken if you want to build using depends. Prevent `-Warray-bounds` errors when building libxkbcommon. i.e: ```bash src/xkbcomp/ast-build.c:82:27: error: array subscript 'ExprDef[0]' is partly outside array bounds of 'unsigned char[32]' [-Werror=array-bounds] 82 | expr->expr.value_type = type; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ src/xkbcomp/ast-build.c:75:21: note: object of size 32 allocated by 'malloc' 75 | ExprDef *expr = malloc(size); | ^~~~~~~~~~~~ ``` It might be the case that these would be fixed by updating the package, but that would also require installing new build tools (meson), as well as potentially more dependencies (wayland), and it'd need testing with Qt. For now, just turn the errors into wanrings. Define `BOOST_NO_CXX98_FUNCTION_BASE` to prevent GCC warning about the use of `std::unary_function`. i.e: ```bash /bitcoin/depends/aarch64-unknown-linux-gnu/include/boost/container_hash/hash.hpp:131:33: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 131 | struct hash_base : std::unary_function<T, std::size_t> {}; | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/12/bits/unique_ptr.h:37, from /usr/include/c++/12/memory:76, from ./init.h:10, from init.cpp:10: /usr/include/c++/12/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function ``` Boost `container_hash` (included via functional -> multi_index) uses [`std::unary_function`, which was deprecated in C++11](https://en.cppreference.com/w/cpp/utility/functional/unary_function), and "removed" in C++17. It's use causes warnings with newer compilers, i.e GCC 12.1. Use the MACRO outlined in boostorg/container_hash#22, and added to Boost Config for GCC 12 in boostorg/config#430, to prevent it's use. [BOOST_NO_CXX98_FUNCTION_BASE](https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html): > The standard library no longer supports std::unary_function and std::binary_function. > They were deprecated in C++11 and is removed from C++14. Guix Build (x86_64): ```bash ``` Guix Build (arm64): ```bash ``` ACKs for top commit: laanwj: Code review ACK 880d4aa Tree-SHA512: 10c4679c3eb788e9279acc4960731c55ae1568bd3df525d3c46f97d8b0319e7d8450b1638b6777d98111b5991dba5c787e95d80b1ac932e0b4779d4b8e74875e
…SE` macro redefinition d4c59da build: Avoid `BOOST_NO_CXX98_FUNCTION_BASE` macro redefinition (Hennadii Stepanov) Pull request description: With GCC 12 and Boost 1.81 (from depends) having multiple warnings: ``` In file included from /home/hebasto/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/config.hpp:48: /home/hebasto/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/config/stdlib/libstdcpp3.hpp:397:9: warning: 'BOOST_NO_CXX98_FUNCTION_BASE' macro redefined [-Wmacro-redefined] #define BOOST_NO_CXX98_FUNCTION_BASE ^ <command line>:8:9: note: previous definition is here #define BOOST_NO_CXX98_FUNCTION_BASE 1 ^ 1 warning generated. ``` This PR fixes those warnings. Defining of the `BOOST_NO_CXX98_FUNCTION_BASE` macro was introduced in bitcoin/bitcoin#25436, but since boostorg/config#430, it is required to check it before adding. ACKs for top commit: fanquake: ACK d4c59da - it works now. Tree-SHA512: 53b9ddcf8dad729638ed41251e30c80f2d7d1ae3ffe47466865834f1f10184fe0881abeb339b3e46c270c3eb11fb63d19ab12cc9461bf5c2be12b4763c1b1c34
…o redefinition d4c59da build: Avoid `BOOST_NO_CXX98_FUNCTION_BASE` macro redefinition (Hennadii Stepanov) Pull request description: With GCC 12 and Boost 1.81 (from depends) having multiple warnings: ``` In file included from /home/hebasto/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/config.hpp:48: /home/hebasto/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/config/stdlib/libstdcpp3.hpp:397:9: warning: 'BOOST_NO_CXX98_FUNCTION_BASE' macro redefined [-Wmacro-redefined] #define BOOST_NO_CXX98_FUNCTION_BASE ^ <command line>:8:9: note: previous definition is here #define BOOST_NO_CXX98_FUNCTION_BASE 1 ^ 1 warning generated. ``` This PR fixes those warnings. Defining of the `BOOST_NO_CXX98_FUNCTION_BASE` macro was introduced in bitcoin#25436, but since boostorg/config#430, it is required to check it before adding. ACKs for top commit: fanquake: ACK d4c59da - it works now. Tree-SHA512: 53b9ddcf8dad729638ed41251e30c80f2d7d1ae3ffe47466865834f1f10184fe0881abeb339b3e46c270c3eb11fb63d19ab12cc9461bf5c2be12b4763c1b1c34
These occur when building with GCC 12.1. It might be the case that these would be suppressed by updating the package, but that would also require installing new build tools (meson), as well as potentially more dependencies (wayland). ```bash In function 'ExprCreateBoolean', inlined from 'BoolVarCreate' at src/xkbcomp/ast-build.c:316:19: src/xkbcomp/ast-build.c:119:23: error: array subscript 'ExprDef[0]' is partly outside array bounds of 'unsigned char[32]' [-Werror=array-bounds] 119 | expr->boolean.set = set; | ~~~~~~~~~~~~~~~~~~^~~~~ In function 'ExprCreate', inlined from 'ExprCreateBoolean' at src/xkbcomp/ast-build.c:118:5, inlined from 'BoolVarCreate' at src/xkbcomp/ast-build.c:316:19: src/xkbcomp/ast-build.c:75:21: note: object of size 32 allocated by 'malloc' 75 | ExprDef *expr = malloc(size); | ^~~~~~~~~~~~ ``` Github-Pull: bitcoin#25436 Rebased-From: 1bdbbbd
f091933 depends: fix compiling bdb with clang-16 on aarch64 (fanquake) c14f3b3 bdb: disable Werror for format-security (fanquake) ec7a883 build: suppress array-bounds errors in libxkbcommon (fanquake) Pull request description: Any further backports for 23.x. Currently: * 1bdbbbd from #25436 - which fixes building QT in depends with GCC > 12.1 * #25763 * #27462 ACKs for top commit: TheCharlatan: ACK f091933 Tree-SHA512: 8432ae37906e347ed30e2adc99a8b51e7f44159d04244fa749c5666c3b27cdd4fa89394c41674f980c09cc6c11367c3ee9c0922a2a8bd65ea471f9fd71a108ad
2 changes to better support building with GCC 12, which out of the box, is currently broken if you want to build using depends.
Prevent
-Warray-bounds
errors when building libxkbcommon. i.e:It might be the case that these would be fixed by updating the
package, but that would also require installing new build tools (meson),
as well as potentially more dependencies (wayland), and it'd need
testing with Qt. For now, just turn the errors into wanrings.
Define
BOOST_NO_CXX98_FUNCTION_BASE
to prevent GCC warning about the use ofstd::unary_function
. i.e:Boost
container_hash
(included via functional -> multi_index) usesstd::unary_function
, which was deprecated in C++11, and "removed" inC++17. It's use causes warnings with newer compilers, i.e GCC 12.1.
Use the MACRO outlined in boostorg/container_hash#22, and added to Boost Config for GCC 12 in boostorg/config#430, to prevent it's use.
BOOST_NO_CXX98_FUNCTION_BASE:
Guix Build (x86_64):
Guix Build (arm64):