unix-adapter: Link statically with cyggcc_s-1.dll and cygstdc++-6.dll.
* At least for now, I'm shipping Cygwin/MSYS binaries. On Cygwin (but not MSYS), the console.exe executable previously linked dynamically to cyggcc_s-1.dll and cygstdc++-6.dll. Linking dynamically with cygstdc++-6.dll seems risky for a binary not distributed by Cygwin, because G++'s Windows ABI is unstable, at least as of G++ 4.7, which turned on the __thiscall calling convention. If a binary I ship ever comes into contact with a 4.7-versioned cygstdc++-6.dll, then my binary will (very likely) segfault. So far, I've only observed this ABI incompatibility with MinGW, where a sufficiently upgraded MinGW configuration comes with a libstdc++-6.dll that is completely incompatible with every previous libstdc++-6.dll, so that every program built against the older libstdc++-6.dll segfaults immediately. For now, Cygwin seems stuck at G++ 4.5, and my impression (possibly incorrect), is that G++'s Windows ABI was stable prior to 4.7. I think G++'s Linux ABI is stable. Presumably Cygwin will eventually update its compiler, though, so it makes sense to fix the problem early. I believe I originally chose to dynamically link the libraries because it was the default behavior, and I was afraid that a non-default option would break something. It turns out that linking statically with cygstdc++-6 *does* break something -- it causes linker errors if the code uses std::cerr. The workaround is not to use std::cerr. This is not a problem for the unix-adapter, which already has to put up with MSYS' gimpy G++ 3.4 compiler.
This commit is contained in:
parent
bb42d17941
commit
549472ec78
5
configure
vendored
5
configure
vendored
@ -54,12 +54,16 @@ case $(uname -s) in
|
||||
IS_CYGWIN=1
|
||||
UNIX_GPP=i686-pc-cygwin-g++
|
||||
MINGW_GPP="i686-pc-mingw32-g++ i686-w64-mingw32-g++"
|
||||
UNIX_LDFLAGS_STATIC_LIBSTDCXX="-static-libgcc -static-libstdc++"
|
||||
;;
|
||||
MINGW*)
|
||||
echo 'uname -s identifies a MSYS environment.'
|
||||
IS_MSYS=1
|
||||
UNIX_GPP=i686-pc-msys-g++
|
||||
MINGW_GPP=mingw32-g++
|
||||
# The MSYS compiler does not recognize -static-libstdc++. There is a
|
||||
# msys-1.0.dll, but no gcc or stdc++ DLL.
|
||||
UNIX_LDFLAGS_STATIC_LIBSTDCXX=
|
||||
;;
|
||||
*)
|
||||
echo 'Error: uname -s did not match either CYGWIN* or MINGW*.'
|
||||
@ -76,5 +80,6 @@ MINGW_GPP=$FINDTOOL_OUT
|
||||
# Write config files.
|
||||
echo Writing config-unix.mk
|
||||
echo CXX=$UNIX_GPP > config-unix.mk
|
||||
echo LDFLAGS_STATIC_LIBSTDCXX=$UNIX_LDFLAGS_STATIC_LIBSTDCXX >> config-unix.mk
|
||||
echo Writing config-mingw.mk
|
||||
echo CXX=$MINGW_GPP > config-mingw.mk
|
||||
|
@ -24,7 +24,7 @@ include ../config-unix.mk
|
||||
PROGRAM = ../build/console.exe
|
||||
OBJECTS = main.o Shared.o
|
||||
CXXFLAGS += -I../include
|
||||
LDFLAGS += ../build/winpty.dll
|
||||
LDFLAGS += $(LDFLAGS_STATIC_LIBSTDCXX) ../build/winpty.dll
|
||||
|
||||
all : $(PROGRAM)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user