-
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
dotnet6.0-macos preview: Linking fails on native reference dylib #15044
Comments
Can you try adding a |
Hi @mmoraga. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@rolfbjarne thanks for the quick reply. That seems to build! Will run a few tests to see if it also works correctly |
Now I've properly tested it. So prepending |
This was not intentional, but we won't fix it for the final release (too late for that). We might fix it for a later release though. |
@rolfbjarne I have the same problem with .NET MAUI, in xamarin forms macos this solution works fine. |
@angelru you're saying that adding a "lib" prefix to your native library doesn't work? If so, it's a different bug, which means a new issue should be filed. |
@rolfbjarne |
@angelru yes, that's a different issue. I'm not sure what's going on, but I believe that should be filed in https://github.com/dotnet/maui/issues. |
Thanks |
I really don't know how to fix this, is it .NET MAUI or Pkcs11Interop? |
It's probably Pkcs11Interop, but if you get a binary buildlog, I could have a look. |
@angelru you're including <NativeReference Include="Libs/libempty-pkcs11-x64.dylib">
<Kind>Dynamic</Kind>
<SmartLink>False</SmartLink>
</NativeReference> that has to be a library built for Mac Catalyst. You'll have to contact the people you got the library from, and ask them for a library built for Mac Catalyst (a library built for macOS does not work). |
|
@angelru try building the library with catalyst target as seen here: https://developer.apple.com/forums/thread/122571
|
I don't know very well where I have to put those commands, in the build.sh? |
xamarin#15044. For a given dylib named '/path/to/libMyLibrary.dylib', we pass this to the native linker: -L/path/to -lMyLibrary however, that doesn't work unless the dylib's name starts with 'lib'. So detect this, and if the dylib doesn't start with 'lib' (say it's just 'MyLibrary.dylib'), then just pass the path to the dylib as-is to the native linker: /path/to/MyLibrary.dylib Fixes xamarin#15044.
#15044. (#18496) For a given dylib named '/path/to/libMyLibrary.dylib', we pass this to the native linker: -L/path/to -lMyLibrary however, that doesn't work unless the dylib's name starts with 'lib'. So detect this, and if the dylib doesn't start with 'lib' (say it's just 'MyLibrary.dylib'), then just pass the path to the dylib as-is to the native linker: /path/to/MyLibrary.dylib Fixes #15044.
I have a Xamarin.mac app that uses https://github.com/Pkcs11Interop to interact with smartcards. Due to an implementation detail (Pkcs11Interop/Pkcs11Interop#109) the library requires a dylib with required symbols to be present at build time. For this a simple library with empty implementations of the pkcs interface can be used.
Steps to Reproduce
empty-pkcs11-x64.dylib
dotnet build
Expected Behavior
With current Xamarin.Mac, the linking succeeds and the app can be built.
Actual Behavior
The build fails at the linking stage:
Environment
Version information
Build Logs
msbuild.binlog.zip
Example Project (If Possible)
The text was updated successfully, but these errors were encountered: