Open ryandesign opened 2 years ago
This is fixed now with commit 3e9100c.
CXXFLAGS
is not used for linking, though, as that would add compile-time flags to the linker command line. To use an alternative stdlib, the -stdlib
option should be added to both, CXXFLAGS
and LDFLAGS
.
The build system uses the C compiler as the linker and adds the flag
-lstdc++
, for example:This is wrong because the C++ standard library being used might not be libstdc++; the default C++ standard library on macOS has been libc++ since OS X 10.9. Because this mistake is so common the linker seems to silently transform
-lstdc++
to-lc++
to correct the problem, but it would be better not to make the mistake in the first place.Usually, when you're linking stuff that came from C++ code, I've seen projects use the C++ compiler (not the C compiler) as the linker; that way, you don't have to specify to link with a C++ standard library. Make sure to use the
CXXFLAGS
environment variable when you do so in case the user has specified a-stdlib
flag there that differs from what the default C++ standard library is.