PDA

View Full Version : link against a specifc libssl



may24x
07-07-2015, 05:18 AM
Hi all,

I'm having some problems compiling the latest bitcoind.

I'm on CentOS 7 wich ships with an openssl version that is lacking some of the mandatory ECC (Eliptic Curve) algorithms for the bitcoin software.

So I downloaded the latest openssl version (1.0.2c) and build it with:

export CFLAGS=-fPIC
./config shared enable-ec_nistp_64_gcc_128 --openssldir=/opt/ssl
make depend
make all
make install


So far the build compiles without errors and all files are placed in /opt/ssl

Now, you just can't replace the system's ssl files with the new ones as several other applications seem to have some serious issues with them.
I tried that and I got a lot of (e.g.):

/usr/sbin/postconf: /lib64/libcrypto.so.10: no version information available (required by /lib64/libssl.so.10)
smbd: /usr/sbin/smbd: /lib64/libssl.so.10: no version information available (required by /lib64/libcups.so.2)

So I rolled back the changes ...

I'm trying to compile the bitcoind as suggested:

./configure PKG_CONFIG_PATH=/opt/ssl/lib/pkgconfig LIBS=-Wl,-rpath,/opt/ssl/lib/
make
make install

I checked the Makefile, and there're no traces that the linking library would be different than /opt/ssl/lib/libssl.so (and so on...)
However, when I try to start the bitcoind, I get the error message:

Error: OpenSSL appears to lack support for elliptic curve cryptography. For more information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries
Error: Initialization sanity check failed. Bitcoin Core is shutting down.


But the real problem here is that - also explicitly stated - the binary got linked against the wrong openssl library !


ldd bitcoind
linux-vdso.so.1 => (0x00007ffd76bfe000)
libboost_system.so.1.53.0 => /lib64/libboost_system.so.1.53.0 (0x00007fd54288e000)
libboost_filesystem.so.1.53.0 => /lib64/libboost_filesystem.so.1.53.0 (0x00007fd542676000)
libboost_program_options-mt.so.1.53.0 => /lib64/libboost_program_options-mt.so.1.53.0 (0x00007fd542404000)
libboost_thread-mt.so.1.53.0 => /lib64/libboost_thread-mt.so.1.53.0 (0x00007fd5421ed000)
libboost_system-mt.so.1.53.0 => /lib64/libboost_system-mt.so.1.53.0 (0x00007fd541fe8000)
libboost_chrono-mt.so.1.53.0 => /lib64/libboost_chrono-mt.so.1.53.0 (0x00007fd541de0000)
libdb_cxx-4.8.so => /lib64/libdb_cxx-4.8.so (0x00007fd541a3e000)

libssl.so.10 => /lib64/libssl.so.10 (0x00007fd5417d0000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fd5413e9000)

libanl.so.1 => /lib64/libanl.so.1 (0x00007fd5411e5000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd540edd000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd540bdb000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd5409c5000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd5407a8000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd5403e7000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd5401df000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fd53ff92000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fd53fcaf000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fd53faaa000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fd53f878000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd53f674000)
libz.so.1 => /lib64/libz.so.1 (0x00007fd53f45d000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd543152000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fd53f24e000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fd53f049000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fd53ee2f000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fd53ec09000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fd53e9a8000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fd53e783000)


How can I force the compiler to link against the right library ?
And only for this application ...

may24x
07-21-2015, 03:47 AM
Hi all,

I've tried a couple of things and played around with the parameters but all failed ... until somebody suggested me to "forcefully" link the binaries against the static ssl libs.
So I modified the Makefile's in the "root" and "src" directory:



CRYPTO_CFLAGS = -I/opt/ssl/include
CRYPTO_LIBS = -ldl /opt/ssl/lib/libcrypto.a

LIBS =-lanl -ldl

PKG_CONFIG_PATH = /opt/ssl/lib/pkgconfig

SSL_CFLAGS = -I/opt/ssl/include
SSL_LIBS = -ldl /opt/ssl/lib/libssl.a

So far the compiling and linking seem to work, except for this message I don't understand:

*** Warning: Linking the shared library libbitcoinconsensus.la against the
*** static library /opt/ssl/lib/libcrypto.a is not portable!
Does anyone know what this means ?

anduril462
07-22-2015, 03:52 PM
./configure PKG_CONFIG_PATH=/opt/ssl/lib/pkgconfig LIBS=-Wl,-rpath,/opt/ssl/lib/
Just a guess here, but I think you have a typo. After -rpath should be an = and you usually omit the trailing / (though the latter is probably not a problem, just unconventional)

LIBS=-Wl,-rpath=/opt/ssl/lib
The way you had it, you were passing an empty -rpath to the linker, as well as /opt/ssl/lib/ as a separate linker parameter.