Xamarin 15.2.2 - error XA5103: NDK C compiler resulted in an error

Xamarin NDK C compiler error

Description of the issue

Several of our xamarin apps would not build this morning with the same error below. I will update this with more details as I have them.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_BuildApkEmbed target) ->

	: error XA5103: NDK C compiler resulted in an error. Exit code 0

Environment:

Where did the issue happen?
Xamarin Stable, beta, alpha

Which build Step causes the issue and which version of the step?
Xamarin archive

Reproducibility

  • Does a “Rebuild” help? : NO
  • If you have multiple different build configurations (workflows), does the issue affect all/more than one? : YES
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : 29/05

Other stacks

Can it be reproduced by running the build locally with our CLI ( https://www.bitrise.io/cli ), after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( https://www.bitrise.io/cli )? YES

Build log

Please attach the build log or if you can’t attach the whole log then send the full log through a private channel (e.g. email - https://www.bitrise.io/contact ). Sent via email

Relevant part of the build log / error:

Target _BuildApkEmbed:
		[mkbundle stderr] 
		[cc stderr] obj/Release/bundles/armeabi-v7a/temp.c:1:39: fatal error: mono/metadata/mono-config.h: No such file or directory
		[cc stderr]  #include <mono/metadata/mono-config.h>
		[cc stderr]                                        ^
		[cc stderr] compilation terminated.
		[cc stderr] 
: error XA5103: NDK C compiler resulted in an error. Exit code 0

So it seems the issue is with some kind of mono config header is missing. Most likely this is related to the recent Mono version upgrade in Xamarin; Xamarin now comes with Mono 5 instead of Mono 4.

Did you try to upgrade the relevant packages in your project? Also, did you try to build the project in the latest Xamarin Studio?

Originally I was on mono 5.0.0.100 and the project built successfully through xamarin studio but not the bitrise cli.

I upgraded to latest xamarin studio stable with mono 5.0.1.1 to match what is on bitrise. Now I’m getting the app building through both xamarin studio and the bitrise cli.

Does that suggests something is missing from the stack?


Original Xamarin Configuration

Xamarin Studio Community
Version 6.3 (build 864)
Installation UUID: 13431d39-e676-4c08-ab8d-016f20b2cdeb
Runtime:
	Mono 5.0.0.100 (2017-02/9667aa6) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500000100

NuGet
Version: 3.5.0.0

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Xamarin.iOS
Version: 10.10.0.33 (Xamarin Studio Community)
Hash: 3e5ac5ff
Branch: d15-2
Build date: 2017-05-05 18:11:38-0400

Xamarin.Android
Version: 7.3.1.1 (Xamarin Studio Community)
Android SDK: /Library/Android/sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.6
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin.Mac
Version: 3.4.0.33 (Xamarin Studio Community)

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Build Information
Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

Operating System
Mac OS X 10.12.4
Darwin Optimus.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

Enabled user installed addins
Android Signature Tool 2.0.0
EMDK for Xamarin 2.3.0.43
MFractor.Installer 2.2.0
MFractor 2.09.02
MvvmCross Template pack 1.2.7
Addin Maker 1.3.2
NuGet Package Explorer 0.1
NuGet Package Management Extensions 0.12
StyleCop Support 1.0.1.9
Prism Template Pack 1.5
Redth's Addins 1.0.7
JSON Copy 1.1
Manifest.addin 0.0.0.0

Latest Xamarin Configuration

Xamarin Studio Community
Version 6.3 (build 864)
Installation UUID: 13431d39-e676-4c08-ab8d-016f20b2cdeb
Runtime:
	Mono 5.0.1.1 (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001

NuGet
Version: 3.5.0.0

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Xamarin.iOS
Version: 10.10.0.36 (Xamarin Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

Xamarin.Android
Version: 7.3.1.2 (Xamarin Studio Community)
Android SDK: /Library/Android/sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.6
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin.Mac
Version: 3.4.0.36 (Xamarin Studio Community)

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Build Information
Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

Operating System
Mac OS X 10.12.4
Darwin Optimus.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

Enabled user installed addins
Android Signature Tool 2.0.0
EMDK for Xamarin 2.3.0.43
MFractor.Installer 2.2.0
MFractor 2.09.02
MvvmCross Template pack 1.2.7
Addin Maker 1.3.2
NuGet Package Explorer 0.1
NuGet Package Management Extensions 0.12
StyleCop Support 1.0.1.9
Prism Template Pack 1.5
Redth's Addins 1.0.7
JSON Copy 1.1
Manifest.addin 0.0.0.0

What’s the error after the upgrade? Or was the log you sent to us the one after the upgrade?

The log I sent was from bitrise itself. It has the same error that I had locally before the upgrade. After upgrading I do not have the error locally.

Searching for the error it also seems to be a know Xamarin issue, with certain Mono versions. Related Xamarin tracker report: https://bugzilla.xamarin.com/show_bug.cgi?id=56786

From about 5 days ago (from https://bugzilla.xamarin.com/show_bug.cgi?id=56786):

This is related to commit tamarin-android/master/b6d2360

The problem came from the tamarin-android repo switching over to use the system mono mkbundle rather than compiling its own. The problem being that the mono-config.h files are not present. This has now been fixed in the commit above.

The new system allows us to pass an additional flag to tell mkbundle NOT to use the headers. however this does require a new version of mkbundle (see mono/master/59737b2a).

Currently the only work around is to disable bundling of assemblies into native code.

That bug was fixed in 15.2.2 which you deployed, I’m guessing this is caused by the build steps still using xbuild instead of msbuild.

Regardless, they need updating to msbuild as xbuild will be removed in the future.

1 Like

Bumped the related task. That said I just saw an msbuild specific issue on the Xamarin tracker where the solution is to switch back to xbuild…

I guess this should be an option on the step, which one to use.

1 Like

Yes it needs an option - just to confirm, our project builds with msbuild on 15.2.2 but fails with xbuild, so we urgently need that build step updating please :slight_smile:

1 Like

I bumped it as high as I could. In the meantime:

1 Like

Does the bitrise stack currently include the 15.2.2 hotfix released on friday? I can’t tell from the system report as the xamarin android version reported isn’t specific enough, it doesn’t have the fourth point version number. I suspect the hotfix isn’t deploy as this would explain why I can build the apps without issue using cli locally as I will have the fix.

If the hotfix isn’t deployed is it possible you might deploy this sooner than the weekend? Several of our production apps are failing on bitrise and none of the workarounds to config get them building.

1 Like

So it does work with the same version and with xbuild locally?

It’s possible that fix was not included, as the stacks are auto provisioned during the early hours on Friday, and tested during the day.

If you confirm that it works locally with xbuild I can schedule an early patch deploy for it, which can be deployed into production in about 12 hours, maybe less.

I ran the usual workflow locally that uses the normal xamarin archive step, I presume that uses xbuild. It was successfully built.

1 Like

Thanks for confirming and for the xamarin releases link - we already started to prepare the stack update as indeed it seems that hotfix was released after the VMs were provisioned, and the issue should be fixed by that hotfix update.

We’ll try to push the updated stack into production ASAP.

1 Like

Great news! Thanks for getting that going quickly

1 Like

Sure, we definitely understand its importance.

Note: we’ll try to push the update into production ASAP, so for now we’ll only update the Stable stack, Beta and Alpha will be updated this weekend, following the usual schedule.

1 Like

In the meantime all the tests did pass and the deploy was started; new Xamarin Stable VMs will now use the new updated VM image which includes the Xamarin.Android 7.3.1.2 hotfix update!

Note: Any build started on an Elite stack will now start with the new build image, but on the Standard stacks it might take a bit more time to refresh all the build VMs as the Standard stacks have prebooted build VMs, which will only use the new image when the VM is rebuilt. In practice this should mean that if you start a build right now and you still have the issue please try to do a rebuild, that will most likely start with the new updated image.

1 Like

I can confirm our builds are succeeding again on bitrise. Thanks again for getting the stacks updated.

1 Like

Awesome to hear! :rocket:

Thanks again for all the infos and sorry for the inconvenience.

Happy Building! :wink:

@tomgilder xamarin-archive 1.4.1 was just released, and the new version now has a tool option where you can set msbuild: https://github.com/bitrise-steplib/steps-xamarin-archive/releases/tag/1.4.1

P.S.: due to caching on bitrise.io it might take some time for the new version to show up. If you use the local workflow editor or set the version in bitrise.yml directly, 1.4.1 is available now. On the website it should be available in ~10-30 mins; if you’d still not see it after that, please reload the page/editor a couple of times to refresh the browser’s cache.

1 Like