Opened 10 years ago

Last modified 7 years ago

#1237 closed defect (Fixed)

Tor 0.2.2.8-alpha doesn't compile with CFLAGS=-static for a static binary

Reported by: Tas Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.2.7-alpha
Severity: Keywords:
Cc: Tas, Sebastian, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I think I found a little problem with Tor 0.2.2.8-alpha. I compile my Tor static with "env CFLAGS=-static ./configure && make",
which worked fine so far, and which is described like this on the wiki. Worked fine until 0.2.2.7-alpha. With 0.2.2.8-alpha as well
as with the latest git version, on both OpenBSD 4.7-beta and FreeBSD 8.0, I get this error (from OpenBSD with latest git version):

http://pastebin.ca/1774260

$ env CFLAGS=-static ./configure && make
[...]
if gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -static -Wall -g -O2 -fno-strict-aliasing -MT eventdns.o -MD -MP -MF ".deps/eventdns.Tpo" -c -o eventdns.o eventdns.c; then mv -f ".deps/eventdns.Tpo" ".deps/eventdns.Po"; else rm -f ".deps/eventdns.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -static -Wall -g -O2 -fno-strict-aliasing -MT config_codedigest.o -MD -MP -MF ".deps/config_codedigest.Tpo" -c -o config_codedigest.o config_codedigest.c; then mv -f ".deps/config_codedigest.Tpo" ".deps/config_codedigest.Po"; else rm -f ".deps/config_codedigest.Tpo"; exit 1; fi
rm -f libtor.a
ar cru libtor.a buffers.o circuitbuild.o circuitlist.o circuituse.o command.o config.o connection.o connection_edge.o connection_or.o control.o cpuworker.o directory.o dirserv.o dirvote.o dns.o dnsserv.o geoip.o hibernate.o main.o microdesc.o networkstatus.o onion.o policies.o reasons.o relay.o rendcommon.o rendclient.o rendmid.o rendservice.o rephist.o router.o routerlist.o routerparse.o eventdns.o config_codedigest.o
ranlib libtor.a
if gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -static -Wall -g -O2 -fno-strict-aliasing -MT tor_main.o -MD -MP -MF ".deps/tor_main.Tpo" -c -o tor_main.o tor_main.c; then mv -f ".deps/tor_main.Tpo" ".deps/tor_main.Po"; else rm -f ".deps/tor_main.Tpo"; exit 1; fi
gcc -static -Wall -g -O2 -fno-strict-aliasing -o tor tor_main.o ./libtor.a ../common/libor.a ../common/libor-crypto.a ../common/libor-event.a -lz -lm -levent -lcrypto -lssl -lpthread
/usr/lib/libssl.a(s3_srvr.o)(.text+0x27d1): In function `ssl3_get_client_key_exchange':
/usr/src/lib/libssl/src/ssl/s3_srvr.c:2264: undefined reference to `ECDH_compute_key'
/usr/lib/libssl.a(s3_srvr.o)(.text+0x2c47): In function `ssl3_get_cert_verify':
/usr/src/lib/libssl/src/ssl/s3_srvr.c:2332: undefined reference to `X509_certificate_type'
/usr/lib/libssl.a(s3_clnt.o)(.text+0x2d66): In function `ssl3_send_client_key_exchange':
/usr/src/lib/libssl/src/ssl/s3_clnt.c:2251: undefined reference to `ECDH_compute_key'
/usr/lib/libssl.a(s3_clnt.o)(.text+0x334b): In function `ssl3_check_cert_and_algorithm':
/usr/src/lib/libssl/src/ssl/s3_clnt.c:2567: undefined reference to `X509_certificate_type'
/usr/lib/libssl.a(s3_clnt.o)(.text+0x36f7): In function `ssl_do_client_cert_cb':
/usr/src/lib/libssl/src/ssl/s3_clnt.c:2734: undefined reference to `ENGINE_load_ssl_client_cert'
/usr/lib/libssl.a(ssl_rsa.o)(.text+0x113): In function `SSL_use_certificate_file':
/usr/src/lib/libssl/src/ssl/ssl_rsa.c:112: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o)(.text+0x9bd): In function `SSL_CTX_use_certificate_file':
/usr/src/lib/libssl/src/ssl/ssl_rsa.c:481: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o)(.text+0xf27): In function `SSL_CTX_use_certificate_chain_file':
/usr/src/lib/libssl/src/ssl/ssl_rsa.c:726: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_rsa.o)(.text+0xf76):/usr/src/lib/libssl/src/ssl/ssl_rsa.c:745: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(s3_pkt.o)(.text+0x624): In function `ssl3_do_uncompress':
/usr/src/lib/libssl/src/ssl/s3_pkt.c:480: undefined reference to `COMP_expand_block'
/usr/lib/libssl.a(s3_pkt.o)(.text+0x670): In function `ssl3_do_compress':
/usr/src/lib/libssl/src/ssl/s3_pkt.c:498: undefined reference to `COMP_compress_block'
/usr/lib/libssl.a(ssl_ciph.o)(.text+0x1bd): In function `load_builtin_compressions':
/usr/src/lib/libssl/src/ssl/ssl_ciph.c:295: undefined reference to `COMP_zlib'
/usr/lib/libssl.a(ssl_ciph.o)(.text+0x331): In function `ssl_cipher_get_evp':
/usr/src/lib/libssl/src/ssl/ssl_ciph.c:366: undefined reference to `EVP_enc_null'
/usr/lib/libssl.a(ssl_lib.o)(.text+0x2dd5): In function `ssl_clear_cipher_ctx':
/usr/src/lib/libssl/src/ssl/ssl_lib.c:2352: undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(ssl_lib.o)(.text+0x2ded):/usr/src/lib/libssl/src/ssl/ssl_lib.c:2347: undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(ssl_lib.o)(.text+0x30f2): In function `SSL_CTX_set_default_verify_paths':
/usr/src/lib/libssl/src/ssl/ssl_lib.c:2521: undefined reference to `X509_STORE_set_default_paths'
/usr/lib/libssl.a(ssl_lib.o)(.text+0x3106): In function `SSL_CTX_load_verify_locations':
/usr/src/lib/libssl/src/ssl/ssl_lib.c:2527: undefined reference to `X509_STORE_load_locations'
/usr/lib/libssl.a(ssl_sess.o)(.text+0x1131): In function `SSL_CTX_set_client_cert_engine':
/usr/src/lib/libssl/src/ssl/ssl_sess.c:884: undefined reference to `ENGINE_get_ssl_client_cert_function'
/usr/lib/libssl.a(s3_enc.o)(.text+0x2bd): In function `ssl3_change_cipher_state':
/usr/src/lib/libssl/src/ssl/s3_enc.c:239: undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(s3_enc.o)(.text+0x695):/usr/src/lib/libssl/src/ssl/s3_enc.c:234: undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(s3_enc.o)(.text+0x713):/usr/src/lib/libssl/src/ssl/s3_enc.c:275: undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(s3_enc.o)(.text+0x755):/usr/src/lib/libssl/src/ssl/s3_enc.c:270: undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(ssl_cert.o)(.text+0x966): In function `SSL_load_client_CA_file':
/usr/src/lib/libssl/src/ssl/ssl_cert.c:672: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_cert.o)(.text+0xb06): In function `SSL_add_file_cert_subjects_to_stack':
/usr/src/lib/libssl/src/ssl/ssl_cert.c:744: undefined reference to `PEM_read_bio_X509'
/usr/lib/libssl.a(ssl_cert.o)(.text+0xc1c): In function `SSL_add_dir_cert_subjects_to_stack':
/usr/src/lib/libssl/src/ssl/ssl_cert.c:811: undefined reference to `OPENSSL_DIR_read'
/usr/lib/libssl.a(ssl_cert.o)(.text+0xcf2):/usr/src/lib/libssl/src/ssl/ssl_cert.c:828: undefined reference to `OPENSSL_DIR_end'
/usr/lib/libssl.a(t1_enc.o)(.text+0x39a): In function `tls1_change_cipher_state':
/usr/src/lib/libssl/src/ssl/t1_enc.c:290: undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(t1_enc.o)(.text+0x869):/usr/src/lib/libssl/src/ssl/t1_enc.c:285: undefined reference to `COMP_CTX_free'
/usr/lib/libssl.a(t1_enc.o)(.text+0x8ed):/usr/src/lib/libssl/src/ssl/t1_enc.c:327: undefined reference to `COMP_CTX_new'
/usr/lib/libssl.a(t1_enc.o)(.text+0x935):/usr/src/lib/libssl/src/ssl/t1_enc.c:322: undefined reference to `COMP_CTX_free'
collect2: ld returned 1 exit status
* Error code 1

Stop in /backup/temp/tor/src/or (line 310 of Makefile).
* Error code 1

Stop in /backup/temp/tor/src (line 234 of Makefile).
* Error code 1

Stop in /backup/temp/tor (line 283 of Makefile).
* Error code 1

Stop in /backup/temp/tor (line 195 of Makefile).
$

So it seems to me something changed with 0.2.2.8-aplha which breaks compiling of a static binary on BSD.

Tas.

[Automatically added by flyspray2trac: Operating System: BSD]

Child Tickets

Change History (6)

comment:1 Changed 10 years ago by Tas

From #tor:

<Sebastian> can you try ca60a6ce3f4786626ac455ec1b798b2e8304635c and b6038f4ac646b52f0819724b344adcf04bc2a440 ?

The first one compiles fine with CFLAGS=-static and the second one shows the error posted above, so the problem lies between
those two nice long weird version numbers. Tested on OpenBSD 4.7-beta.

comment:2 Changed 10 years ago by nickm

Looks like we maybe reversed the order of -lssl and -lcrypto . If you reverse their order back again in the
line that links Tor, does it work again for you?

comment:3 Changed 10 years ago by Tas

I think you're right! Not sure what "the line that links Tor" is exactly, but this diff makes the git version from today compile again:

$ diff -u configure.in.orig configure.in
--- configure.in.orig Tue Feb 2 09:30:19 2010
+++ configure.in Tue Feb 2 09:33:39 2010
@@ -337,7 +337,7 @@

TOR_OPENSSL_LIBS="$TOR_LIBDIR_openssl/libcrypto.a $TOR_LIBDIR_openssl/libssl.a"

fi

else

  • TOR_OPENSSL_LIBS="-lcrypto -lssl"

+ TOR_OPENSSL_LIBS="-lssl -lcrypto"

fi
echo "TOR_OPENSSL_LIBS=$TOR_OPENSSL_LIBS"
AC_SUBST(TOR_OPENSSL_LIBS)

Thank you! :-)

comment:4 Changed 10 years ago by nickm

Thanks! It should be fixed in git now.

comment:5 Changed 10 years ago by nickm

flyspray2trac: bug closed.

comment:6 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.