34b1a3cc创建于 2023年11月30日历史提交
diff --color -Nar ghc-9.6.3-orig/m4/fp_find_cxx_std_lib.m4 ghc-9.6.3/m4/fp_find_cxx_std_lib.m4

Workaround for bugs in m4/fp_find_cxx_std_lib.m4

According to ghc maintainer, there was originally designed for detecting which libcxx
was used. However under EulerMaker environment, this detection failed like this:

checking C++ standard library flavour... libstdc++
checking for linkage against 'stdc++'... failed
checking for linkage against 'stdc++ supc++'... failed
configure: error: Failed to find C++ standard library

its actually caused by this error:

ld: warning: libm.so.6, needed by libstdc++.so, not found (try using -rpath or -rpath-link)
ld: libstdc++.so: undefined reference to `fesetround@GLIBC_2.2.5'
ld: libstdc++.so: undefined reference to `fegetround@GLIBC_2.2.5'

Upstream Issue URL: https://gitlab.haskell.org/ghc/ghc/-/issues/23118
Upstream Pull Request URL: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10116
===================================================================
--- ghc-9.6.3-orig/m4/fp_find_cxx_std_lib.m4
+++ ghc-9.6.3/m4/fp_find_cxx_std_lib.m4
@@ -51,9 +51,9 @@
         fi

         try_libs() {
-            dnl Try to link a plain object with CC manually
+            dnl Try to link a plain object with CXX manually
             AC_MSG_CHECKING([for linkage against '${3}'])
-            if "$CC" -o actest actest.o ${1} 2>/dev/null; then
+            if "$CXX" -o actest actest.o ${1} 2>/dev/null; then
                 CXX_STD_LIB_LIBS="${3}"
                 p="`"$CXX" --print-file-name ${2}`"
                 d="`dirname "$p"`"