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: GCC-12 build improvements #25436

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Jun 21, 2022

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:

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:

/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, 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:

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):

Guix Build (arm64):

@jarolrod
Copy link
Member

jarolrod commented Jun 23, 2022

GUIX hashes

x86:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum

648beb27bb60aad6b88c0865293738665d55421cb863a17ced246ea4fad5f18c  guix-build-f1df4dd2878a/output/aarch64-linux-gnu/SHA256SUMS.part
0901076bb0055522b0d733b7efc51afedec82b8ba4d3c8fb5cfb80dc8e5d58d6  guix-build-f1df4dd2878a/output/aarch64-linux-gnu/bitcoin-f1df4dd2878a-aarch64-linux-gnu-debug.tar.gz
e743b9acd4e6e3263328896409e37b0e702637294b435f09cde899f6d123bcb6  guix-build-f1df4dd2878a/output/aarch64-linux-gnu/bitcoin-f1df4dd2878a-aarch64-linux-gnu.tar.gz
cf37822a0a23af22a22d3b3447dc8540cae604df68881625948e151ff6d978b9  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/SHA256SUMS.part
a2373bc8e084697bbec1e08b40dc3d85d08dd922cea34b99739b79ce35d07ee2  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/bitcoin-f1df4dd2878a-arm-linux-gnueabihf-debug.tar.gz
2092364a132b6028f0c5c3a8b8a716fbd592089245ad74c1b8261da88dbd0e88  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/bitcoin-f1df4dd2878a-arm-linux-gnueabihf.tar.gz
6568fcfd0babeace56362e6921490ab50a6a84ee28aa248606df27d3cd862383  guix-build-f1df4dd2878a/output/arm64-apple-darwin/SHA256SUMS.part
fe98876ec35eded87e464ced7c90f3dcfc7961e23b03ef0e3e6e9c4ecf9b35bf  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin-unsigned.dmg
9cf0fb7c2b430c877e828aa4c942e3ffbee2f36d6acbf783dde9735e672ba6ce  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin-unsigned.tar.gz
f18ebae8ac75518dd21555c69bfed16a6a0a5b2590afaf96e6a6ffff9bc34d7f  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin.tar.gz
d939b5050fe48bade289a6209a147e9b2685d8784c7d328321462aa573724440  guix-build-f1df4dd2878a/output/dist-archive/bitcoin-f1df4dd2878a.tar.gz
3ec352d2321a358d1009b4ce0635782989de509b0dc82e9254e222b0a9220bf9  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/SHA256SUMS.part
d1fc1df89ba92debdc7ca1f865edbbf6d86365a2ffbf426705f708c494defe1e  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/bitcoin-f1df4dd2878a-powerpc64-linux-gnu-debug.tar.gz
ec15d97095b46b85e68dafce1f80639cccb6baa3cb141dcda1d65a646b135d57  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/bitcoin-f1df4dd2878a-powerpc64-linux-gnu.tar.gz
0b4dd2a8beb64513b14e5ce14004d25b3bc59bdff7401594f8278e5ebf682871  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/SHA256SUMS.part
d72d5fd1aa3626cae8599cc51d0a4a19612edd4ae13c49dce9f9334a9a7c9037  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/bitcoin-f1df4dd2878a-powerpc64le-linux-gnu-debug.tar.gz
57ed26b03b28cc00e7ae49fac049e43bb39fa57b33bbfaae5a1d37a515287fe7  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/bitcoin-f1df4dd2878a-powerpc64le-linux-gnu.tar.gz
15847353a751ccc323040e2c05033860a2c4a77381b1e87fe3c7a158fd1c0ffc  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/SHA256SUMS.part
8a8620d52cc639da368adb79c57337cbb4ec0e17233f8fdbd18760f4700a364b  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/bitcoin-f1df4dd2878a-riscv64-linux-gnu-debug.tar.gz
3d647c1e21d590b73758baf8f2a87adf0230d6ced9ac1310f8f3db3d50095789  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/bitcoin-f1df4dd2878a-riscv64-linux-gnu.tar.gz
5df51ce85386708b33c8004394e6a120eaee62c80bc6f928f1addc1d87cb8f90  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/SHA256SUMS.part
53ee3557b921c2c218ecfca89896eb0e547f652dea26a2630a0b13203f66f73d  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin-unsigned.dmg
be21aec933ce47ca5a8fc0838e211aaf8f11234e3b5f29a17a1589914c764121  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin-unsigned.tar.gz
37e3e633584e4a7060cda581a6097df769b9d2195a28654bc07e2bf1cb4576f5  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin.tar.gz
d2f0835c7fa07e37f551035db1300c5b631e17d28c0bc88146a053bc12a49ec7  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/SHA256SUMS.part
d99d9e7bae361ed981ffad52c7c42c1e7952d9e237f27f452981c32f379c64bb  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/bitcoin-f1df4dd2878a-x86_64-linux-gnu-debug.tar.gz
df36401321423afab0bd7a9bb53f2f6f8368ff3bdb80209a192512a6673106c7  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/bitcoin-f1df4dd2878a-x86_64-linux-gnu.tar.gz
b41a34bce877a47eacf57eb04ca628f9310a4bd3756a7054b33c3ffa6f9ac52b  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/SHA256SUMS.part
6c1ca19f54943e4a246693698319c6b89df3a7ca7125d26ce7b73d39bf5e052f  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-debug.zip
ea952cb4db8776e0b9250aed8653e309ea8824b4763853a86ef41d2912a3b99d  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-setup-unsigned.exe
b5f92fc5d319beacb8b5de4af8f9ed1da5e2465246f8f1f1496378cf1aa0a17d  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-unsigned.tar.gz
b45750ff21a0f88024ca34590022f71612ca369b5b98e503b3ac10231cd25c67  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64.zip

arm64:

$ env HOSTS='arm-linux-gnueabihf arm64-apple-darwin powerpc64-linux-gnu powerpc64le-linux-gnu riscv64-linux-gnu x86_64-apple-darwin x86_64-linux-gnu x86_64-w64-mingw32' ./contrib/guix/guix-build 
$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum

786574be2c3cdf441063176cae08022ccbc972cb726db6036af75e6135b8526d  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/SHA256SUMS.part
f5713390465c3436cb8e1bbbab0b48bf22bda8806217920aac47580091febf1f  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/bitcoin-f1df4dd2878a-arm-linux-gnueabihf-debug.tar.gz
b9cea2eede64b04fff90840756aa91984b9fd91883fb865aadd0fdbfe25d7e44  guix-build-f1df4dd2878a/output/arm-linux-gnueabihf/bitcoin-f1df4dd2878a-arm-linux-gnueabihf.tar.gz
46cf3d62d7af325a27a3538181ab6bc2e1bbe76c6727dbefcb64bcd288d279d7  guix-build-f1df4dd2878a/output/arm64-apple-darwin/SHA256SUMS.part
0bc9f95d1f6172771b3f120198a9a872b4f4e3a0732c28af8b47ef642b2072e3  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin-unsigned.dmg
22f49c433914e7ff1fdf94955610085b41e9c72843c7b80bff02dd3d8721cb1d  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin-unsigned.tar.gz
08cff7673fd2a4c48eb7dbbbb62f8071bfce9a3f0945f9c481d8f7cde63571bf  guix-build-f1df4dd2878a/output/arm64-apple-darwin/bitcoin-f1df4dd2878a-arm64-apple-darwin.tar.gz
d939b5050fe48bade289a6209a147e9b2685d8784c7d328321462aa573724440  guix-build-f1df4dd2878a/output/dist-archive/bitcoin-f1df4dd2878a.tar.gz
1f2642ebc66383d2a6205ca81518a295d1b0ea202f1fa09464c7b2425538b738  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/SHA256SUMS.part
68c8c1be9442526ad443ef9cc8bdc379072774e29f6485c0cce57e3b15ee11d7  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/bitcoin-f1df4dd2878a-powerpc64-linux-gnu-debug.tar.gz
52392f88ebe624249849b1bbe6ac7a7b6877b224b21fde3dee49a73d9c20a8c8  guix-build-f1df4dd2878a/output/powerpc64-linux-gnu/bitcoin-f1df4dd2878a-powerpc64-linux-gnu.tar.gz
bd192cffeef86406bdb817917227bc6a9f9082f936db3ae56d91b2e9029a3279  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/SHA256SUMS.part
14e1b4f84fed5e3e80984d080019e48f8e6b9842309739a6455dc8ab987cd452  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/bitcoin-f1df4dd2878a-powerpc64le-linux-gnu-debug.tar.gz
70aafcaf0407f63a8f46a993dcd8073a3218194da9ba999c089a19129f9aa722  guix-build-f1df4dd2878a/output/powerpc64le-linux-gnu/bitcoin-f1df4dd2878a-powerpc64le-linux-gnu.tar.gz
3271d07f27779ed87aba20b9e41ae0f40a554cf21b5dd047113a0b9261ef8f1c  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/SHA256SUMS.part
259eb63edb57afa098d7ede2c280df062413416fc4b2fed4d44ab419aa0d3465  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/bitcoin-f1df4dd2878a-riscv64-linux-gnu-debug.tar.gz
485de4fc1a7cfde0b3a177a6948cf5928899b4f8f7dad21479a1e2ce54a29a1b  guix-build-f1df4dd2878a/output/riscv64-linux-gnu/bitcoin-f1df4dd2878a-riscv64-linux-gnu.tar.gz
5df51ce85386708b33c8004394e6a120eaee62c80bc6f928f1addc1d87cb8f90  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/SHA256SUMS.part
53ee3557b921c2c218ecfca89896eb0e547f652dea26a2630a0b13203f66f73d  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin-unsigned.dmg
be21aec933ce47ca5a8fc0838e211aaf8f11234e3b5f29a17a1589914c764121  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin-unsigned.tar.gz
37e3e633584e4a7060cda581a6097df769b9d2195a28654bc07e2bf1cb4576f5  guix-build-f1df4dd2878a/output/x86_64-apple-darwin/bitcoin-f1df4dd2878a-x86_64-apple-darwin.tar.gz
0f5da3d9f13e90655590557a7bc149a5b5dab053ebf58898b86c65031e4faefe  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/SHA256SUMS.part
2ff7939c671540357d8a35a66dbd726793c737b5a55ab07532c63747551e177c  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/bitcoin-f1df4dd2878a-x86_64-linux-gnu-debug.tar.gz
97356b7afb6c3e2e7a9173a7bd0c906d448c71ca0febd3d145b07910fee06a29  guix-build-f1df4dd2878a/output/x86_64-linux-gnu/bitcoin-f1df4dd2878a-x86_64-linux-gnu.tar.gz
271d2650e7cd4d070c232f56dd31fe460f6601c326bdfddf282e13d210754ab0  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/SHA256SUMS.part
45db4acb362c94cf7b77f49ec0059f66ef9db34bb3052038c0ac92f9a2806c8a  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-debug.zip
ea952cb4db8776e0b9250aed8653e309ea8824b4763853a86ef41d2912a3b99d  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-setup-unsigned.exe
b5f92fc5d319beacb8b5de4af8f9ed1da5e2465246f8f1f1496378cf1aa0a17d  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64-unsigned.tar.gz
abe11fca087679bd12c9e9beece5c1f5ffabc030efd1e74f33eb9ffe22072132  guix-build-f1df4dd2878a/output/x86_64-w64-mingw32/bitcoin-f1df4dd2878a-win64.zip

@DrahtBot
Copy link
Contributor

Guix builds

File commit 5884a47
(master)
commit c382169
(master and this pull)
SHA256SUMS.part 72e5a914ec12fe31... 0082f9d2df506e9a...
*-aarch64-linux-gnu-debug.tar.gz 3f3d66875425c327... 044776c32044f2e0...
*-aarch64-linux-gnu.tar.gz 4172e8c70cf307aa... 45bcce1caa9d150f...
*-arm-linux-gnueabihf-debug.tar.gz 955f34d053c808ba... 00eae5ae4f49d5db...
*-arm-linux-gnueabihf.tar.gz 46054fdb70630827... 9511276ab91612cf...
*-arm64-apple-darwin-unsigned.dmg 8083222f1adba938... a411dddf075c74a0...
*-arm64-apple-darwin-unsigned.tar.gz 5cbc26b80f01b426... eb61d58bcbf1ec4d...
*-arm64-apple-darwin.tar.gz 81dfcabc0ea7bfd9... de498efcf549d71b...
*-powerpc64-linux-gnu-debug.tar.gz 5b2c72ea065b2315... 6b45565ba1439db2...
*-powerpc64-linux-gnu.tar.gz 3d34059ff2a4b372... dc61ffefae85c83d...
*-powerpc64le-linux-gnu-debug.tar.gz d4c8cb081ab82ef2... e587b3de2cd1a777...
*-powerpc64le-linux-gnu.tar.gz 4d9683362ca570a1... 9cc77bb2edb5de2e...
*-riscv64-linux-gnu-debug.tar.gz ebd6636d6b54c69d... 430e06c58effdc4c...
*-riscv64-linux-gnu.tar.gz 9c30c33e4c095c3d... 589a4d72c9a9eafc...
*-win64-debug.zip 5aa41d31b872e127... de5a34e3886c6211...
*-win64-setup-unsigned.exe c139a35251322bc1... 48664dd957ac335d...
*-win64-unsigned.tar.gz 8411990550d8b55d... 24c170c90bc80f2d...
*-win64.zip 0590f48d064ace10... 90d2595515ec48d4...
*-x86_64-apple-darwin-unsigned.dmg b94f59a7de5a0ba5... 1bed3f4c085403f5...
*-x86_64-apple-darwin-unsigned.tar.gz 64953822e080408b... 02cdf0be93e682d5...
*-x86_64-apple-darwin.tar.gz 7e390aeb7b66d44b... 3f22d72214596b18...
*-x86_64-linux-gnu-debug.tar.gz 974c7f24a340f7b5... c574007da7df2f7b...
*-x86_64-linux-gnu.tar.gz d80b19091ecdc53a... 64d51483ade21b44...
*.tar.gz 07404512520c48c4... d780bdb59111e2e5...
guix_build.log acee27bb7fe296b5... 20a1e1eff035b5be...
guix_build.log.diff 11e51f196e2caa7f...

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
@fanquake
Copy link
Member Author

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.

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24283 (build: Add show-% target for multi-line variables and debug info by hebasto)

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.

@laanwj
Copy link
Member

laanwj commented Jun 27, 2022

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).

@laanwj
Copy link
Member

laanwj commented Jun 27, 2022

Code review ACK 880d4aa

@laanwj laanwj merged commit fffff0a into bitcoin:master Jun 27, 2022
@fanquake fanquake deleted the libxkbcommon_gcc_12 branch June 27, 2022 09:17
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 27, 2022
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
knst pushed a commit to knst/dash that referenced this pull request Oct 25, 2022
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
PastaPastaPasta pushed a commit to knst/dash that referenced this pull request Nov 2, 2022
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
fanquake added a commit to bitcoin-core/gui that referenced this pull request Jan 31, 2023
…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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 31, 2023
…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
fanquake added a commit to fanquake/bitcoin that referenced this pull request Apr 17, 2023
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
fanquake added a commit that referenced this pull request May 1, 2023
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
@bitcoin bitcoin locked and limited conversation to collaborators Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants