Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.2.0
-
None
Description
I'm compiling qdoc & lupdate with clang/clangcpp on linux
These cmake options are set:
-DFEATURE_clang=ON
{{ -DFEATURE_clangcpp=ON}}
{{ -DTEST_libclang=ON}}
{{ -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON}}
The resulting binary of lupdate and qdoc have a custom library search path when llvm/clang/clangcpp is used.
$ readelf -d /build/qt6/qt-everywhere-src-6.2.0/debian/build-host/qtbase/bin/lupdate 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib:/usr/lib/llvm-11/lib:] $ readelf -d /build/qt6/qt-everywhere-src-6.2.0/debian/build-host/qtbase/bin/qdoc 0x000000000000001d (RUNPATH) Library runpath: [/usr/lib/llvm-11/lib:$ORIGIN/../lib:]
In build.ninja, for lupdate (for example), we have:
LINK_LIBRARIES = -Wl,-rpath,"\$$ORIGIN/../lib:/usr/lib/llvm-11/lib:" qtbase/lib/libQt6QmlDevTools.a qtbase/lib/libQt6Core.so.6.2.0 /usr/lib/llvm-11/lib/libclang-11.so.1 /usr/lib/llvm-11/lib/libclang-cpp.so.11 /usr/lib/llvm-11/lib/libLLVM-11.so.1 -lpthread
Would it be possible to remove /usr/lib/llvm-11/lib from the path? Among other things, it is not conform to Debian policy.
You can get more information on the reasons cited below (from: https://lintian.debian.org/tags/custom-library-search-path)
The binary or shared library sets RPATH or RUNPATH. This overrides the normal library search path, possibly interfering with local policy and causing problems for multilib, among other issues.
The only time a binary or shared library in a Debian package should set RPATH or RUNPATH is if it is linked to private shared libraries in the same package. In that case, place those private shared libraries in /usr/lib/package. Libraries used by binaries in other packages should be placed in /lib or /usr/lib as appropriate, with a proper SONAME, in which case RPATH/RUNPATH is unnecessary.
To fix this problem, look for link lines like: gcc test.o o test -Wl,rpath,/usr/local/lib or gcc test.o -o test -R/usr/local/lib and remove the -Wl,-rpath or -R argument. You can also use the chrpath utility to remove the RPATH.
Please refer to https://wiki.debian.org/RpathIssue for details.