Error in OpenSSL when compiling code locally for raspberry pie
Error content
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_keylog_callback@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_post_handshake_auth@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_ciphersuites@OPENSSL_1_1_1'
Raspberry pie still reports an error when querying the OpenSSL version number locally
openssl version
Error content:
openssl: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)
openssl: /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)
Problem source:
After inquiry, it is mainly LD_LIBRARY_environment variable path is not specified, so OpenSSL is using the old system OpenSSL library
Solution:
Temporary solution: the terminal enters the following command to temporarily add the environment variables of OpenSSL library, but this method can only ensure that the current terminal is valid. If a new terminal is opened, an error will still be reported
export LD_LIBRARY_PATH=/usr/local/lib
Permanent solution: modify the. Bashrc hidden file in the working directory, taking raspberry pie as an example
vi /home/pi/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib
source .bashrc
sudo reboot
You can also enter the following command
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc
After completing the above series of operations, you can enter the following commands to check whether it is normal
pi@raspberrypi:~ $ openssl
OpenSSL> version
OpenSSL 1.1.1l 24 Aug 2021
OpenSSL> q
Finally, the problem is solved and the compiled code is an error