Bug 32084 - MTOUCH: error MT4109: Failed to compile the generated registrar code. Please file a bug report at http://bugzilla.xamarin.com
Summary: MTOUCH: error MT4109: Failed to compile the generated registrar code. Please ...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 8.10
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
: 33440 ()
Depends on:
Blocks:
 
Reported: 2015-07-17 15:03 UTC by Chris H
Modified: 2016-01-22 16:43 UTC (History)
5 users (show)

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

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 Chris H 2015-07-17 15:03:17 UTC
Hi there,

I recently attempted to move over an existing Xamarin iOS project to the unified Xamarin iOS API.

This required me to recreate 3 f# projects (they were previously using a custom project format) and migrate 2 other c# projects.

Everything appears to work in the simulator, however when deploying to the device the registrar fails and I receive MT4109

Unfortunately we were relying on the --registrar:oldstatic flag to build for quite some time and it appears this is not supported (legacy|legacystatic|legacydynamic) in the new unified API. This of course resulted in the inability to compile for the device using the new registrar and our chickens have come home to roost. 

Any help in resolving the registrar issues would be greatly appreciated. :)

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 1e982c43-58bf-4cd9-b711-592ef91dc026
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Xamarin.Android ===

Not Installed

=== Xamarin Android Player ===

Not Installed

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.3.2 (Indie Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.4
Darwin voidBook.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64


Here is the failing line in the build output (verbose)

		Process exited with code 1, command:
		/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -gdwarf-2 -std=c99 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.3.2/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -Qunused-arguments -miphoneos-version-min=7.0 -arch arm64 -c -DDEBUG  -o /Volumes/Fatty/repo/Wireclub.iOS/Wireclub.iOS/obj/iPhone/Debug/mtouch-cache/registrar.arm64.o -Wno-receiver-forward-class -x objective-c -fno-caret-diagnostics -fno-diagnostics-fixit-info -
		<stdin>:7932:12: error: expected identifier
		<stdin>:7932:33: error: expected '>'
		<stdin>:7932:33: error: expected identifier or '('
		<stdin>:7935:2: error: missing context for method declaration
		<stdin>:7936:2: error: expected method body
		<stdin>:7937:2: error: missing context for method declaration
		<stdin>:7938:2: error: expected method body
		<stdin>:7939:2: error: missing context for method declaration
		<stdin>:7940:2: error: expected method body
		<stdin>:7941:1: error: '@end' must appear in an Objective-C context
		<stdin>:7942:17: error: expected identifier
		<stdin>:7942:38: error: expected '>'
		<stdin>:7942:38: error: expected identifier or '('
		<stdin>:7943:2: error: missing context for method declaration
		<stdin>:7948:2: error: missing context for method declaration
		<stdin>:7953:2: error: missing context for method declaration
		<stdin>:7964:2: error: missing context for method declaration
		<stdin>:7970:2: error: missing context for method declaration
		<stdin>:7976:2: error: missing context for method declaration
		fatal error: too many errors emitted, stopping now [-ferror-limit=]

The project is open source and can be found here.

https://github.com/wireclub/Wireclub.iOS

Just put all the projects and their dependancies into the same repo directory.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-07-27 10:22:15 UTC
It looks like a project file is missing: https://www.dropbox.com/s/2m5b9q9n5n73bfy/Screenshot%202015-07-27%2016.20.33.png?dl=0 (it's not here: https://github.com/sta/websocket-sharp/tree/master/websocket-sharp)
Comment 2 Chris H 2015-07-27 17:15:09 UTC
You are correct. My apologies that was some real 'it works on my machine'ism.

Thanks for looking into this for me.

I have forked the project and added the correct project file can be found here.

https://github.com/wireclub/websocket-sharp

Just delete the existing repo and clone this new repo and all should be well.

Sorry again and thanks for looking into this for us.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-07-28 06:23:48 UTC
It looks like we have a problem with anonymous types generated by the F# compiler.

We generate a corresponding Objective-C type for every managed type exported to iOS, and the characters used in the anonymous F# type name are not valid Objective-C identifier.

An example of the code we generate:

> @interface <StartupCode$Wireclub-iOS>_$Home_-ctor@49-50 : NSObject<UITabBarDelegate> {

The workaround you can do on your end is to not use anonymous F# types.

I tried commenting out all the anonymous types [1] [2], and then the app built just fine.

[1] https://github.com/rolfbjarne/wireclub.appclient/commit/620e9bafaa4d85a61676db7da4ad4be09269da56
[2] https://github.com/rolfbjarne/Wireclub.iOS/commit/f7494e15e3978099b9f54ebcae343ee0873eff2f
Comment 4 Chris H 2015-07-28 16:53:56 UTC
Thanks Rolf,

I have had this issue in the past with anonymous types but that might have been as locals. I can't remember the exact details, but I opened a case for it a while back, but this makes sense.

Thanks for looking into this for us :)

We will make just implement the classes regularly.

Thanks again.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2015-09-01 04:56:11 UTC
*** Bug 33440 has been marked as a duplicate of this bug. ***
Comment 6 Rolf Bjarne Kvinge [MSFT] 2016-01-22 16:43:06 UTC
Fixed.

maccore/master: 97f179acf335e34e53f7b6080c8bd3d9e7cc4e0b