Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Tor Tor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 328
    • Issues 328
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 31
    • Merge requests 31
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Core
  • TorTor
  • Issues
  • #40262
Closed
Open
Issue created Jan 27, 2021 by tobtoht@tobtoht

Static build regression in !217

A static Tor build using the Dockerfile below results in:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/crtbeginT.o: error adding symbols: Bad value

Dockerfile:

FROM ubuntu:16.04

ENV CFLAGS="-fPIC"
ENV CPPFLAGS="-fPIC"
ENV CXXFLAGS="-fPIC"
ENV SOURCE_DATE_EPOCH=1397818193

RUN apt-get update && \
    apt-get install -y build-essential wget git automake pkg-config python python3 && \
    rm -rf /var/lib/apt/lists/*

# Tor will not static link with 1.1.1i
RUN wget https://www.openssl.org/source/openssl-1.0.2u.tar.gz && \
    echo "ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 openssl-1.0.2u.tar.gz" | sha256sum -c && \
    tar -xzf openssl-1.0.2u.tar.gz && \
    rm openssl-1.0.2u.tar.gz && \
    cd openssl-1.0.2u && \
    ./config no-shared no-dso --prefix=/usr/local/openssl-1.0.2u && \
    make -j$THREADS && \
    make test && \
    make -j$THREADS install_sw && \
    rm -rf $(pwd)

RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz && \
    echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb libevent-2.1.12-stable.tar.gz" | sha256sum -c && \
    tar -zxvf libevent-2.1.12-stable.tar.gz && \
    cd libevent-2.1.12-stable && \
    PKG_CONFIG_PATH=/usr/local/openssl-1.0.2u/lib/pkgconfig/ \
    ./configure --prefix=/usr/local/libevent \
                --disable-shared \
                --enable-static \
                --with-pic && \
    make -j$THREADS && \
    make -j$THREADS install && \
    rm -rf $(pwd)

RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \
    cd zlib && \
    git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \
    ./configure --static --prefix=/usr/local/zlib && \
    make -j$THREADS && \
    make -j$THREADS install && \
    rm -rf $(pwd)

RUN git clone -b tor-0.4.5.4-rc --depth 1 https://git.torproject.org/tor.git && \
    cd tor && \
    git reset --hard 9e26a9399fe2422475406d6ee3cb29b2924f3274 && \
    ./autogen.sh && \
    ./configure \
    --disable-asciidoc \
    --disable-manpage \
    --disable-html-manual \
    --disable-system-torrc \
    --disable-module-relay \
    --disable-lzma \
    --disable-zstd \
    --enable-static-tor \
    --with-libevent-dir=/usr/local/libevent \
    --with-openssl-dir=/usr/local/openssl-1.0.2u \
    --with-zlib-dir=/usr/local/zlib \
    --disable-tool-name-check \
    --enable-fatal-warnings \
    --prefix=/usr/local/tor && \
    make -j$THREADS && \
    make -j$THREADS install && \
    rm -rf $(pwd)

I bisected this to !217 (closed) (Commit: c618c4f2).

Unrelated to this issue, I noticed a typo in src/app/include.am: @TOR_STATIC_FALGS@

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking