Bug 35864 - MTOUCH: error MT0000: Unexpected error - when adding --bitcode=asmonly
Summary: MTOUCH: error MT0000: Unexpected error - when adding --bitcode=asmonly
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.TVOS.dll ()
Version: XI 9.3 (xcode 7.1 previews)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 35821 35903 ()
Depends on:
Blocks:
 
Reported: 2015-11-14 16:24 UTC by Vincent Roggero
Modified: 2016-01-13 20:23 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
build log (167.48 KB, text/plain)
2015-11-14 16:24 UTC, Vincent Roggero
Details
Build log for 'Use llvm' option (146.55 KB, text/plain)
2015-11-16 08:37 UTC, Vincent Roggero
Details
Build log for -gcc_flags (168.25 KB, text/plain)
2015-11-30 15:46 UTC, Vincent Roggero
Details
Config for gcc_flags issue (1.44 KB, text/plain)
2015-11-30 15:48 UTC, Vincent Roggero
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Vincent Roggero 2015-11-14 16:24:13 UTC
Created attachment 13811 [details]
build log

Trying to resolve an 'iTunesConnect Invalid Executable - The exe does not contain bitcode' error.
Per https://forums.xamarin.com/discussion/comment/163345/#Comment_163345 I've added --bitcode=asmonly to my project's iOS build config. When I build I hit (full log attached);

clang: error: linker command failed with exit code 1 (use -v to see invocation)
		
MTOUCH: error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
		System.NullReferenceException: Object reference not set to an instance of an object
		  at MonoTouch.Target.GetMemberForSymbol (System.String symbol) [0x00000] in <filename unknown>:0 
		  at MonoTouch.Application.ProcessNativeLinkerOutput (MonoTouch.Target target, System.String output, IList`1 inputs, System.Collections.Generic.List`1 errors, Boolean error) [0x00000] in <filename unknown>:0 
		  at MonoTouch.Target.NativeLink () [0x00000] in <filename unknown>:0 
		  at MonoTouch.Application.BuildApp () [0x00000] in <filename unknown>:0 
		  at MonoTouch.Application.Build () [0x00000] in <filename unknown>:0 
		  at MTouch.Main2 (System.String[] args) [0x00000] in <filename unknown>:0 
		  at MTouch.Main (System.String[] args) [0x00000] in <filename unknown>:0 
		/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -fembed-bitcode -arch arm64 -mtvos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/THXTune-up.exe.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/mscorlib.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/Tools_tvOS.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/System.Core.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/System.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/System.Xml.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/Mono.Dynamic.Interpreter.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/Xamarin.TVOS.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/ToolsTVOS.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/System.Runtime.Serialization.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/System.ServiceModel.Internals.dll.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/registrar.arm64.o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/main.arm64.o -o /Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/bin/iPhone/Release/THXTune-up.app/THXTune-up -framework CoreGraphics -framework CoreMedia -framework Foundation -framework UIKit -framework AVFoundation -framework AVKit -framework AudioToolbox -framework QuartzCore -framework SystemConfiguration -framework CFNetwork -lz -liconv /Library/Frameworks/Xamarin.iOS.framework/Versions/9.3.1.63/SDKs/Xamarin.AppleTVOS.sdk/usr/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.3.1.63/SDKs/Xamarin.AppleTVOS.sdk/usr/lib/libxamarin.a /Library/Frameworks/Xamarin.iOS.framework/Versions/9.3.1.63/SDKs/Xamarin.AppleTVOS.sdk/usr/lib/libapp.a -dead_strip
	Task "MTouch" execution -- FAILED


Config;
=== Xamarin Studio ===

Version 5.10 (build 988)
Installation UUID: 5df374dd-127a-4b3e-bfa6-0a872d52b886
Runtime:
	Mono 4.0.4 ((detached/d481017)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040004

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.1.1 (9081)
Build 7B1005

=== Xamarin.Mac ===

Version: 2.0.2.111 (Starter Edition)

=== Xamarin.iOS ===

Version: 9.3.1.63 (Business Edition)
Hash: efb0d4d
Branch: master
Build date: 2015-10-27 01:36:02-0400

=== Xamarin.Android ===

Version: 5.1.8.0 (Business Edition)
Android SDK: /Users/vincentr/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)

SDK Tools Version: 24.1.2
SDK Platform Tools Version: 22.0.0
SDK Build Tools Version: 22.0.1

Java SDK: /usr
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 510000988
Git revision: e2bb36197f892ea0fd385585a02cf68cf4f03b5f
Build date: 2015-10-26 12:23:51-04
Xamarin addins: b333d5f54ab244893787ad30eee07e43112fe175
Build lane: monodevelop-lion-xcode7.1

=== Operating System ===

Mac OS X 10.10.5
Darwin Vincents-iMac.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2015-11-15 12:15:37 UTC
The logic is missing from the current preview of XS/XI but `--bitcode` can only* be used with the LLVM backend (bitcode is LLVM intermediate representation). Your logs show that LLVM is not enabled.

> UseLlvm: False

Try rebuilding with LLVM enabled.

* not a bad thing for release builds as it generates better and smaller code.

The errors you're seeing are due to Apple's native linker not supporting `-u`. Apple fixed that in Xcode 7.2 fix that, but it's *not* allowed right now to submit applications. We do have some workarounds before that but I'm not sure why they don't work in this case (non-LLVM release builds are not really a tested configuration as this is not something that will be usable for the AppStore).
Comment 2 Sebastien Pouliot 2015-11-15 12:37:27 UTC
So the `MT0000` can only happen when `--bitcode` is used with out `--llvm` and that will be turned into an error in the future. Thanks for spotting and reporting this!

It also explains why the workarounds I mentioned did not apply, so I believe your LLVM build should not hit those (but please let us know).
Comment 3 Sebastien Pouliot 2015-11-15 13:08:13 UTC
MT3008 error added in 
maccore/master 0d95fe07b13c15d7d53c46b34941280609d6f3db

note: XS (unreleased) UI will not allow enabling `bitcode` without `llvm`
Comment 4 Vincent Roggero 2015-11-16 08:37:49 UTC
Created attachment 13820 [details]
Build log for 'Use llvm' option
Comment 5 Vincent Roggero 2015-11-16 08:39:15 UTC
Tried -- llvm and get and error that the llvm option is deprecated.

Tried 'Use LLVM optimizing compiler' and get;

	MTOUCH: error MT5209: Native linking error: building for tvOS, but linking in object file built for iOS, file '/Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/obj/iPhone/Release/mtouch-cache/THXTune-up.exe.arm64-llvm.o' for architecture arm64
	MTOUCH: error MT5202: Native linking failed. Please review the build log.

Build log attached.
Comment 7 Sebastien Pouliot 2015-11-19 22:42:16 UTC
*** Bug 35821 has been marked as a duplicate of this bug. ***
Comment 9 Vincent Roggero 2015-11-30 15:44:01 UTC
Installed package.
Used: --bitcode=asmonly -gcc_flags ="-framework Security"

And get these errors;
/Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/MTOUCH: Error MT5209: Native linking error: clang: error: no such file or directory: '=-framework' (MT5209) (THXTune-up)

/Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/MTOUCH: Error MT5209: Native linking error: clang: error: no such file or directory: 'Security' (MT5209) (THXTune-up)

/Users/vincentr/GitHub/THX-tune-up/tvOS/THXTune-up/THXTune-up/MTOUCH: Error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: =-framework Security (MT5201) (THXTune-up)

Attached xs-build-error3.txt
Comment 10 Vincent Roggero 2015-11-30 15:46:01 UTC
Created attachment 14035 [details]
Build log for -gcc_flags
Comment 11 Vincent Roggero 2015-11-30 15:48:02 UTC
Created attachment 14036 [details]
Config for gcc_flags issue
Comment 12 Sebastien Pouliot 2015-11-30 15:50:57 UTC
Command-line arguments use a space or an `=` sign but not both. Either

> --bitcode=asmonly -gcc_flags "-framework Security"

or

> --bitcode=asmonly -gcc_flags="-framework Security"

should work.
Comment 13 Vincent Roggero 2015-11-30 16:02:40 UTC
That did the trick. I've successfully built, archived for publish, uploaded to iTunesConnect with app loader, and am waiting for processing to complete. Stay tuned...
Comment 14 Sebastien Pouliot 2015-11-30 16:13:04 UTC
Glad to hear this! :-)

Please let us know the results and I'll close the bug at that point.
Comment 15 Vincent Roggero 2015-11-30 19:55:30 UTC
I am now able to publish and install TestFlight builds.
Comment 16 David Hathaway 2015-12-02 21:27:49 UTC
*** Bug 35903 has been marked as a duplicate of this bug. ***
Comment 17 Sebastien Pouliot 2016-01-13 20:23:13 UTC
Based on comment #15 I assume this is fixed and closing the bug.

note: the previous workarounds should not be needed anymore with preview 4