Open leorich opened 1 year ago
I can also replicate this issue.
Not a meson issue, but more of an undocumented change (bug?) in behaviour with XCode 15. /usr/local/lib
is no longer a preferred search location for dyld, so you cannot just dump a lib there and expect the linker to always find it. https://developer.apple.com/forums/thread/737920
Describe the bug
After macOS was updated, xcode was updated from 14 => 15, I am having runtime linker troubles. I don't understand what is happening behind the scenes from 14=>15 that is causing the new issues, but i have characterized the issue and tried tweaking some flags to get things to work.
setup
andbuild
with my project is successful, but dyld runtime linking is not working anymore (worked fine on xcode 14). Note: I am trying to link to a library that is installed to /usr/local/lib which should be on default library search path.I have tested two cases 1) the example in the 'To reproduce' section below, 2) a larger project that involves cmake and explicitly loading libs with dlopen.
Runtime error looks something like this with case 1:
But with case 2 the error looks more like this:
In the simple case 1 - I was able to
export DYLD_LIBRARY_PATH=/usr/local/lib
and runtime worked fine. However, for case (2) this did not fix the dlopen error.If I instead set
export LDFLAGS="-rpath /usr/local/lib"
- that gets rid of the runtime linking issue in both cases.. (and also results in a lot ofld: warning: duplicate -rpath '/usr/local/lib' ignored
chatter)I also messed with
OTHER_LDFLAGS=-ld_classic
per xcode 15 release notes to no avail.more info on case 2
I have yet to reproduce the issue just by trying to dlopen a library built by meson that depends on a /usr/local/lib.. the setup where i see the error is a little more complicated by cmake:
libraryA
libraryB
I cant dlopen libraryA because it cant load/dlopen the third-party lib. This may very well be a cmake issue (on the cmake side,
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH="ON"
has been fixing my pure cmake projects - they broke in this update too)I will keep working on a minimal example to reproduce this.. and this issue could be on me with a bad cmake file - but it did work before the update.
To Reproduce install fastrtps (or some third party library) to /usr/local
Expected behavior No runtime errors, as it worked on the same system just before the update from 14 to 15.
Did not expect to need to modify env with
export DYLD_LIBRARY_PATH=/usr/local/lib
orexport LDFLAGS="-rpath /usr/local/lib"
system parameters
Some concerning? meson output: