Linking of native static library fails and the resulting package is including the native reference
See original GitHub issueDescription
When binding a native library the library is not statically linked to the executable. When the this package is consumed by the MAUI project the library is still not linked in to the iOS app so when packaged into a .ipa file the library is still not linked in and Apple rejects the app because of a the library being dynamic linked and its not a framework.
When building and packing the reproduction project (libmds.a is in Git LFS) the file libmds.a is added to the StaticLinkingNotWorking.1.0.0.nupkg under lib -> net7.0-ios16.1 -> StaticLinkingNotWorking.resources -> libmds.a
What I expected was for it to be linked into the lib -> net7.0-ios16.1 -> StaticLinkingNotWorking.dll file as it was when using the Xamarin binding project.
But whatever I do to try to statically link libmds.a it seems like the project insists on making it dynamically linked and add libmds.a as it was before.
I hope this repository is the correct place to report this issue, if not please point me to the correct place.
I can consume the package and get a running application locally on a iOS device but this issue causes uploads to AppStore to fail. The exact fail is this one:
Asset validation failed (90171) Invalid bundle structure. The “testApp.app/libmds.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle
(I changed the name of the app to testApp)
Steps to Reproduce
- Create a iOS binding project
- Add native static library (.a) file
- Build the project
- pack the project
Expected: libmds.a statically linked into the StaticLinkingNotWorking.dll file
Actual libmds.a added to the StaticLinkingNotWorking.resources folder and not linked in to the dll file.
Link to public reproduction project repository
https://github.com/tentom/staticLinkingNotWorking
Version with bug
7.0.92
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No known workarounds found.
Relevant log output
No response
Issue Analytics
- State:
- Created a month ago
- Comments:7 (5 by maintainers)
This should be transferred to http://github.com/xamarin/xamarin-macios, unless I’m missing some context this isn’t related to the MAUI UI project.
This issue was moved to xamarin/xamarin-macios#18751