mpeylo / cmpossl

An OpenSSL-based implementation of the Certificate Management Protocol (CMP), defined in IETF RFCs 4210, 4211, and 6712. It is being extended according to the emerging RFCs 'CMP Updates' (CMPv3), 'CMP Algorithms', and 'Lightweight CMP Profile'.
https://github.com/mpeylo/cmpossl/wiki
Other
35 stars 13 forks source link

Openssl build issue #159

Closed gowenpotato closed 5 years ago

gowenpotato commented 5 years ago

After using the default install method on Ubuntu 18.04 LTS (with below options)

./config --debug --prefix=/opt/openssl no-ssl

I received an error:

/opt/openssl/bin/openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

after performing strace I just did this from within the cmpossl directory:

sudo cp libssl.so.3 /usr/lib/x86_64-linux-gnu/libssl.so.3
sudo cp libcrypto.so.3 /usr/lib/x86_64-linux-gnu/libcrypto.so.3

and the fix worked - is this a bug or is this expected behaviour?

mpeylo commented 5 years ago

Seems like expected behavior to me. This happens when the libraries are not put to the default directories (what you obviously don't want to do as you use --prefix).

I speculate that it would load if you add LD_LIBRARY_PATH=/opt/openssl/lib/ to your environment when you want to execute your "special" openssl with CMP. Like

LD_LIBRARY_PATH=/opt/openssl/lib /opt/openssl/bin/openssl cmp --help

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html might be an interesting source of related information.

That one might be easier than strace: man ldd

gowenpotato commented 5 years ago

I just tried installing with nothing passed as arguments during ./config, and I get the same error. The openssl now lives in

user$/usr/local/bin/openssl
/usr/local/bin/openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

so I go and search for the libssl.so.3 file:

user$sudo find / -iname "*libssl.so.3"
/home/LocalAdminUser/cmpossl-cmp/libssl.so.3
/usr/local/lib/libssl.so.3

so I try your trick

LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/openssl cmp --help

and this now works - so this was necessary even on the default install - or am I missing something?

DDvO commented 5 years ago

This issue is a pretty general one, not an CMPforOpenSSL one, and not even an OpenSSL one.

Whether /usr/local/lib is searched automatically depends on your system settings. See https://unix.stackexchange.com/questions/67781/use-shared-libraries-in-usr-local-lib for details.

gowenpotato commented 5 years ago

OK, thanks very much - I am not very experienced on Linux, but if this is on a platform as common as Ubuntu it might be worth a note in the "default install" section?