From 808a3cb16daf2d7238aa24fccecaaa0398fe13fa Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Mon, 20 Sep 2021 17:52:34 +0200 Subject: [PATCH] - Fix crosscompile on windows to work with openssl 3.0.0 the link with ws2_32 needs -l:libssp.a for __strcpy_chk. Also copy results from lib64 directory if needed. --- doc/Changelog | 5 +++++ makedist.sh | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index db318455a..fac757c5f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,8 @@ +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. + Also copy results from lib64 directory if needed. + 10 September 2021: Wouter - Fix initialisation errors reported by gcc sanitizer. - Fix lock debug code for gcc sanitizer reports. diff --git a/makedist.sh b/makedist.sh index 6b7e0a83d..341055d0f 100755 --- a/makedist.sh +++ b/makedist.sh @@ -272,7 +272,7 @@ if [ "$DOWIN" = "yes" ]; then sslflags="no-asm -DOPENSSL_NO_CAPIENG mingw" fi info "winssl: Configure no-shared $sslflags" - 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" + __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" info "winssl: make" make $MINJ || error_cleanup "OpenSSL crosscompile failed" # only install sw not docs, which take a long time. @@ -285,7 +285,7 @@ if [ "$DOWIN" = "yes" ]; then sslsharedinstall="`pwd`/sslsharedinstall" cd openssl_shared info "winssl: Configure shared $sslflags" - 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" + __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" info "winssl: make" make $MINJ || error_cleanup "OpenSSL crosscompile failed" info "winssl: make install_sw" @@ -415,7 +415,18 @@ if [ "$DOWIN" = "yes" ]; then cp ../doc/example.conf ../doc/Changelog . cp ../unbound.exe ../unbound-anchor.exe ../unbound-host.exe ../unbound-control.exe ../unbound-checkconf.exe ../unbound-service-install.exe ../unbound-service-remove.exe ../LICENSE ../winrc/unbound-control-setup.cmd ../winrc/unbound-website.url ../winrc/service.conf ../winrc/README.txt ../contrib/create_unbound_ad_servers.cmd ../contrib/warmup.cmd ../contrib/unbound_cache.cmd . mkdir libunbound - cp ../../unbound_shared/unbound.h ../../unbound_shared/.libs/libunbound*.dll ../../unbound_shared/.libs/libunbound.dll.a ../../unbound_shared/.libs/libunbound.a ../../unbound_shared/.libs/libunbound*.def ../../sslsharedinstall/lib/libcrypto.dll.a ../../sslsharedinstall/lib/libssl.dll.a ../../sslsharedinstall/bin/libcrypto*.dll ../../sslsharedinstall/bin/libssl*.dll ../../wxpinstall/bin/libexpat*.dll ../../wxpinstall/lib/libexpat.dll.a libunbound/. + # test to see if lib or lib64 (for openssl 3.0.0) needs to be used + if test -f ../../sslsharedinstall/lib/libcrypto.dll.a; then + cp ../../sslsharedinstall/lib/libcrypto.dll.a libunbound/. + else + cp ../../sslsharedinstall/lib64/libcrypto.dll.a libunbound/. + fi + if test -f ../../sslsharedinstall/lib/libssl.dll.a; then + cp ../../sslsharedinstall/lib/libssl.dll.a libunbound/. + else + cp ../../sslsharedinstall/lib64/libssl.dll.a libunbound/. + fi + cp ../../unbound_shared/unbound.h ../../unbound_shared/.libs/libunbound*.dll ../../unbound_shared/.libs/libunbound.dll.a ../../unbound_shared/.libs/libunbound.a ../../unbound_shared/.libs/libunbound*.def ../../sslsharedinstall/bin/libcrypto*.dll ../../sslsharedinstall/bin/libssl*.dll ../../wxpinstall/bin/libexpat*.dll ../../wxpinstall/lib/libexpat.dll.a libunbound/. if test "$W64" = "no"; then # Disable stack-protector for 32-bit windows builds. # cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll libunbound/.