Skip to content

Commit

Permalink
depends: For mingw cross compile use -gcc-posix to prevent library co…
Browse files Browse the repository at this point in the history
…nflict

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.
  • Loading branch information
laanwj committed Oct 1, 2024
1 parent fc642c3 commit ae56b32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions depends/hosts/mingw32.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit ae56b32

Please sign in to comment.