Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 52443 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
On 4.6.2 and previous versions it was possible to use the OSX codesign tool to sign binaries created with mkbundle. In 4.8.0 (RC Refresh build 188.8.131.523) codesign fails to process these binaries.
If you do not already have a code signing certificate, create a test signing certificate as described here : https://developer.apple.com/library/content/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
$ mono --version
Mono JIT compiler version 4.8.0 (mono-4.8.0-branch/ba7f169 Fri Feb 3 13:34:24 EST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
# Any .NET executable will do to demonstrated this problem
$ cp /Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5/cert-sync.exe .
# --cross default used as a workaround to error message about one of the i18n assemblies not being found
$ mkbundle --static --cross default cert-sync.exe
Using runtime: /Library/Frameworks/Mono.framework/Versions/4.8.0/bin/mono
$ ls -l
-rwxr-xr-x 1 robin staff 5210252 10 Feb 12:01 a.out
-rwxr-xr-x 1 robin staff 16896 10 Feb 12:01 cert-sync.exe
# use the name of your signing cert
$ codesign -s '<signingcert>' --force -v a.out
a.out: main executable failed strict validation
# --no-strict still fails but gives a more informative error message
$ codesign -s '<signingcert>' --force -v --no-strict a.out
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: /Users/robin/tmp/a.out
a.out: the codesign_allocate helper tool cannot be found or used
[Note - the --static option to mkbundle seems to have no effect in this version of mono - the binary produced is the same size with or without that option - will raise a separate bug]
There is some discussion online of similar issues caused by appending data to the executable binary, for example with pyInstaller - https://github.com/pyinstaller/pyinstaller/wiki/Recipe-OSX-Code-Signing and Qt - https://bugreports.qt.io/browse/QTIFW-153
The failure to sign looks to be a result of using the '--cross default' workaround to avoid the problem with 'ERROR: Couldn't load one or more of the i18n assemblies.'
The use of '--cross default' appears to be a bad idea for working around this issue which is actually caused by the main mono SDK path not being added to the link_paths list in mkbundle by default.
It looks like this can be added manually using -L or using the --sdk or --runtime options, but if none of those options are set then the link_paths list only contains '.' and bundling fails.
So I think that the underlying issue is that there is no default sdk path selection in mkbundle in 4.8.0. If that is by design then the error message printed should be clear that the user must use --sdk or --runtime or -L to set the SDK path.
There may also be a real issue with the inability to sign when using --cross default, but there seems to be an acceptable workaround for this of not using --cross default
mkbundle with the --sdk option (and --static) creates a binary that cannot be signed (just like --cross default)
mkbundle with the -L option (and --static) creates a binary that can be signed.
This looks related to your changes to mkbundle.