Opened 4 years ago

Closed 3 years ago

#21061 closed defect (duplicate)

Tor configure error - OpenSSL 1.1.0c with MinGW

Reported by: Diapolo Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor:
Severity: Normal Keywords: OpenSSL, MinGW
Cc: Diapolo Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Syswtem configuration:
OS Win8.1 x64
MSYS2 + MinGW version 6.2.0 (Rev2, Built by MSYS2 project)
libevent 2.1.7 rc
OpenSSL 1.1.0c
Tor alpha

This is how I try to build Tor (which is working with OpenSSL 1.0.2j just fine):
cd /d/tor-mingw
tar xvzf tor-
cd tor-
./configure --prefix=$PWD/dist --with-libevent-dir=/d/tor-mingw/libevent-release-2.1.7-rc/dist --with-openssl-dir=/d/libs/openssl-1.0.2j --disable-asciidoc --enable-local-appdata

I then get the following OpenSSL related error from configure:
checking for openssl directory... /d/libs/openssl-1.1.0c
checking whether we need extra options to link openssl... configure: error: Found linkable openssl in /d/libs/openssl-1.1.0c, but it does not seem to run, even with -R. Maybe specify another using --with-openssl-dir}

Trying with CPPFLAGS="-I/d/libs/openssl-1.1.0c/dist/include" LDFLAGS="-L/d/libs/openssl-1.1.0c/dist/lib" in configure also leads to the same error :-/.

This is how I build OpenSSL:
cd /d/libs
tar xvzf openssl-1.1.0c.tar.gz
cd openssl-1.1.0c
./Configure --openssldir=$PWD/dist --prefix=$PWD/dist shared mingw64 no-ssl3 enable-ec_nistp_64_gcc_128
make depend && make && make install

This is how I build libevent:
cd /d/tor-mingw
tar xvzf libevent-release-2.1.7-rc.tar.gz
cd libevent-release-2.1.7-rc
./configure --prefix=$PWD/dist --enable-static --disable-shared CPPFLAGS="-I/d/libs/openssl-1.1.0c/dist/include" LDFLAGS="-L/d/libs/openssl-1.1.0c/dist/lib"
make && make install

Any ideas for me?


Child Tickets

Change History (12)

comment:1 Changed 4 years ago by Diapolo

Keywords: OpenSSL 1.1 added

comment:2 Changed 4 years ago by Diapolo

Keywords: MinGW added

comment:3 Changed 4 years ago by Diapolo

Keywords: OpenSSL1.1 added; OpenSSL 1.1 removed

comment:4 Changed 4 years ago by Diapolo

Keywords: OpenSSL added; OpenSSL1.1 removed

comment:5 Changed 4 years ago by Diapolo

Isn't it allowed to change the description? I wanted to fix a typo ;).

comment:6 Changed 4 years ago by nickm

Milestone: Tor: 0.3.0.x-final

Maybe look through the config.log to see what command configure is trying to run that fails, and how it is failing? This could give some clue about what the underlying problem is.

comment:7 Changed 4 years ago by Diapolo

Sorry for answering late. Is a config.log automatically generated in my build dir? I'm asking, because I didn't keep the non working files and would try to build again, to get a config.log.


comment:8 Changed 4 years ago by nickm

yeah; config.log is a logfile that the "configure" script makes to record exactly what tests it ran and what results it got. It's one of the best ways to debug tricky configure issues.

comment:9 Changed 4 years ago by Diapolo

Seems I was able to track this down with your help and a look in debug.log:

configure:8820: checking for openssl directory
configure:8873: gcc -o conftest.exe -g -O2 -I/d/libs/openssl-1.1.0c/include  -I${top_srcdir}/src/common -L/d/libs/openssl-1.1.0c  conftest.c  -lssl -lcrypto -lgdi32 >&5
configure:8873: $? = 0
configure:8895: gcc -c -g -O2 -I/d/libs/openssl-1.1.0c/include  -I${top_srcdir}/src/common conftest.c >&5
configure:8895: $? = 0
configure:8988: result: /d/libs/openssl-1.1.0c
configure:9029: checking whether we need extra options to link openssl
configure:9067: gcc -o conftest.exe -g -O2 -I/d/libs/openssl-1.1.0c/include  -I${top_srcdir}/src/common -L/d/libs/openssl-1.1.0c  conftest.c  -lssl -lcrypto -lgdi32 >&5
configure:9067: $? = 0
configure:9067: ./conftest.exe
D:/tor-mingw/tor- error while loading shared libraries: libcrypto-1_1-x64.dll: cannot open shared object file: No such file or directory
configure:9067: $? = 127
configure: program exited with status 127

So the problem is "error while loading shared libraries: libcrypto-1_1-x64.dll", which resides in /d/libs/openssl-1.1.0c/dist/bin. I have got /d/libs/openssl-1.1.0c/dist in my Windows PATH (not sure if the MinGW shell picks that up though).

Any idea what would be the best way to fix that in my case?

comment:10 Changed 4 years ago by Diapolo

I found and ugly hack that is working:

cd /d/tor-mingw
tar xvzf tor-
cp /d/libs/openssl-1.1.0c/dist/bin/libcrypto-1_1-x64.dll /d/tor-mingw/tor-
cd tor-
./configure --prefix=$PWD/dist --with-libevent-dir=/d/tor-mingw/libevent-release-2.1.7-rc/dist --with-openssl-dir=/d/libs/openssl-1.1.0c --disable-asciidoc --enable-local-appdata
make && make install
rm /d/tor-mingw/tor-

I don't even need libcrypto-1_1-x64.dll in the tor directory after compilation, because tor.exe is able to find the dll in my PATH (D:\libs\openssl-1.1.0c\dist\bin).

IMHO configure should be able to detect the dll inside /d/libs/openssl-1.1.0c, as that path is supplied via --with-openssl-dir, no?

Last edited 4 years ago by Diapolo (previous) (diff)

comment:11 Changed 4 years ago by nickm

Milestone: Tor: 0.3.0.x-finalTor: unspecified

I think it _should_, but it might be finding another one in some other place.

Moving this to "unspecified" since this is going to be pretty hard to reproduce and fix, and since a workaround seems to exist. Any good fix would probably be a matter of replacing our "--with-xyz-dir" code...

comment:12 Changed 3 years ago by nickm

Resolution: duplicate
Status: newclosed

Any fix for this is going to fall out of a more general fix for our library search logic; closing as duplicate of all of the tickets where we replace --with-openssl-dir

Note: See TracTickets for help on using tickets.