Thread: link against a specifc libssl

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    4

    link against a specifc libssl

    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:
    Code:
     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.):
    Code:
    /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:
    Code:
    ./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:
    Code:
     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 !

    Code:
    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 ...
    Last edited by may24x; 07-07-2015 at 05:32 AM.

  2. #2
    Registered User
    Join Date
    Jul 2015
    Posts
    4
    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:

    Code:
    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:
    Code:
    *** 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 ?

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by may24x View Post
    Code:
    ./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)
    Code:
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specifc Character Counts
    By ZeroBoyd in forum C Programming
    Replies: 12
    Last Post: 11-20-2014, 07:59 PM
  2. Need some link plz
    By Mohamed Jihad in forum C++ Programming
    Replies: 0
    Last Post: 07-26-2013, 06:12 PM
  3. Where should I link?
    By fighter92 in forum C++ Programming
    Replies: 1
    Last Post: 01-22-2007, 12:06 PM
  4. link in C
    By SuperNewbie in forum C Programming
    Replies: 1
    Last Post: 07-15-2002, 02:36 PM
  5. Dev C++ 4 won't link
    By minesweeper in forum Game Programming
    Replies: 1
    Last Post: 04-03-2002, 04:07 PM