configure fails to find stdc++ library; can't build ghc.
when trying to run ./configure
on linux it fails with:
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
After some printf debugging we can see that the failure is due to
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'
We appear to be using $CC
trying to reproduce the required linking flags for a c++ program.
Replacing $CC with $CXX as in !10116 (closed) clearly "fixes" the issue; but as pointed out by @mpickering does not really result in the solution we want. (That is figure out how to make $CC behave as cpp linker).