openssl: relocation error

Viktor Dukhovni openssl-users at dukhovni.org
Mon Mar 20 05:59:49 UTC 2023


On Mon, Mar 20, 2023 at 03:21:06PM +1100, Horst Simon via openssl-users wrote:

> I build openssl from source and when i try to generate a key it gives
> me following error: openssl: relocation error: /opt/local/bin/openssl:
> symbol ENGINE_finish version OPENSSL_3.0.0 not defined in file
> libcrypto.so.3 with link time reference

* Where did you install the associated shared libraries?
  - Are these directories on the default ld.so search path?
* Does your system have pre-existing OpenSSL 3.x libraries?
  - If so, where are these installed?

You should report the RUNPATH/RPATH values from the executable:

    $ readelf -d /usr/local/bin/openssl  | grep -E 'NEED|PATH'

Also report the output of:

    $ objdump -T /some/path/.../libcrypto.so.3 | grep ENGINE_finish

for both your system's libcrypto.so.3 (if applicable) and the library
you built.

Note that if your system does have OpenSSL 3.0 already installed, you
need to avoid runtime conflicts by building your custom library as a
"shlib_variant".  I build OpenSSL 3.2 with as yet unreleased RFC7250
RPK support.  To avoid conflicts I created:

    $ cat Configurations/99-viktor.conf
    my %targets = (
        "linux-x86_64-rpk" => {
            inherit_from     => [ "linux-x86_64" ],
            shlib_variant    => "rpk",
        },
        "BSD-x86_64-rpk" => {
            inherit_from     => [ "BSD-x86_64" ],
            shlib_variant    => "rpk",
        },
    );

On, for example, a Fedora Linux system I then run Configure as follows:

    ./Configure --prefix=/opt/openssl/3.2 -Wl,-rpath,/opt/openssl/3.2/lib64 linux-x86_64-rpk

After "make install_sw", the library directory contains:

    $ ls -l /opt/openssl/3.2/lib64/
    total 18352
    drwxr-xr-x 1 root root       80 Mar  3 06:34 engines-3
    -rw-r--r-- 1 root root 10456080 Mar  3 06:33 libcrypto.a
    lrwxrwxrwx 1 root root       17 Mar  3 06:33 libcrypto.so -> libcryptorpk.so.3
    -rwxr-xr-x 1 root root  6120384 Mar  3 06:33 libcryptorpk.so.3
    -rw-r--r-- 1 root root  1340042 Mar  3 06:33 libssl.a
    lrwxrwxrwx 1 root root       14 Mar  3 06:33 libssl.so -> libsslrpk.so.3
    -rwxr-xr-x 1 root root   857584 Mar  3 06:33 libsslrpk.so.3
    drwxr-xr-x 1 root root       18 Mar  3 06:34 ossl-modules
    drwxr-xr-x 1 root root       62 Feb  2 06:51 pkgconfig

And the "openssl" command depends on the "rpk" variant libraries:

    $ readelf -d /opt/openssl/3.2/bin/openssl | grep -E 'NEED|PATH'
     0x0000000000000001 (NEEDED)             Shared library: [libsslrpk.so.3]
     0x0000000000000001 (NEEDED)             Shared library: [libcryptorpk.so.3]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
     0x000000000000001d (RUNPATH)            Library runpath: [/opt/openssl/3.2/lib64]
     ...

And, FWIW, ENGINE_finish is available:

    $ objdump -T /opt/openssl/3.2/lib64/libcryptorpk.so.3 | grep ' ENGINE_finish'
    00000000001c8c70 g    DF .text  0000000000000080  OPENSSLRPK_3.0.0 ENGINE_finish

-- 
    Viktor.


More information about the openssl-users mailing list