Repository navigation
Application referencing a native framework signing issue #5213
Description
In my project I have referenced a Native framework (not signed). When I compile, the framework is copied to the bundle inside the /Contents/Frameworks as expected and everything works ok.
However when I try to deep sign the bundle it shows:
"bundle format is ambiguous (could be app or framework) In Subcomponent: "
According to Apple, only two things allowed at the root of a framework folder: symlinks and the Versions directory. I checked the original framework and it is compliant, however when Xamarin copies the framework to the bundle it replaces the symlinks with the real files.
To confirm this was the issue, I copied manually the framework to the the bundle and I was able to sign the bundle successfully.
As a workaround I added a postbuild task to my project to delete the framework from the compiled bundle and copy it with copy -R command to keep the symlinks.
Steps to Reproduce
- Create a new project and add a 3rd party framework as a native reference
- Compile to Release
- sign manually the bundle with:
codesign --force --sign "my signature ID" "MyApplication.app" --deep
Expected Behavior
The native framework is copied to the bundle in /Contents/Frameworks as it is in the origin
Application signed correctly
Actual Behavior
Xamarin copied the Framework replacing symlinks with the real files
The codesign tool failed with:
"bundle format is ambiguous (could be app or framework) In Subcomponent: "
Environment
=== Visual Studio Community 2017 for Mac ===
Version 7.7 (build 1868)
Installation UUID: e238b76e-7013-49fd-9574-267eccb5a563
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e)
Package version: 516000221
=== Mono Framework MDK ===
Runtime:
Mono 5.16.0.221 (2018-06/b63e5378e38) (64-bit)
Package version: 516000221
=== NuGet ===
Version: 4.7.0.5148
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.1.2
2.0.5
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Versions:
2.1.302
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Xamarin.Android ===
Not Installed
=== Android Device Manager ===
Version: 7.7.1.0
Hash: 06ceaea1
=== Apple Developer Tools ===
Xcode 9.4.1 (14161)
Build 9F2000
=== Xamarin.Mac ===
Version: 5.2.1.11 (Visual Studio Community)
Hash: 5ef73d3
Branch:
Build date: 2018-11-21 00:03:25-0500
=== Xamarin.iOS ===
Xamarin.iOS not installed.
Can't find mtouch or the Version file at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current.
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 707001868
Git revision: 8bcdfa96d67c8c88dc45728cc968a2f84b55322f
Build date: 2018-11-22 12:19:29+00
Build branch: release-7.7
Xamarin extensions: d66dbedcda237cd9b546abfecfeecafba6f8e3cb
=== Operating System ===
Mac OS X 10.14.0
Darwin 18.0.0 Darwin Kernel Version 18.0.0
Wed Aug 22 20:13:40 PDT 2018
root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
Activity
VincentDondain commentedon Nov 30, 2018
Hi,
Sorry I'm having a hard time reproduce this issue.
I created a new iOS project and added an Objective-C native framework I manually created as native reference.
/Contents/Frameworks, onlyMyApp.app/Frameworks/MyFramework.framework.codesign --force --sign "my signature ID" "MyApplication.app" --deepon that app bundle... I simply getiOSTest.app: replacing existing signature. Also I'm not quite sure why you're trying to manually run thecodesign --deep.Could you please provide us a test case or different instruction to reproduce this?
pp111 commentedon Nov 30, 2018
Hi,
the project is for Mac, not iOS.
pp111 commentedon Nov 30, 2018
I added a test case.
As you can see in the test case, the native framework that is in the Release/Test.app/Contents/Frameworks/MMTabBarView.framework has the file MMTabBarView directly in the root instead of a symlink to it like in the original library.
VincentDondain commentedon Nov 30, 2018
Ah yes I can confirm the issue with Xamarin.Mac and your test case. Your framework is different than mine because it's using symlinks.
I do see that when building for release, our build steps seem to replace the
MMTabBarViewbinary symlink by the actual file.I also got:
I was also able to confirm that Xamarin.iOS behaves correctly with a
.frameworkwith symlinks like yours. It's not removing the symlinks (as expected).Change this to a macOS only issue.
Thanks a lot.
spouliot commentedon May 12, 2021
That was likely fixed in the
.xcframeworksupport (late last year) even if it seems (user report) stabled16-9does not have all the fixes.Using
mainwe can seeContents/Frameworks/MMTabBarView->Versions/Current/MMTabBarViewso the symlinks are preserved.https://gist.github.com/spouliot/b749d8d0c33489a90da050a8a9c84a47
xfortin-devolutions commentedon May 17, 2021
I've had to update Sparkle in my application and encountered the same issue. This is especially weird since older Framework (that have not been updated) do not have this issue. Any idea when this will be fixed in an official version?
generating proper .framework folder structure