I have built and install code to my directory /usr/local/lib:
ls /usr/local/lib:
drwxr-xr-x 2 root root 4096 Apr 9 13:04 LibreSSLdrwxr-xr-x 3 root root 4096 Mar 20 09:54 netscapedrwxr-xr-x 2 root root 4096 Apr 9 20:06 pkgconfigdrwxrwsr-x 4 root staff 4096 Dec 28 21:56 python2.7drwxrwsr-x 3 root staff 4096 Oct 17 09:24 python3.7-rw-r--r-- 1 root root 21403926 Apr 8 18:05 libcrypto.a-rwxr-xr-x 1 root root 969 Apr 8 18:05 libcrypto.lalrwxrwxrwx 1 root root 19 Apr 8 18:05 libcrypto.so -> libcrypto.so.46.0.1lrwxrwxrwx 1 root root 19 Apr 8 18:05 libcrypto.so.46 -> libcrypto.so.46.0.1-rwxr-xr-x 1 root root 10741400 Apr 8 18:05 libcrypto.so.46.0.1-rw-r--r-- 1 root root 4714494 Apr 8 18:05 libssl.a-rwxr-xr-x 1 root root 976 Apr 8 18:05 libssl.lalrwxrwxrwx 1 root root 16 Apr 8 18:05 libssl.so -> libssl.so.48.0.1lrwxrwxrwx 1 root root 16 Apr 8 18:05 libssl.so.48 -> libssl.so.48.0.1-rwxr-xr-x 1 root root 2219448 Apr 8 18:05 libssl.so.48.0.1-rw-r--r-- 1 root root 870622 Apr 8 18:05 libtls.a-rwxr-xr-x 1 root root 1001 Apr 8 18:05 libtls.lalrwxrwxrwx 1 root root 16 Apr 8 18:05 libtls.so -> libtls.so.20.0.1lrwxrwxrwx 1 root root 16 Apr 8 18:05 libtls.so.20 -> libtls.so.20.0.1-rwxr-xr-x 1 root root 433640 Apr 8 18:05 libtls.so.20.0.1-rwxr-xr-x 1 root root 958 Apr 9 20:06 libwolfssl.lalrwxrwxrwx 1 root root 20 Apr 9 20:06 libwolfssl.so -> libwolfssl.so.24.0.0lrwxrwxrwx 1 root root 20 Apr 9 20:06 libwolfssl.so.24 -> libwolfssl.so.24.0.0-rwxr-xr-x 1 root root 473280 Apr 9 20:06 libwolfssl.so.24.0.0
I want to use hmac.h
from wolfssl. However, when I run gcc -L/usr/local/lib -o my_hmac_test my_hmac_test.c -lwolfssl
the code builds with a warning that address later:
In file included from /usr/local/include/wolfssl/wolfcrypt/types.h:29, from /usr/local/include/wolfssl/wolfcrypt/hash.h:29, from /usr/local/include/wolfssl/wolfcrypt/hmac.h:31, from my_hmac_test.c:1:/usr/local/include/wolfssl/wolfcrypt/settings.h:2053:14: warning: #warning "For timing resistance / side-channel attack prevention consider using harden options" [-Wcpp] 2053 | #warning "For timing resistance / side-channel attack prevention consider using harden options" | ^~~~~~~
However, when I run the code. I get this error:
./my_hmac_test: error while loading shared libraries: libwolfssl.so.24: cannot open shared object file: No such file or directory
How can I fix this?
strace -f -e open gcc -L/usr/local/lib -o my_hmac_test my_hmac_test.c -lwolfssl:
strace: Process 32629 attachedIn file included from /usr/local/include/wolfssl/wolfcrypt/types.h:29, from /usr/local/include/wolfssl/wolfcrypt/hash.h:29, from /usr/local/include/wolfssl/wolfcrypt/hmac.h:31, from my_hmac_test.c:1:/usr/local/include/wolfssl/wolfcrypt/settings.h:2053:14: warning: #warning "For timing resistance / side-channel attack prevention consider using harden options" [-Wcpp] 2053 | #warning "For timing resistance / side-channel attack prevention consider using harden options" | ^~~~~~~[pid 32629] +++ exited with 0 +++--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=32629, si_uid=1000, si_status=0, si_utime=2, si_stime=1} ---strace: Process 32630 attached[pid 32630] +++ exited with 0 +++--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=32630, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---strace: Process 32631 attachedstrace: Process 32632 attached[pid 32632] +++ exited with 0 +++[pid 32631] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=32632, si_uid=1000, si_status=0, si_utime=1, si_stime=1} ---[pid 32631] +++ exited with 0 +++--- SIGCHLD {si_signo=SI