Opened 6 months ago

Last modified 5 months ago

#73551 assigned defect

mesa @25.3.5: incorrect dylib path: @rpath/libgallium-25.3.5.dylib instead of /opt/local/lib/libgallium-25.3.5.dylib

Reported by: barracuda156 Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.12.2
Keywords: Cc: Dave-Allured (Dave Allured)
Port: mesa

Description

mesa uses incorrect dylib path here:

% otool -L /Users/svacchanda/Downloads/mesa-25.3.5_0.darwin_21.arm64/opt/local/lib/libGL.1.dylib
/Users/svacchanda/Downloads/mesa-25.3.5_0.darwin_21.arm64/opt/local/lib/libGL.1.dylib:
	/opt/local/lib/libGL.1.dylib (compatibility version 4.0.0, current version 4.0.0)
	@rpath/libgallium-25.3.5.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
	/opt/local/lib/libX11.6.dylib (compatibility version 11.0.0, current version 11.0.0)
	/opt/local/lib/libxcb-glx.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libxcb.1.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/lib/libX11-xcb.1.dylib (compatibility version 2.0.0, current version 2.0.0)
	/opt/local/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
	/usr/lib/libXplugin.1.dylib (compatibility version 1.0.0, current version 1.0.0)

(This is downloaded from official MacPorts packages, but locally I also have this issue building from source.)

Not a new issue, just no one noticed earlier, it seems.

Change History (4)

comment:1 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: jeremyhu removed
Owner: set to jeremyhu
Status: newassigned
Summary: mesa has incorrect dylib path: @rpath/libgallium-25.3.5.dylib instead of /opt/local/lib/libgallium-25.3.5.dylibmesa @25.3.5: incorrect dylib path: @rpath/libgallium-25.3.5.dylib instead of /opt/local/lib/libgallium-25.3.5.dylib

Although it is unusual in MacPorts to link with a library using @rpath, it should work. (LC_RPATH is correctly set to /opt/local/lib on libGL.1.dylib so it should be able to find libgallium-25.3.5.dylib there.) If this isn't working for you, what's the error message?

I see in a buildbot build log that libgallium-25.3.5.dylib's install_name is set to @rpath/libgallium-25.3.5.dylib at build time. I don't see how that's happening. Ideally we'd change that to /opt/local/lib/libgallium-25.3.5.dylib.

libgallium-25.3.5.dylib's install_name gets fixed to /opt/local/lib/libgallium-25.3.5.dylib by the time that it gets installed. I also don't see how that's happening.

I do see an old mesa bug report where it was indeed considered a bug that libraries were installed with rpath, and it was fixed. Maybe a new version of meson has broken this again.

comment:2 in reply to:  1 Changed 6 months ago by barracuda156

Replying to ryandesign:

Although it is unusual in MacPorts to link with a library using @rpath, it should work. (LC_RPATH is correctly set to /opt/local/lib on libGL.1.dylib so it should be able to find libgallium-25.3.5.dylib there.) If this isn't working for you, what's the error message?

The issue was raised to me in https://github.com/macos-powerpc/powerpc-ports/issues/88 Since it turned out that the path is also set to @rpath in upstream MacPorts version (unsurprisingly, as I did not change anything in that regard in my overlay), I opened the ticket.

I also think it is supposed to work, and perhaps in most cases it does (otherwise we would see a lot more failures), but it is desirable to fix it in any case.

comment:3 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

Ok, the error that was reported to you there was:

bash-3.2$ glxgears
dyld: Library not loaded: @rpath/libgallium-25.1.9.dylib
  Referenced from: /opt/local/lib/libGL.1.dylib
  Reason: image not found
Trace/BPT trap
bash-3.2$

I don't have much experience with libraries using @rpath since we don't usually have them in MacPorts. I thought perhaps the fact that LC_RPATH was set correctly on /opt/local/lib/libGL.1.dylib might be enough to make this work:

% otool -l /opt/local/lib/libGL.1.dylib | grep -B1 -A2 LC_R 
Load command 20
          cmd LC_RPATH
      cmdsize 32
         path /opt/local/lib (offset 12)

glxgears does run successfully for me on macOS 12 x86_64. But apparently for your user on Mac OS X 10.5 PowerPC, it's not enough. Maybe for this to work on older systems, LC_RPATH would need to be set on glxgears and every other thing using the library, but certainly that would be more work than just fixing the library path to be absolute instead of based on @rpath.

I don't think we're doing anything special in the mesa port to cause this, so you probably want to report it to the developers of mesa for them to fix.

comment:4 Changed 5 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added
Note: See TracTickets for help on using tickets.