Open alanc opened 2 years ago
https://github.com/oracle/solaris-userland/commit/b6cb6e29df305814649bc5153372111d1d17fd41 is the patch we're applying in the Solaris build of meson-0.63.3 for this for now.
We're also seeing something similar on darwin, where we use -Wl,-rpath
and not -Wl,-R
. In my case, I'm specifying -Wl,-rpath,/opt/X11/lib/asan
in LDFLAGS at configure time.
$ otool -l ./build.arm64/cvt/cvt | grep -B1 -A2 LC_RPATH
Load command 16
cmd LC_RPATH
cmdsize 32
path /opt/X11/lib/asan (offset 12)
Load command 17
cmd LC_RPATH
cmdsize 32
path @loader_path/../lib (offset 12)
Load command 18
cmd LC_RPATH
cmdsize 32
path @executable_path (offset 12)
Load command 19
cmd LC_RPATH
cmdsize 128
path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/lib/darwin (offset 12)
[1037] ~/src/freedesktop/github/XQuartz/src/xorg/lib/libxcvt (master) $ otool -l /opt/X11/bin/cvt | grep -B1 -A2 LC_RPATH
# nada
Hmm... it looks like the darwin case is different. It looks like you are matching -Wl,-rpath,...
, and it looks like you intend to honor LDFLAGS that were specificed:
# Don't remove rpaths specified in LDFLAGS.
if libdir in self.get_external_rpath_dirs(target):
continue
but it's still getting stripped. I've filed another ticket for this: #11109
Describe the bug When building mesa for Solaris with meson-0.63.3 a number of libraries which linked to /usr/lib/xorg/libdrm.so.1 had the /usr/lib/xorg path removed from RPATH by "meson install", leaving the libraries unable to be used by programs:
This happens despite pkg-config listing the needed path correctly:
To Reproduce Build a project with dependencies on a library in a non-default path for which pkg-config correctly provides -R flags to link with.
Expected behavior "meson install" to leave the required RPATH/RUNPATH in the installed binary that was created correctly during the build stage.
system parameters
One of our engineers found that reverting commit 06b1132f82eaaf805021b4b088701d9754e2af38 fixed this, which is odd, since the description of that commit makes it sound like it should fix this.
In the build directory
elfdump -d src/egl/libEGL.so.1.0.0
shows the RPATH was set correctly when the library was built, but thenmeson install
strips it and there is no RPATH in$DESTDIR/usr/lib/libEGL.so.1.0.0
.Digging further, it looks like
get_rpath_dirs_from_link_args
checks for which RPATHs to keep by looking for-Wl,-R
flags, but our pkg-config files all report-R
flags: https://github.com/mesonbuild/meson/blob/master/mesonbuild/backend/backends.py#L699Adding a match for
-R
flags there seems to fix the problem, and leaves/usr/lib/xorg
in the RPATH in$DESTDIR/usr/lib/libEGL.so.1.0.0
.