Small fixes for the 2702 implementation

Improve the INSTALL documentation for static builds, remove a few
unnecessary lines from configure.in and tweak the changelog message
slightly.
This commit is contained in:
Sebastian Hahn 2011-03-27 05:29:00 +02:00
parent fe051a43c1
commit e97f78d789
3 changed files with 18 additions and 46 deletions

38
INSTALL
View File

@ -23,12 +23,20 @@ If it doesn't build for you:
Lastly, check out Lastly, check out
https://www.torproject.org/docs/faq#DoesntWork https://www.torproject.org/docs/faq#DoesntWork
An example of how to build a mostly static Tor: How to do static builds of tor:
Libevent should be built with: Tor supports linking each of the libraries it needs statically. Use the
% ./configure --disable-shared --enable-static --with-pic --enable-static-X ./configure option in conjunction with the --with-X-dir
option for libevent, zlib, and openssl. For this to work sanely, libevent
should be built with --disable-shared --enable-static --with-pic, and
OpenSSL should be built with no-shared no-dso.
An example of how to build a mostly static Tor: If you need to build tor so that system libraries are also statically linked,
use the --enable-static-tor ./configure option. This won't work on OS X
unless you build the required crt0.o yourself. It is also incompatible with
the --enable-gcc-hardening option.
An example of how to build a mostly static tor:
./configure --enable-static-libevent \ ./configure --enable-static-libevent \
--enable-static-openssl \ --enable-static-openssl \
--enable-static-zlib \ --enable-static-zlib \
@ -36,29 +44,9 @@ An example of how to build a mostly static Tor:
--with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \ --with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \
--with-zlib-dir=/tmp/static-tor/zlib-1.2.5 --with-zlib-dir=/tmp/static-tor/zlib-1.2.5
An example of how to build an entirely static Tor (no Mac OS X support, sorry): An example of how to build an entirely static tor:
./configure --enable-static-tor \ ./configure --enable-static-tor \
--enable-static-libevent \
--enable-static-openssl \
--enable-static-zlib \
--with-libevent-dir=/tmp/static-tor/libevent-1.4.14b-stable \ --with-libevent-dir=/tmp/static-tor/libevent-1.4.14b-stable \
--with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \ --with-openssl-dir=/tmp/static-tor/openssl-0.9.8r/ \
--with-zlib-dir=/tmp/static-tor/zlib-1.2.5 --with-zlib-dir=/tmp/static-tor/zlib-1.2.5
This currently does not work with --enable-gcc-hardening because of libevent issues:
configure:6176: gcc -o conftest -D_FORTIFY_SOURCE=2 -fstack-protector-all -fwrapv -fPIE -Wstack-protector
--param ssp-buffer-size=1 -I/tmp/static-tor/libevent-1.4.14b-stable -I${top_srcdir}/src/common -
L/tmp/static-tor/libevent-1.4.14b-stable -pie conftest.c -lpthread -ldl -levent -lrt >&5
/usr/bin/ld: /tmp/static-tor/libevent-1.4.14b-stable/libevent.a(event.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/tmp/static-tor/libevent-1.4.14b-stable/libevent.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
configure:6176: $? = 1
This produces the following Tor binaries on Gnu/Linux x86-64:
% file src/or/tor
src/or/tor: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.15, not stripped
% ldd src/or/tor
not a dynamic executable

View File

@ -1,5 +1,5 @@
o Minor enhancement o Minor features:
- Implements --enable-static-tor for configure time. Closes bug 2702. - Implements --enable-static-tor for configure time. Implements ticket
Idea, general hackery and thoughts from Alexei Czeskis, John Gilmore, 2702. Idea, general hackery and thoughts from Alexei Czeskis, John
Jacob Appelbaum. Gilmore, Jacob Appelbaum.

View File

@ -33,14 +33,12 @@ AC_ARG_ENABLE(static-libevent,
AC_ARG_ENABLE(static-zlib, AC_ARG_ENABLE(static-zlib,
AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir)) AS_HELP_STRING(--enable-static-zlib, Link against a static zlib library. Requires --with-zlib-dir))
AC_ARG_ENABLE(static-tor, AC_ARG_ENABLE(static-tor,
AS_HELP_STRING(--enable-static-tor, Create an entirely static Tor binary. Requires --static-openssl AS_HELP_STRING(--enable-static-tor, Create an entirely static Tor binary. Requires --with-openssl-dir and --with-libevent-dir and --with-zlib-dir))
--static-libevent and --static-zlib))
if test "$enable_static_tor" = "yes"; then if test "$enable_static_tor" = "yes"; then
enable_static_libevent="yes"; enable_static_libevent="yes";
enable_static_openssl="yes"; enable_static_openssl="yes";
enable_static_zlib="yes"; enable_static_zlib="yes";
AC_MSG_NOTICE("We're attempting to build a static Tor.")
CFLAGS="$CFLAGS -static" CFLAGS="$CFLAGS -static"
fi fi
@ -527,20 +525,6 @@ else
fi fi
AC_SUBST(TOR_ZLIB_LIBS) AC_SUBST(TOR_ZLIB_LIBS)
if test "$enable_static_tor" = "yes"; then
if test "$enable_static_libevent" = "no"; then
AC_MSG_ERROR("You must configure with --enable-static-libevent")
fi
if test "$enable_static_openssl" = "no"; then
AC_MSG_ERROR("You must configure with --enable-static-openssl")
fi
if test "$enable_static_zlib" = "no"; then
AC_MSG_ERROR("You must configure with --enable-static-zlib")
fi
AC_MSG_NOTICE("We're attempting to build a static Tor.")
CFLAGS="$CFLAGS -static"
fi
dnl Make sure to enable support for large off_t if available. dnl Make sure to enable support for large off_t if available.