scopehal-apps icon indicating copy to clipboard operation
scopehal-apps copied to clipboard

macOS: ngscopeclient binary is missing RPATH load command

Open rgov opened this issue 2 years ago • 4 comments

I built ngscopeclient on macOS 14.0. The binary links in several libraries using @rpath:

% otool -L $(which ngscopeclient) | grep @rpath  
	@rpath/libscopeprotocols.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libscopeexports.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libscopehal.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libvulkan.1.dylib (compatibility version 1.0.0, current version 1.3.231)

However the binary does not contain any LC_RPATH load commands, so @rpath is undefined.

% ngscopeclient                              
dyld[45566]: Library not loaded: @rpath/libscopeprotocols.dylib
  Referenced from: <87EE124C-9597-35DF-9F0A-5A19B4B39F9F> /opt/homebrew/Cellar/ngscopeclient/HEAD-6056adc/bin/ngscopeclient
  Reason: no LC_RPATH's found

Note: I built using the Homebrew formula in this issue.

rgov avatar Oct 29 '23 20:10 rgov

  • @lainy

azonenberg avatar Oct 29 '23 20:10 azonenberg

I added the CMake argument -DCMAKE_INSTALL_RPATH="@loader_path/../lib;/opt/VulkanSDK/1.3.231.1/macOS/lib" to work around the issue.

Load command 50
    cmd LC_RPATH
     cmdsize 48
     path /opt/VulkanSDK/1.3.231.1/macOS/lib (offset 12)
Load command 54
     cmd LC_RPATH
     cmdsize 32
     path @loader_path/../lib (offset 12)

rgov avatar Oct 29 '23 21:10 rgov

Yeah I don't think we currently have install support on macos (i.e. it's assumed you are running from the build directory).

Not surprised there's rough edges if you try to do a systemwide install, but the feedback is welcome as proper installability/packaging is one of the things we're trying to fix before the v0.1 release.

azonenberg avatar Oct 29 '23 21:10 azonenberg

You probably need -DCMAKE_INSTALL_RPATH=#{rpath} in your formula, as many other formulas also have this.

d235j avatar Jan 28 '24 01:01 d235j