Don’t set RUNPATH if it is the system search path - CMAKE_SKIP_RPATH
The following encfs commit forces RPATH https://github.com/vgough/encfs/commit/31e302cb4a210b2fbd74e173f86907ce1b20d86c on Linux.
https://github.com/vgough/encfs/blob/c444f9b9176beea1ad41a7b2e29ca26e709b57f7/CMakeLists.txt#L322-L323
With the cleanup of RPATH/RUNPATH in - https://github.com/LibreELEC/LibreELEC.tv/pull/6094 - we are cleaning up incorrect and unnecessary RPATH/RUNPATH, we have used the CMAKE_SKIP_RPATH build option but given that encfs and encfsctl are including the system search path - the RUNPATH is unnecessary.
reading:
- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
Suggest that RUNPATH can still be used when installing, but only if it's not a system directory (as per the wiki) so that it is not necessary to use CMAKE_SKIP_RPATH
# readelf --dynamic /usr/bin/encfs | grep '\['
0x0000000000000001 (NEEDED) Shared library: [libfuse.so.2]
0x0000000000000001 (NEEDED) Shared library: [libssl.so.3]
0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.3]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000001d (RUNPATH) Library runpath: [/usr/lib]
readelf --dynamic /usr/bin/encfsctl | grep '\['
0x0000000000000001 (NEEDED) Shared library: [libfuse.so.2]
0x0000000000000001 (NEEDED) Shared library: [libssl.so.3]
0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.3]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000001d (RUNPATH) Library runpath: [/usr/lib]
# LD_LIBRARY_PATH= LD_DEBUG=libs ldd -v encfs