-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native libraries put in MonoBundle on Mac NativeAot which dlopen cannot find #19520
Comments
DllNotFound_Mac, realm-wrappers
It appears that MonoBundle is the right place for native libs on mac but the step to add it as an rpath (#4435 ) isn't happening on NativeAOT. A workaround is to include |
I was not able to reproduce using SkiaSharp, everything works as expected, and the native executable has an rpath:
So could you please create a test project to reproduce this? If you want to submit it privately, you can create a new ticket here: https://developercommunity.visualstudio.com/VisualStudioMac/report, and then you can add private attachments once the ticket has been created. Please add the link to the new ticket here if you do this, so that we can easily connect them. |
@rolfbjarne Seems like it's Debug mode while bug is present only in Release mode with NativeAot enabled
https://github.com/FoggyFinder/MacOSApp1 tested with |
We add the dylib location as an rpath if the app has any location, so make sure to correctly detect dylibs in native references. Fixes xamarin#19520.
OK, I figured it out, thanks for the test case. A fix is in progress. |
We add the dylib location as an rpath if the app has any location, so make sure to correctly detect dylibs in native references. Fixes xamarin#19520.
#19520. (#19571) We add the dylib location as an rpath if the app has any location, so make sure to correctly detect dylibs in native references. Fixes #19520. Backport of #19560 --------- Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Steps to Reproduce
Use a package involving native library (e.g. Realm, SkiaSharp) on a ios and mac project with dotnet8 NativeAOT.
Expected Behavior
The app works in both projects.
Actual Behavior
The app works on ios but on macos fails. For example with Realm (using rd.xml or TrimmerRootDescriptor to preserve types since Realm has trim incompatibilities), it fails with:
The native dlls are placed in a
MonoBundle
folder whichdlopen
doesn't know about.If the native libraries are placed where
dlopen
can find them then the app works.Environment
Version information
Build Logs
To be added on request
Example Project (If Possible)
This can be simply reproduced with SkiaSharp. We are putting relevant code here. Can share a project privately (tricky on ios/mac because builds are hard, there are certificates, etc.).
csproj:
ViewController.cs (largely taken from https://github.com/mattleibow/skiasharp-samples/blob/main/Basic/macOS/SkiaSharpSample/ViewController.cs )
The text was updated successfully, but these errors were encountered: