hamedramzi / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

[autotools]Don't hardcode openssl paths and other problems. #532

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Tested with 0.16.12 on Windows XP sp2 32 bit under msys (mingw 4.8.0)

While configuring the script searches for openssl/ssl.h in various places under 
/usr. It fails to find it and it tries to see if compilation/linking works 
against it.

I use this cmd: ./configure --prefix=/c/QBITTORRENT/install_mingw 
--disable-shared CFLAGS="-O3 -I/c/QBITTORRENT/install_mingw/include" 
LIBS="-L/c/QBITTORRENT/install_mingw/lib -static-libgcc -static-libstdc++" 
--disable-debug

From the config.log I see that the custom include path is correctly used: gcc 
-o conftest.exe -pthread -O3 -I/c/QBITTORRENT/install_mingw/include 
-fvisibility=hidden  -I/c/QBITTORRENT/boost_1_54_0  
-L/c/QBITTORRENT/boost_1_54_0/stage/lib   conftest.c -lws2_32 -lwsock32  
-L/c/QBITTORRENT/install_mingw/lib -static-libgcc -static-libstdc++

But the are a lot of linking errors. After a lot of troubleshooting I came to 
this:
1. There are some undocumented vars that can get used(from --help). Namely 
OPENSSL_LIBS
2. That the cmd didn't specify ssl libs to compile
3. That using in the cmd OPENSSL_LIBS="-lssl -lcrypto -lz -lgdi32" works 
correctly and the test program links ok.

To clarify: openssl and zlib are compiled as static libs too in this case.

Original issue reported on code.google.com by hammered...@gmail.com on 26 Oct 2013 at 1:26

GoogleCodeExporter commented 9 years ago
Hmm, configure completes ok, but make errors out in files where they use 
openssl with the error that they can't find the openssl includes.

PS: bjam compilation works fine.

Original comment by hammered...@gmail.com on 26 Oct 2013 at 1:47

GoogleCodeExporter commented 9 years ago
I'm not particularly familiar with autoconf/autotools, and I did not write 
these scripts. My guess is that you probably have a better understanding of 
what's going on in the configure script that I do.

OPENSSL_LIBS is supposed to be defined m4/ax_check_openssl.m4, I imagine. It 
looks like it mostly relies on pkg-config to find the libraries to link 
against, which seems reasonable.

It sounds like the underlying problem is that the ssl libraries are not 
included at all. could it be that pkg-config is misconfigured to not specify 
-lssl -lcrypto -lz and -lgdi32 ?

Original comment by arvid.no...@gmail.com on 27 Oct 2013 at 9:03

GoogleCodeExporter commented 9 years ago
>I'm not particularly familiar with autoconf/autotools, and I did not write 
these scripts.

>My guess is that you probably have a better understanding of what's going on 
in the configure script that I do.

I am not good either :S

The truth is that I have installed all self-compiled libs under a custom 
folder. I didn't point pkg-config to it. After pointing PKG_CONFIG_PATH to the 
folder it does pick up the correct location and uses the correct flags[almost]. 
It still fails to compile the test program. That's because it doesn't add zlib 
and gdi32 in the linking libs. I suppose that this should be considered a 
OpenSSL bug, because it's pkg-config doesn't provide those libs.

Original comment by hammered...@gmail.com on 28 Oct 2013 at 2:00