xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

Failed to compile the generated code for the registrar #7464

Closed AshishRanjanPM closed 4 years ago

AshishRanjanPM commented 5 years ago

I am getting the below issue while compiling the code for xamarin.ios. Please help.

/App.iOS/MTOUCH: Error MT4109: Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new (MT4109) (MotorApp.iOS)

chamons commented 5 years ago

Please attach a full build log, this report does not have enough information to be actionable currently.

A project showing the problem would also be handy.

lancerdima commented 4 years ago

Bumped into the error, while building our production project using Hosted Azure Pipelines, using macOS-10.14 agent specification. It was built successfully with macOS-10.13 agent though.

For privacy reasons cannot share the whole log, but I think I extracted the most important part of the log.

_CompileToNative:
  /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch "@/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/response-file.rsp" 
MTOUCH : warning MT0109: The assembly 'System.Net.Http.dll' was loaded from a different path than the provided path (provided path: /Users/runner/.nuget/packages/system.net.http/4.3.4/runtimes/win/lib/netstandard1.3/System.Net.Http.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.25/lib/mono/Xamarin.iOS/System.Net.Http.dll). [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
MTOUCH : warning MT0109: The assembly 'System.Net.Http.dll' was loaded from a different path than the provided path (provided path: /Users/runner/.nuget/packages/system.net.http/4.3.4/runtimes/win/lib/netstandard1.3/System.Net.Http.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.25/lib/mono/Xamarin.iOS/System.Net.Http.dll). [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
  Process exited with code 1, command:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -Wno-receiver-forward-class -Wno-objc-missing-super-calls -Wno-unguarded-availability-new -stdlib=libc++ -gdwarf-2 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.25/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk -Qunused-arguments -miphoneos-version-min=8.1 -arch arm64 -c -o '/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/arm64/registrar.o' -x objective-c++ -DDEBUG '/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/64/registrar.m'
  In file included from /Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/64/registrar.m:3:
  In file included from /Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/64/registrar.h:16:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/Photos.h:31:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(18,2): error GB12A9FDE: "Photos requires C++11 or later" [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
  #error "Photos requires C++11 or later"
   ^ 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(21,47): error GEA45E82A: expected identifier or '{' [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
  typedef NS_ENUM(NSInteger, UIImageOrientation);
                                                ^ 
  2 errors generated.

  Process exited with code 1, command:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -Wno-receiver-forward-class -Wno-objc-missing-super-calls -Wno-unguarded-availability-new -stdlib=libc++ -gdwarf-2 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.25/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk -Qunused-arguments -miphoneos-version-min=8.1 -arch armv7 -c -o '/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/armv7/registrar.o' -x objective-c++ -DDEBUG '/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/32/registrar.m'
  In file included from /Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/32/registrar.m:3:
  In file included from /Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/obj/iPhone/Development/mtouch-cache/32/registrar.h:16:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/Photos.h:31:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(18,2): error GB12A9FDE: "Photos requires C++11 or later" [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
  #error "Photos requires C++11 or later"
   ^ 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(21,47): error GEA45E82A: expected identifier or '{' [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
  typedef NS_ENUM(NSInteger, UIImageOrientation);
                                                ^ 
  2 errors generated.

MTOUCH : error MT4109: Failed to compile the generated registrar code. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new [/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj]
Done Building Project "/Users/runner/runners/2.160.1/work/1/s/MobileApp/Mobile Clients/{project name}.iOS/{project name}.iOS.csproj" (default targets) -- FAILED.
Done Building Project "/Users/runner/runners/2.160.1/work/1/s/MobileApp/{project name}.iOS.sln" (default targets) -- FAILED.
chamons commented 4 years ago

This is a duplicate of: https://github.com/xamarin/xamarin-macios/issues/6716

Update your builds to the latest stable or downgrade your Xcode.