From 38f500f1c9a4e6e42ac5a7b348eba9148c66d15a Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Tue, 21 Sep 2021 09:20:56 +0200 Subject: [PATCH] - For crosscompile on windows, detect 64bit stackprotector library. --- doc/Changelog | 3 +++ makedist.sh | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index fac757c5f..59864127e 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +21 September 2021: Wouter + - For crosscompile on windows, detect 64bit stackprotector library. + 20 September 2021: Wouter - Fix crosscompile on windows to work with openssl 3.0.0 the link with ws2_32 needs -l:libssp.a for __strcpy_chk. diff --git a/makedist.sh b/makedist.sh index 341055d0f..cfe2d727a 100755 --- a/makedist.sh +++ b/makedist.sh @@ -271,8 +271,18 @@ if [ "$DOWIN" = "yes" ]; then else sslflags="no-asm -DOPENSSL_NO_CAPIENG mingw" fi + if test "$W64" = "yes" -a -f /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libssp-0.dll; then + # stack protector lib needs to link in to make + # -lws2_32 work in openssl link stage + SSPLIB="__CNF_LDLIBS=-l:libssp.a" + else + # disable SSPLIB for 32bit or if no such file + SSPLIB="" + fi info "winssl: Configure no-shared $sslflags" - __CNF_LDLIBS=-l:libssp.a CC=${warch}-w64-mingw32-gcc AR=${warch}-w64-mingw32-ar RANLIB=${warch}-w64-mingw32-ranlib WINDRES=${warch}-w64-mingw32-windres ./Configure --prefix="$sslinstall" no-shared $sslflags || error_cleanup "OpenSSL Configure failed" + set -x # echo the configure command + $SSPLIB CC=${warch}-w64-mingw32-gcc AR=${warch}-w64-mingw32-ar RANLIB=${warch}-w64-mingw32-ranlib WINDRES=${warch}-w64-mingw32-windres ./Configure --prefix="$sslinstall" no-shared $sslflags || error_cleanup "OpenSSL Configure failed" + set +x info "winssl: make" make $MINJ || error_cleanup "OpenSSL crosscompile failed" # only install sw not docs, which take a long time. @@ -285,7 +295,9 @@ if [ "$DOWIN" = "yes" ]; then sslsharedinstall="`pwd`/sslsharedinstall" cd openssl_shared info "winssl: Configure shared $sslflags" - __CNF_LDLIBS=-l:libssp.a CC=${warch}-w64-mingw32-gcc AR=${warch}-w64-mingw32-ar RANLIB=${warch}-w64-mingw32-ranlib WINDRES=${warch}-w64-mingw32-windres ./Configure --prefix="$sslsharedinstall" shared $sslflags || error_cleanup "OpenSSL Configure failed" + set -x # echo the configure command + $SSPLIB CC=${warch}-w64-mingw32-gcc AR=${warch}-w64-mingw32-ar RANLIB=${warch}-w64-mingw32-ranlib WINDRES=${warch}-w64-mingw32-windres ./Configure --prefix="$sslsharedinstall" shared $sslflags || error_cleanup "OpenSSL Configure failed" + set +x info "winssl: make" make $MINJ || error_cleanup "OpenSSL crosscompile failed" info "winssl: make install_sw"