Unable to build tor statically (no linkable openssl found)
I try to build tor statically. While configure tor it errors with:
checking for openssl directory... configure: WARNING: Could not find a linkable openssl. If you have it installed somewhere unusual, you can specify an explicit path using --with-openssl-dir
configure: WARNING: On Debian, you can install openssl using "apt-get install libssl-dev"
configure: error: Missing libraries; unable to proceed.
I tried:
- with several tor versions
- with several openssl versions, using several paths to openssl.
- with ubuntu, debian, in container, locally (ubuntu 20.04) etc. I got always the same error.
- several different options for openssl, libevent
- with openssl-dev and path point to it
I don't know if it's a but however i spent now 1-2 days on this. The error should be more precise anyway.
Here a complete example:
FROM debian
RUN mkdir /tor
WORKDIR /tor
RUN apt update && apt upgrade -y
RUN apt install -y exa
RUN apt install -y git
RUN apt install -y build-essential automake pkgconf
RUN apt install -y zlib1g-dev libsystemd-dev
RUN apt install -y libtool autopoint
#RUN git clone --depth 1 -b tor-0.3.3.9 --single-branch https://github.com/torproject/tor.git /tor
RUN git clone --depth 1 -b tor-0.4.5.0-alpha-dev --single-branch https://github.com/torproject/tor.git /tor
#RUN git clone --depth 1 -b openssl-3.0.0-alpha6 --single-branch https://github.com/openssl/openssl /tor/openssl
RUN git clone --depth 1 -b OpenSSL_1_1_1f --single-branch https://github.com/openssl/openssl /tor/openssl
RUN git clone --depth 1 -b v1.2.9 --single-branch https://github.com/madler/zlib /tor/zlib
RUN git clone --depth 1 -b release-2.1.12-stable --single-branch https://github.com/libevent/libevent /tor/libevent
RUN git clone --depth 1 -b v5.2.3 --single-branch https://github.com/roboticslibrary/xz /tor/xz
RUN cd /tor/openssl && \
./config --prefix=/opt/openssl \
no-shared no-dso zlib \
--static && \
make -j$(nproc) && \
make install_sw
RUN cd /tor/libevent && \
./autogen.sh && \
./configure --prefix=/opt/libevent \
--disable-openssl && \
make -j$(nproc) && \
make install
RUN cd /tor/zlib && \
./configure --prefix=/opt/zlib && \
make -j$(nproc) && \
make install
RUN cd /tor/xz && \
./autogen.sh && \
./configure --prefix=/opt/xz && \
make -j$(nproc) && \
make install
RUN apt install -y libevent-dev libssl-dev
RUN ./autogen.sh && \
./configure --prefix=/opt/tor \
--disable-module-relay --disable-module-dirauth \
--disable-system-torrc \
--disable-asciidoc --disable-manpage --disable-html-manual \
--disable-lzma --disable-zstd \
--enable-systemd \
--disable-gcc-hardening \
--disable-tool-name-check \
--enable-static-tor \
--with-libevent-dir=/opt/libevent \
--with-openssl-dir=/tor/openssl \
--with-zlib-dir=/opt/zlib \
--enable-pci && \
make -j$(nproc) && \
make install
RUN env
RUN exa -l --tree fixtures /opt/tor
RUN /opt/tor/bin/tor --version
Edited by simplejack