From: Tobias Brunner Date: Fri, 3 Mar 2023 12:02:44 +0000 (+0100) Subject: appveyor: Fix LDFLAGS for Windows build X-Git-Tag: 5.9.11dr1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d250620970c3d3569591d8c75a4153edcc592588;p=thirdparty%2Fstrongswan.git appveyor: Fix LDFLAGS for Windows build With newer OpenSSL builds, the DLL files contain parts of the version number and the architecture in their name, e.g. for OpenSSL 1.1.1 the DLL for libcrypto is called libcrypto-1_1-x64.dll. So referencing that directly could be kinda tricky. And by using `-lcrypto` we therefore didn't link those DLLs but the OpenSSL version installed by msys2. Since the latter ships OpenSSL 3 since January and the VS 2019 image was updated recently, our builds broke as we used the headers from the 1.1.1 installation but then tried to link OpenSSL 3. Luckily, in the lib/ directory of the OpenSSL installation, there is a libcrypto.lib file, which is an import library (containing the symbols and a reference to the DLL). We can use that to link the right library via `-lcrypto`. With the old OpenSSL 1.0.2 build on the VS 2015 image, there is also such a .lib file but it seems the linker is too old or otherwise incapable of finding the DLL. But since the DLL is just called libeay32.dll there, we use that directly and don't reference the lib/ dir. Also removed a superfluous AC_MSG_RESULT() if libeay32 isn't found. --- diff --git a/configure.ac b/configure.ac index 8fb048e581..541a5877d0 100644 --- a/configure.ac +++ b/configure.ac @@ -1169,7 +1169,7 @@ if test x$openssl = xtrue; then if test "x$windows" = xtrue; then openssl_lib=eay32 AC_CHECK_LIB([$openssl_lib],[EVP_CIPHER_CTX_new],[LIBS="$LIBS"], - [AC_MSG_RESULT([no]);openssl_lib=""],[$DLLIB]) + [openssl_lib=""],[$DLLIB]) fi if test -z "$openssl_lib"; then openssl_lib=crypto diff --git a/scripts/test.sh b/scripts/test.sh index 5e15f0af84..6b2e8caa12 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -286,17 +286,23 @@ win*) if test "$APPVEYOR" != "True"; then TARGET= else + CONFIG="$CONFIG --enable-openssl" case "$IMG" in 2015|2017) # old OpenSSL versions don't provide HKDF CONFIG="$CONFIG --enable-kdf" ;; esac - CONFIG="$CONFIG --enable-openssl" + CFLAGS="$CFLAGS -I$OPENSSL_DIR/include" - LDFLAGS="-L$OPENSSL_DIR" + LDFLAGS="-L$OPENSSL_DIR/lib" + case "$IMG" in + 2015) + # gcc/ld might be too old to find libeay32 via .lib instead of .dll + LDFLAGS="-L$OPENSSL_DIR" + ;; + esac export LDFLAGS - fi CFLAGS="$CFLAGS -mno-ms-bitfields" DEPS="gcc-mingw-w64-base"