Hello. I am new to wolfssl.
I compiled the latest versions of wolfssl and wolfCLU, on two systems - my laptop running archlinux and a raspberry pi running raspbian (a debian-based distro), and ran ldconfig on both of them.
On my pi the wolfssl library runs as expected. I run the example server code given here https://www.wolfssl.com/docs/quickstart/ and compile it using
gcc server.c -lwolfssl -o server
and run server. It gives me
as expected.
But if I run it on my archlinux laptop, I get,
./server: error while loading shared libraries: libwolfssl.so.45: cannot open shared object file: No such file or directory
I guess this is happening because the compiled program looks for libraries in /usr/lib but libwolfssl.so.45 gets installed in /usr/local/lib. So one easy fix is to create a symbolic link in /usr/lib that points to /usr/local/lib/libwolfssl.so.45. Another fix would be to provide the correct install prefix /usr/lib while building wolfssl (I haven't tried this though).
My question is not about how to fix this or how to get `server` to run, but rather why is this happening. I am trying to understand the compilation process for programs that use wolfssl. What is different on my laptop from my pi that is making this happen? The libwolfssl.so.45 is in /usr/local/lib in both cases.
Here is the output of gcc -v on both my machines, if that helps:
On laptop:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/16/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-gcc-major-version-only --with-linker-hash-style=gnu --with-system-zlib --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-fixincludes --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.1.1 20260625 (GCC)
and on pi:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/12/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14+deb12u1' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14+deb12u1)
The environment variable $LD_LIBRARY_PATH is not set in both cases.