diff options
author | Ben Gamari <ben@well-typed.com> | 2022-05-19 16:38:25 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-07-14 19:49:10 -0400 |
commit | 2b7d4b00f1d00ed40df9a58044a13c541e8c7f3a (patch) | |
tree | ca2a88a5f356303fce9d7f191fc235cc1c6e896d /m4 | |
parent | a13959843a9f165750202676d7a652b79ee49148 (diff) | |
download | haskell-2b7d4b00f1d00ed40df9a58044a13c541e8c7f3a.tar.gz |
Statically-link against libc++ on Windows
Unfortunately on Windows we have no RPATH-like facility, making dynamic
linking extremely fragile. Since we cannot assume that the user will
add their GHC installation to `$PATH` (and therefore their DLL
search path) we cannot assume that the loader will be able to locate our
`libc++.dll`. To avoid this, we instead statically link against `libc++.a` on
Windows.
Fixes #21435.
(cherry picked from commit 91a6d53ba77ce7d977b137b69690567dd9f92d98)
Diffstat (limited to 'm4')
-rw-r--r-- | m4/fp_setup_windows_toolchain.m4 | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/m4/fp_setup_windows_toolchain.m4 b/m4/fp_setup_windows_toolchain.m4 index 79a6ac6531..5fdac70113 100644 --- a/m4/fp_setup_windows_toolchain.m4 +++ b/m4/fp_setup_windows_toolchain.m4 @@ -78,6 +78,7 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[ # for the runtime, libc++ and libc++abi for the C++ standard library # implementation, and libunwind for C++ unwinding. mingwbin="$hardtop/inplace/mingw/bin/" + mingwlib="$hardtop/inplace/mingw/lib/" CC="${mingwbin}clang.exe" CXX="${mingwbin}clang++.exe" @@ -94,6 +95,12 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[ CONF_GCC_LINKER_OPTS_STAGE1="-fuse-ld=lld $cflags" CONF_GCC_LINKER_OPTS_STAGE2="-fuse-ld=lld $cflags" + # N.BOn Windows we can't easily dynamically-link against libc++ since there is + # no RPATH support, meaning that the loader will have no way of finding our + # libc++.dll + CXX_STD_LIB_LIBS=":libc++.a :libc++abi.a" + CXX_STD_LIB_LIB_DIRS="\$topdir" + LD="${mingwbin}ld.lld.exe" NM="${mingwbin}llvm-nm.exe" AR="${mingwbin}llvm-ar.exe" |