openvpn-build icon indicating copy to clipboard operation
openvpn-build copied to clipboard

cross-compiling Win32 build on Ubuntu 16.04 fails if DO_REALLY_STATIC=1

Open johnmah opened this issue 8 years ago • 6 comments

Fails with:

...
configure: WARNING: tap-windows.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: tap-windows.h: proceeding with the compiler's result
checking for tap-windows.h... yes
checking whether TUNSETPERSIST is declared... no
checking for setcon in -lselinux... no
checking for pam_start in -lpam... no
checking for PKCS11_HELPER... yes
checking for SSL_CTX_new... no
configure: error: openssl check failed
FATAL: Configure openvpn

This previously worked for me for OpenVPN 2.3.10 w/ OpenSSL 1.0.2k. Also current master builds fine without DO_REALLY_STATIC variable set. FWIW, also fails on Ubuntu 14.04.

I've attached output for the build process when DO_REALLY_STATIC is set.

openvpn-build-output.txt

johnmah avatar Oct 20 '17 18:10 johnmah

Thank you for reporting, I'll have a look soon

chipitsine avatar Oct 21 '17 04:10 chipitsine

it seems, there's no easy way to get DO_REALLY_STATIC back it is broken for a long time

you are the only person who complains on that. can please describe your use case ?

chipitsine avatar Oct 21 '17 17:10 chipitsine

it does not work even for openvpn-2.3.10 + openssl-1.0.2k

git clone -b release/2.3 https://github.com/OpenVPN/openvpn-build.git
cd openvpn-build/generic
IMAGEROOT=`pwd`/image-win32 DO_REALLY_STATIC=1 CHOST=i686-w64-mingw32 OPENSSL_VERSION=1.0.2k OPENVPN_VERSION=2.3.10 OPENVPN_URL=http://openvpn.skbkontur.ru/openvpn-2.3.10.tar.gz CBUILD=x86_64-pc-linux-gnu ./build
....
ssl_openssl.o:ssl_openssl.c:(.text+0x2bcb): undefined reference to `SSL_CTX_free'
ssl_openssl.o:ssl_openssl.c:(.text+0x2bd9): undefined reference to `SSLv23_method'
ssl_openssl.o:ssl_openssl.c:(.text+0x2be1): undefined reference to `SSL_CTX_new'
ssl_openssl.o:ssl_openssl.c:(.text+0x2c25): undefined reference to `SSL_new'
ssl_openssl.o:ssl_openssl.c:(.text+0x2c71): undefined reference to `SSL_get_cipher_list'
ssl_openssl.o:ssl_openssl.c:(.text+0x2c98): undefined reference to `SSL_free'
ssl_openssl.o:ssl_openssl.c:(.text+0x2ca3): undefined reference to `SSL_CTX_free'
ssl_verify_openssl.o:ssl_verify_openssl.c:(.text+0xeb): undefined reference to `SSL_get_ex_data_X509_STORE_CTX_idx'
ssl_verify_openssl.o:ssl_verify_openssl.c:(.text+0x133): undefined reference to `SSL_get_ex_data'
cryptoapi.o:cryptoapi.c:(.text+0xd18): undefined reference to `SSL_CTX_use_certificate'
cryptoapi.o:cryptoapi.c:(.text+0xd92): undefined reference to `SSL_CTX_use_RSAPrivateKey'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:549: openvpn.exe] Error 1
make[4]: Leaving directory '/home/ilia/openvpn-build/generic/tmp/openvpn-2.3.10/src/openvpn'
make[3]: *** [Makefile:401: install-recursive] Error 1
make[3]: Leaving directory '/home/ilia/openvpn-build/generic/tmp/openvpn-2.3.10/src'
make[2]: *** [Makefile:583: install-recursive] Error 1
make[2]: Leaving directory '/home/ilia/openvpn-build/generic/tmp/openvpn-2.3.10'
make[1]: *** [Makefile:880: install] Error 2
make[1]: Leaving directory '/home/ilia/openvpn-build/generic/tmp/openvpn-2.3.10'
make: *** [Makefile:890: install-strip] Error 2
FATAL: make openvpn

can you tell, how did you build it?

chipitsine avatar Oct 22 '17 15:10 chipitsine

it also does not build on https://github.com/OpenVPN/openvpn-build/tree/62f2220016fbb696fe6fcab51ee2e9c35ee5a04e

chipitsine avatar Oct 22 '17 18:10 chipitsine

we would like to use a static Windows build so that the OpenSSL/LZO DLLs don't need to be installed or distributed.

the following diff fixed the build issue with 1.0.2l against 2.3.10 with your above build command:

vagrant@vagrant:~/openvpn-build/generic$ git diff
diff --git a/generic/build b/generic/build
index d21e97b..5a5431c 100755
--- a/generic/build
+++ b/generic/build
@@ -383,7 +383,7 @@ fi
 # OpenVPN-GUI build expects the OPENSSL_CRYPTO_* variables to be set, even
 # though they were removed from openvpn/configure.ac by commit 31b0bebe.
 export OPENSSL_CRYPTO_CFLAGS="-I${OPENVPN_ROOT}/include"
-export OPENSSL_CRYPTO_LIBS="-L${OPENVPN_ROOT}/lib -lcrypto"
+export OPENSSL_CRYPTO_LIBS="-L${OPENVPN_ROOT}/lib -lssl -lcrypto"
 export OPENSSL_CFLAGS="-I${OPENVPN_ROOT}/include"
 export OPENSSL_LIBS="-L${OPENVPN_ROOT}/lib -lssl -lcrypto"
 export LZO_CFLAGS="-I${OPENVPN_ROOT}/include"

(it still breaks when compiling against 2.4.4 though)

johnmah avatar Oct 23 '17 17:10 johnmah

this issue might be closed

chipitsine avatar Nov 19 '17 08:11 chipitsine