diff options
author | merge-script <fanquake@gmail.com> | 2024-10-08 15:22:53 +0100 |
---|---|---|
committer | merge-script <fanquake@gmail.com> | 2024-10-08 15:22:53 +0100 |
commit | 3c4a9419dbe539c280c101e4e81c0c83c38383e6 (patch) | |
tree | 1e6845547a89b35f174356ad7ecdfef0e81f7838 | |
parent | 5d5cc021ce3cceae551ceb31123ecb672cb639a1 (diff) | |
parent | ae56b3230b287eef5a5657d3089abebffde51484 (diff) |
Merge bitcoin/bitcoin#31013: depends: For mingw cross compile use -gcc-posix to prevent library conflict
ae56b3230b287eef5a5657d3089abebffde51484 depends: For mingw cross compile use -gcc-posix to prevent library conflict (laanwj)
Pull request description:
CMake parses some paths from the spec of the C compiler, assuming it will be the linker, resulting in the link to end up with `-L/usr/lib/gcc/x86_64-w64-mingw32/12-win32` on debian bookworm if both `-win32` and `-posix` variants are installed, and `-win32` is the default alternative.
This results in the wrong C++ library being linked, missing std::threads::hardware_concurrency and other threading functions.
To fix this, use the `-posix` variant of gcc as well when available. This fixes a regression compared to autotools, where this scenario worked.
ACKs for top commit:
theuni:
utACK ae56b3230b287eef5a5657d3089abebffde51484.
hebasto:
ACK ae56b3230b287eef5a5657d3089abebffde51484. I've tested on both Debian Bookworm and Ubuntu 24.04 with the `g++-mingw-w64-x86-64` package installed. The resulting CMake internal configuration appears more accurate. For instance, on Ubuntu 24.04, for the `bitcoin-tx` target, the diff in `build/src/CMakeFiles/bitcoin-tx.dir/linkLibs.rsp` looks as follows:
Tree-SHA512: f36fae50f91a29f565940494af9e46f47e219b99e329c0714ace47c516ac524602d5b6538a07488157bc2a71be7bac72176097fff3178129c5084bf6cc823167
-rw-r--r-- | depends/hosts/mingw32.mk | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk index c09f7b1e3a..755d7aebe4 100644 --- a/depends/hosts/mingw32.mk +++ b/depends/hosts/mingw32.mk @@ -1,3 +1,6 @@ +ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-gcc-posix"),) +mingw32_CC := $(host)-gcc-posix +endif ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),) mingw32_CXX := $(host)-g++-posix endif |