Openssl: Make instructions for building OpenSSL putting libssl.so and libcrypto.so in incorrect locations

Created on 19 Nov 2018  路  3Comments  路  Source: openssl/openssl

Description

I had difficulty building a dependency (freetds) and thought maybe installing an upgraded version of openssl would help fix the issue. I already had openssl installed both on my system and in my Anaconda environment. When I built openssl from source, I encountered errors about not having libssl.so and libcryto.so loaded properly. After finding out where these packages were and symlinking them to the correct directory, I was able to run openssl, but I would think that the make instructions would have taken care of this.

Environment

yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:    16.04
Codename:   xenial

Instructions to reproduce issue

  1. Download openssl-1.1.1.tar.gz.
  2. tar -xvzf openssl-1.1.1.tar.gz.
  3. cd openssl-1.1.1.
  4. ./config
  5. make && make test && sudo make install
  6. /usr/local/bin/openssl

Here I got the error:

yingw787@yingw787-Oryx-Pro:~/Downloads/openssl-1.1.1$ /usr/local/bin/openssl
/usr/local/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

I found this email thread that detailed a similar situation: https://askubuntu.com/questions/339364/libssl-so-10-cannot-open-shared-object-file-no-such-file-or-directory

(THIS FAILED) I went into /usr/x86_64-linux-gnu and symlinked older copies of libssl.so to the correct filename. I did the same to libcrypto.so as well:

yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ sudo ln -s libssl.so.1.0.0 libssl.so.1.1
yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ /usr/local/bin/openssl
/usr/local/bin/openssl: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ sudo ln -s libcrypto.so.1.0.0 libcrypto.so.1.1

which failed due to not having the proper env variables configured:

yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ /usr/local/bin/openssl
/usr/local/bin/openssl: /lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/bin/openssl)
/usr/local/bin/openssl: /lib/x86_64-linux-gnu/libssl.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/local/bin/openssl)
/usr/local/bin/openssl: /lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by /usr/local/bin/openssl)
/usr/local/bin/openssl: /lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_0' not found (required by /usr/local/bin/openssl)

I then discovered that those binaries were loaded in /usr/local/lib:

yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ /usr/local/lib/
engines-1.1/      libcrypto.so.1.1  libssl.so.1.1     python2.7/        
libcrypto.so      libssl.so         pkgconfig/        python3.5/        

So then I symlinked the binaries there to the prior directory and everything worked fine:

yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ sudo ln -s /usr/local/lib/libssl.so.1.1 /lib/x86_64-linux-gnu/libssl.so.1.1
yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ sudo ln -s /usr/local/lib/libcrypto.so.1.1 /lib/x86_64-linux-gnu/libcrypto.so.1.1yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ 
yingw787@yingw787-Oryx-Pro:/lib/x86_64-linux-gnu$ /usr/local/bin/openssl version
OpenSSL 1.1.1  11 Sep 2018

I would have thought that libssl.so.1.1 and libcrypto.so.1.1 would have been automatically installed in /lib/x86_64-linux-gnu in order for this issue to not happen. I ran make && make test && sudo make install from both system and from my Anaconda environment, but neither seemed to make a difference (as expected).

If anybody else has this issue, this should be a good workaround (explore /usr/local/lib).

Configuration output

perl configdata.pm --dump

Command line (with current working directory = .):

    /usr/bin/perl ./Configure linux-x86_64

Perl information:

    /usr/bin/perl
    5.22.1 for x86_64-linux-gnu-thread-multi

Enabled features:

    afalgeng
    aria
    asm
    async
    autoalginit
    autoerrinit
    autoload-config
    bf
    blake2
    camellia
    capieng
    cast
    chacha
    cmac
    cms
    comp
    ct
    deprecated
    des
    dgram
    dh
    dsa
    dso
    dtls
    dynamic-engine
    ec
    ec2m
    ecdh
    ecdsa
    engine
    err
    filenames
    gost
    hw(-.+)?
    idea
    makedepend
    md4
    mdc2
    multiblock
    nextprotoneg
    ocb
    ocsp
    pic
    poly1305
    posix-io
    psk
    rc2
    rc4
    rdrand
    rfc3779
    rmd160
    scrypt
    seed
    shared
    siphash
    sm2
    sm3
    sm4
    sock
    srp
    srtp
    sse2
    ssl
    static-engine
    stdio
    tests
    threads
    tls
    ts
    ui-console
    whirlpool
    tls1
    tls1-method
    tls1_1
    tls1_1-method
    tls1_2
    tls1_2-method
    tls1_3
    dtls1
    dtls1-method
    dtls1_2
    dtls1_2-method

Disabled features:

    asan                    [default] OPENSSL_NO_ASAN
    crypto-mdebug           [default] OPENSSL_NO_CRYPTO_MDEBUG
    crypto-mdebug-backtrace [default] OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
    devcryptoeng            [default] OPENSSL_NO_DEVCRYPTOENG
    ec_nistp_64_gcc_128     [default] OPENSSL_NO_EC_NISTP_64_GCC_128
    egd                     [default] OPENSSL_NO_EGD
    external-tests          [default] OPENSSL_NO_EXTERNAL_TESTS
    fuzz-libfuzzer          [default] OPENSSL_NO_FUZZ_LIBFUZZER
    fuzz-afl                [default] OPENSSL_NO_FUZZ_AFL
    heartbeats              [default] OPENSSL_NO_HEARTBEATS
    md2                     [default] OPENSSL_NO_MD2 (skip crypto/md2)
    msan                    [default] OPENSSL_NO_MSAN
    rc5                     [default] OPENSSL_NO_RC5 (skip crypto/rc5)
    sctp                    [default] OPENSSL_NO_SCTP
    ssl-trace               [default] OPENSSL_NO_SSL_TRACE
    ubsan                   [default] OPENSSL_NO_UBSAN
    unit-test               [default] OPENSSL_NO_UNIT_TEST
    weak-ssl-ciphers        [default] OPENSSL_NO_WEAK_SSL_CIPHERS
    zlib                    [default] 
    zlib-dynamic            [default] 
    ssl3                    [default] OPENSSL_NO_SSL3
    ssl3-method             [default] OPENSSL_NO_SSL3_METHOD

Config target attributes:

    AR => "ar",
    ARFLAGS => "r",
    CC => "gcc",
    CFLAGS => "-Wall -O3",
    CXX => "g++",
    CXXFLAGS => "-Wall -O3",
    HASHBANGPERL => "/usr/bin/env perl",
    RANLIB => "ranlib",
    RC => "windres",
    aes_asm_src => "aes-x86_64.s vpaes-x86_64.s bsaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",
    aes_obj => "aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o",
    apps_aux_src => "",
    apps_init_src => "",
    apps_obj => "",
    bf_asm_src => "bf_enc.c",
    bf_obj => "bf_enc.o",
    bn_asm_src => "asm/x86_64-gcc.c x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s rsaz-avx2.s",
    bn_obj => "asm/x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",
    bn_ops => "SIXTY_FOUR_BIT_LONG",
    build_file => "Makefile",
    build_scheme => [ "unified", "unix" ],
    cast_asm_src => "c_enc.c",
    cast_obj => "c_enc.o",
    cflags => "-pthread -m64",
    chacha_asm_src => "chacha-x86_64.s",
    chacha_obj => "chacha-x86_64.o",
    cmll_asm_src => "cmll-x86_64.s cmll_misc.c",
    cmll_obj => "cmll-x86_64.o cmll_misc.o",
    cppflags => "",
    cpuid_asm_src => "x86_64cpuid.s",
    cpuid_obj => "x86_64cpuid.o",
    cxxflags => "-std=c++11 -pthread -m64",
    defines => [  ],
    des_asm_src => "des_enc.c fcrypt_b.c",
    des_obj => "des_enc.o fcrypt_b.o",
    disable => [  ],
    dso_extension => ".so",
    dso_scheme => "dlfcn",
    ec_asm_src => "ecp_nistz256.c ecp_nistz256-x86_64.s x25519-x86_64.s",
    ec_obj => "ecp_nistz256.o ecp_nistz256-x86_64.o x25519-x86_64.o",
    enable => [ "afalgeng" ],
    ex_libs => "-ldl -pthread",
    exe_extension => "",
    includes => [  ],
    keccak1600_asm_src => "keccak1600-x86_64.s",
    keccak1600_obj => "keccak1600-x86_64.o",
    lflags => "",
    lib_cflags => "",
    lib_cppflags => "-DOPENSSL_USE_NODELETE -DL_ENDIAN",
    lib_defines => [  ],
    md5_asm_src => "md5-x86_64.s",
    md5_obj => "md5-x86_64.o",
    modes_asm_src => "ghash-x86_64.s aesni-gcm-x86_64.s",
    modes_obj => "ghash-x86_64.o aesni-gcm-x86_64.o",
    module_cflags => "-fPIC",
    module_cxxflags => "",
    module_ldflags => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    multilib => "64",
    padlock_asm_src => "e_padlock-x86_64.s",
    padlock_obj => "e_padlock-x86_64.o",
    perlasm_scheme => "elf",
    poly1305_asm_src => "poly1305-x86_64.s",
    poly1305_obj => "poly1305-x86_64.o",
    rc4_asm_src => "rc4-x86_64.s rc4-md5-x86_64.s",
    rc4_obj => "rc4-x86_64.o rc4-md5-x86_64.o",
    rc5_asm_src => "rc5_enc.c",
    rc5_obj => "rc5_enc.o",
    rmd160_asm_src => "",
    rmd160_obj => "",
    sha1_asm_src => "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s sha256-mb-x86_64.s",
    sha1_obj => "sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o",
    shared_cflag => "-fPIC",
    shared_defflag => "-Wl,--version-script=",
    shared_defines => [  ],
    shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
    shared_extension_simple => ".so",
    shared_ldflag => "-Wl,-znodelete -shared -Wl,-Bsymbolic",
    shared_rcflag => "",
    shared_sonameflag => "-Wl,-soname=",
    shared_target => "linux-shared",
    thread_defines => [  ],
    thread_scheme => "pthreads",
    unistd => "<unistd.h>",
    uplink_aux_src => "",
    uplink_obj => "",
    wp_asm_src => "wp-x86_64.s",
    wp_obj => "wp-x86_64.o",

Recorded environment:

    AR = 
    ARFLAGS = 
    AS = 
    ASFLAGS = 
    BUILDFILE = 
    CC = 
    CFLAGS = 
    CPP = 
    CPPDEFINES = 
    CPPFLAGS =  -I/include
    CPPINCLUDES = 
    CROSS_COMPILE = 
    CXX = 
    CXXFLAGS = 
    HASHBANGPERL = 
    LD = 
    LDFLAGS = 
    LDLIBS = 
    MT = 
    MTFLAGS = 
    OPENSSL_LOCAL_CONFIG_DIR = 
    PERL = 
    RANLIB = 
    RC = 
    RCFLAGS = 
    RM = 
    WINDRES = 
    __CNF_CFLAGS = 
    __CNF_CPPDEFINES = 
    __CNF_CPPFLAGS = 
    __CNF_CPPINCLUDES = 
    __CNF_CXXFLAGS = 
    __CNF_LDFLAGS = 
    __CNF_LDLIBS = 

Makevars:

    AR              = ar
    ARFLAGS         = r
    CC              = gcc
    CFLAGS          = -Wall -O3
    CPPDEFINES      = 
    CPPFLAGS        =  -I/include
    CPPINCLUDES     = 
    CXX             = g++
    CXXFLAGS        = -Wall -O3
    HASHBANGPERL    = /usr/bin/env perl
    LDFLAGS         = 
    LDLIBS          = 
    PERL            = /usr/bin/perl
    RANLIB          = ranlib
    RC              = windres

NOTE: These variables only represent the configuration view.  The build file
template may have processed these variables further, please have a look at the
build file for more exact data:
    Makefile

build file:

    Makefile

build file templates:

    Configurations/common0.tmpl
    Configurations/unix-Makefile.tmpl
    Configurations/common.tmpl

Most helpful comment

The libcrypto and libssl shared library that you find in /lib/x86_64-linux-gnu are provided by your system provided, not by us. You should look at them as custom built for your system, and please be aware that other system tools may depend on them being a known version. Messing around with those symlinks is not advisable unless you know very well what you're messing around with.

There are other ways to get what you want:

  1. You can configure with '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)' (quotes included). This is mentioned in NOTES.UNIX
  2. You can add /usr/local/lib to the LD_LIBRARY_PATH environment variable (its value is a set of colon-separated directories, just like PATH) before rrunning /usr/local/bin/openssl.
  3. On a system level, add /usr/local/lib to /etc/ld.so.conf or to a file in /etc/ld.so.conf.d if available, then run ldconfig. Note that this requires root privileges, which you might not have.

All 3 comments

The libcrypto and libssl shared library that you find in /lib/x86_64-linux-gnu are provided by your system provided, not by us. You should look at them as custom built for your system, and please be aware that other system tools may depend on them being a known version. Messing around with those symlinks is not advisable unless you know very well what you're messing around with.

There are other ways to get what you want:

  1. You can configure with '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)' (quotes included). This is mentioned in NOTES.UNIX
  2. You can add /usr/local/lib to the LD_LIBRARY_PATH environment variable (its value is a set of colon-separated directories, just like PATH) before rrunning /usr/local/bin/openssl.
  3. On a system level, add /usr/local/lib to /etc/ld.so.conf or to a file in /etc/ld.so.conf.d if available, then run ldconfig. Note that this requires root privileges, which you might not have.

just found a solution somewhere, hope it helps

sudo apt-get install libssl1.1.*:i386

use the above to get the job done. :)

Adding openssl/lib path to LD_LIBRARY_PATH fixed libssl.so.1.1 not found issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

barbarosalp picture barbarosalp  路  4Comments

mattcaswell picture mattcaswell  路  4Comments

nmtitov picture nmtitov  路  3Comments

hymie0 picture hymie0  路  4Comments

vishal307 picture vishal307  路  3Comments