Skip to content

Commit 7fec638

Browse files
laanwjfanquake
authored andcommitted
depends: For mingw cross compile use -gcc-posix to prevent library conflict
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. Github-Pull: bitcoin#31013 Rebased-From: ae56b32
1 parent f998ac6 commit 7fec638

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

depends/hosts/mingw32.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-gcc-posix"),)
2+
mingw32_CC := $(host)-gcc-posix
3+
endif
14
ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
25
mingw32_CXX := $(host)-g++-posix
36
endif

0 commit comments

Comments
 (0)