cross compile problem with crypto-library=polarssl

This forum is for all inquiries relating to the installation of OpenVPN from source and with binaries.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please visit (and READ) the OpenVPN HowTo http://openvpn.net/howto prior to asking any questions in here!
Post Reply
aruim
OpenVpn Newbie
Posts: 3
Joined: Thu Apr 18, 2013 11:50 am

cross compile problem with crypto-library=polarssl

Post by aruim » Sat Apr 20, 2013 1:25 am

Hi


I can't cross compile openvpn with-crypto-library=polarssl according to https://community.openvpn.net/openvpn/w ... ericsubdir

./configure --prefix=/ --libdir=//lib --host=i686-w64-mingw32 --target= --build=x86_64-pc-linux-gnu --program-prefix='' --sbindir=/bin --with-crypto-library=polarssl TAP_CFLAGS="-I./include" POLARSSL_CFLAGS="-I/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/include" POLARSSL_LIBS="-L/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/lib/libpolarssl.a" --disable-lzo --disable-plugins


make install-strip DESTDIR="/home/reta/openvpn-build/generic/openvpn"


crypto_polarssl.o: In function `show_available_digests':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:174: undefined reference to `_md_list'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:186: undefined reference to `_md_info_from_type'
crypto_polarssl.o: In function `rand_ctx_get':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:235: undefined reference to `_entropy_init'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:237: undefined reference to `_entropy_func'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:237: undefined reference to `_ctr_drbg_init'
crypto_polarssl.o: In function `rand_ctx_enable_prediction_resistance':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:252: undefined reference to `_ctr_drbg_set_prediction_resistance'
crypto_polarssl.o: In function `rand_bytes':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:264: undefined reference to `_ctr_drbg_random'
crypto_polarssl.o: In function `key_des_check':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:312: undefined reference to `_des_key_check_weak'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:317: undefined reference to `_des_key_check_key_parity'
crypto_polarssl.o: In function `key_des_fixup':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:344: undefined reference to `_des_key_set_parity'
crypto_polarssl.o: In function `cipher_kt_get':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:362: undefined reference to `_cipher_info_from_string'
crypto_polarssl.o: In function `show_available_ciphers':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:147: undefined reference to `_cipher_list'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:160: undefined reference to `_cipher_info_from_type'
crypto_polarssl.o: In function `cipher_ctx_init':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:435: undefined reference to `_cipher_init_ctx'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:438: undefined reference to `_cipher_setkey'
crypto_polarssl.o: In function `cipher_ctx_reset':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:469: undefined reference to `_cipher_reset'
crypto_polarssl.o: In function `cipher_ctx_update':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:478: undefined reference to `_cipher_update'
crypto_polarssl.o: In function `cipher_ctx_final':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:490: undefined reference to `_cipher_finish'
crypto_polarssl.o: In function `cipher_des_encrypt_ecb':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:503: undefined reference to `_des_setkey_enc'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:504: undefined reference to `_des_crypt_ecb'
crypto_polarssl.o: In function `md_kt_get':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:522: undefined reference to `_md_info_from_string'
crypto_polarssl.o: In function `md_full':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:558: undefined reference to `_md'
crypto_polarssl.o: In function `md_ctx_init':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:569: undefined reference to `_md_init_ctx'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:570: undefined reference to `_md_starts'
crypto_polarssl.o: In function `md_ctx_update':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:589: undefined reference to `_md_update'
crypto_polarssl.o: In function `md_ctx_final':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:595: undefined reference to `_md_finish'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:596: undefined reference to `_md_free_ctx'
crypto_polarssl.o: In function `hmac_ctx_init':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:617: undefined reference to `_md_init_ctx'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:618: undefined reference to `_md_hmac_starts'
crypto_polarssl.o: In function `hmac_ctx_cleanup':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:627: undefined reference to `_md_free_ctx'
crypto_polarssl.o: In function `hmac_ctx_reset':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:641: undefined reference to `_md_hmac_reset'
crypto_polarssl.o: In function `hmac_ctx_update':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:647: undefined reference to `_md_hmac_update'
crypto_polarssl.o: In function `hmac_ctx_final':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:653: undefined reference to `_md_hmac_finish'
crypto_polarssl.o: In function `cipher_ctx_cleanup':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/crypto_polarssl.c:447: undefined reference to `_cipher_free_ctx'
ssl_polarssl.o: In function `tls_ctx_free':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:106: undefined reference to `_rsa_free'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:109: undefined reference to `_x509_free'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:112: undefined reference to `_x509_free'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:115: undefined reference to `_dhm_free'
ssl_polarssl.o: In function `tls_ctx_restrict_ciphers':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:191: undefined reference to `_ssl_get_ciphersuite_id'
ssl_polarssl.o: In function `tls_ctx_load_dh_params':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:207: undefined reference to `_x509parse_dhm'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:212: undefined reference to `_x509parse_dhmfile'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:216: undefined reference to `_mpi_size'
ssl_polarssl.o: In function `tls_ctx_load_cert_file':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:250: undefined reference to `_x509parse_crt'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:256: undefined reference to `_x509parse_crtfile'
ssl_polarssl.o: In function `tls_ctx_load_priv_file':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:281: undefined reference to `_x509parse_key'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:295: undefined reference to `_x509parse_keyfile'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:300: undefined reference to `_x509parse_keyfile'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:288: undefined reference to `_x509parse_key'
ssl_polarssl.o: In function `tls_ctx_load_ca':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:350: undefined reference to `_x509parse_crtfile'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:344: undefined reference to `_x509parse_crt'
ssl_polarssl.o: In function `tls_ctx_load_extra_certs':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:364: undefined reference to `_x509parse_crt'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:370: undefined reference to `_x509parse_crtfile'
ssl_polarssl.o: In function `tls_ctx_personalise_random':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:495: undefined reference to `_sha2'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:498: undefined reference to `_ctr_drbg_update'
ssl_polarssl.o: In function `key_state_ssl_init':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:512: undefined reference to `_ssl_init'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:515: undefined reference to `_ssl_set_dbg'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:516: undefined reference to `_ssl_set_endpoint'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:518: undefined reference to `_ctr_drbg_random'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:518: undefined reference to `_ssl_set_rng'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:521: undefined reference to `_ssl_set_ciphersuites'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:533: undefined reference to `_ssl_set_own_cert'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:536: undefined reference to `_ssl_set_authmode'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:537: undefined reference to `_ssl_set_verify'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:539: undefined reference to `_ssl_set_ca_chain'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:544: undefined reference to `_ssl_set_bio'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:525: undefined reference to `_ssl_set_dh_param_ctx'
ssl_polarssl.o: In function `key_state_ssl_free':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:555: undefined reference to `_ssl_free'
ssl_polarssl.o: In function `key_state_write_plaintext':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:586: undefined reference to `_ssl_write'
ssl_polarssl.o: In function `key_state_write_plaintext_const':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:633: undefined reference to `_ssl_write'
ssl_polarssl.o: In function `key_state_read_ciphertext':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:692: undefined reference to `_error_strerror'
ssl_polarssl.o: In function `key_state_read_plaintext':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:783: undefined reference to `_ssl_read'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:790: undefined reference to `_error_strerror'
ssl_polarssl.o: In function `print_details':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:827: undefined reference to `_ssl_get_ciphersuite'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:827: undefined reference to `_ssl_get_version'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:832: undefined reference to `_ssl_get_peer_cert'
ssl_polarssl.o: In function `show_available_tls_ciphers':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:851: undefined reference to `_ssl_default_ciphersuites'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:851: undefined reference to `_ssl_default_ciphersuites'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:853: undefined reference to `_ssl_get_ciphersuite_name'
ssl_polarssl.o: In function `get_highest_preference_tls_cipher':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:864: undefined reference to `_ssl_default_ciphersuites'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:867: undefined reference to `_ssl_get_ciphersuite_name'
ssl_polarssl.o: In function `tls_ctx_free_cert_file':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_polarssl.c:268: undefined reference to `_x509_free'
ssl_verify_polarssl.o: In function `x509_get_serial':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:134: undefined reference to `_x509parse_serial_gets'
ssl_verify_polarssl.o: In function `x509_get_sha1_hash':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:144: undefined reference to `_sha1'
ssl_verify_polarssl.o: In function `x509_get_subject':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:156: undefined reference to `_x509parse_dn_gets'
ssl_verify_polarssl.o: In function `x509_verify_cert_eku':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:330: undefined reference to `_x509_oid_get_description'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:342: undefined reference to `_x509_oid_get_numeric_string'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:330: undefined reference to `_x509_oid_get_description'
ssl_verify_polarssl.o: In function `x509_verify_crl':
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:376: undefined reference to `_x509parse_crlfile'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:401: undefined reference to `_x509_crl_free'
/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn/ssl_verify_polarssl.c:391: undefined reference to `_x509parse_revoked'
collect2: ld returned 1 exit status
make[4]: *** [openvpn.exe] Error 1
make[4]: Leaving directory `/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src/openvpn'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1/src'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/home/reta/openvpn-build/generic/tmp/openvpn-2.3.1'
make: *** [install-strip] Error 2


Compiling without host parameter is fine.

anyway to cross compile openvpn with polarssl enabled?

syzzer
Developer
Posts: 2
Joined: Mon Apr 22, 2013 11:37 am

Re: cross compile problem with crypto-library=polarssl

Post by syzzer » Mon Apr 22, 2013 12:31 pm

Hi arium,

I can compile 2.3.1 with --host=i686-w64-mingw32 and --with-crypto-library=polarssl with the following flags:

Code: Select all

CFLAGS="-O2 -I$(pwd)/<tap-source-dir>/src/" \
POLARSSL_CFLAGS="-I<polarssl-source-dir>/include" \
POLARSSL_LIBS="-L<polarssl-build-dir>/library -lpolarssl" \
./configure \
--host=i686-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--with-crypto-library=polarssl \
--disable-lzo \
--disable-plugins
When I remove the -lpolarssl from the POLARSSL_LIBS, I get the same indefined reference errors you get.

What I also noticed, your POLARSSL_CFLAGS include dir (-I) seems to point to the openvpn include dir rather than the polarssl include dir. Finally, the -L in your POLARSSL_LIBS points to the libpolarssl.a file, whereas I believe the -L should point to the directory where the libpolarssl.a file resides.

aruim
OpenVpn Newbie
Posts: 3
Joined: Thu Apr 18, 2013 11:50 am

Re: cross compile problem with crypto-library=polarssl

Post by aruim » Mon Apr 22, 2013 9:44 pm

Thanks for your help :)

Your reply helped me a lot.

Instead of "make && make install", I compiled polarssl with this command:

Code: Select all

make  AR=i686-w64-mingw32-ar   CC=i686-w64-mingw32-gcc
and now problem solved :D

I'm going to cross compile polarssl for openvpn x64 with:

Code: Select all

make AR=x86_64-w64-mingw32-ar   CC=x86_64-w64-mingw32-gcc
I hope it's ok, if It's wrong please tell me.

Best Regards

aruim
OpenVpn Newbie
Posts: 3
Joined: Thu Apr 18, 2013 11:50 am

Re: cross compile problem with crypto-library=polarssl

Post by aruim » Fri Apr 26, 2013 1:59 pm

I was able to compile openvpn in open-build script with:

Code: Select all

	echo "Build polarssl"
	cd "${BUILDROOT}/polarssl"* || die "cd polarssl"
	${MAKE} lib AR=${CHOST}-ar CC=${CHOST}-gcc \
		|| die "make polarssl"
	${MAKE} install DESTDIR="${OPENVPN_ROOT}" \
		|| die "make install polarssl"
	fixup_la

Post Reply