Bug 40746 - Linux build for XA broken
Summary: Linux build for XA broken
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2016-04-27 21:16 UTC by Dylan Borg
Modified: 2016-08-12 09:18 UTC (History)
3 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 Dylan Borg 2016-04-27 21:16:43 UTC
When trying to build Xamarin.Android on Linux I get the following crash (The reference assemblies for monodroid are not compiled in the embedded mono repo except for mscorlib):

/mnt/ssd/xamarin-android/Xamarin.Android.sln (default targets) ->
(Build target) ->
/mnt/ssd/xamarin-android/src/Mono.Android/Mono.Android.csproj (default targets) ->
/usr/local/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->

	Java.Lang/Object.cs(15,5): error CS0012: The type `System.IDisposable' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
	Android.Runtime/AndroidRuntime.cs(58,43): error CS0012: The type `System.Object' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
	Android.Runtime/JNIEnv.cs(18,38): error CS0012: The type `System.ValueType' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
	Java.Lang/Object.cs(144,3): error CS0012: The type `System.Enum' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
	Java.Lang/Object.cs(193,40): error CS0012: The type `System.IEquatable`1<Java.Interop.JniObjectReference>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
	Android.Runtime/AndroidRuntime.cs(37,29): error CS0508: `Android.Runtime.AndroidRuntime.GetExceptionForThrowable(ref Java.Interop.JniObjectReference, Java.Interop.JniObjectReferenceOptions)': return type must be `System.Exception' to match overridden member `Java.Interop.JniRuntime.GetExceptionForThrowable(ref Java.Interop.JniObjectReference, Java.Interop.JniObjectReferenceOptions)'
	Android.Runtime/AndroidRuntime.cs(47,24): error CS0115: `Android.Runtime.AndroidRuntime.RaisePendingException(System.Exception)' is marked as an override but no suitable method found to override
	Android.Runtime/AndroidRuntime.cs(210,40): error CS0508: `Android.Runtime.AndroidTypeManager.GetTypesForSimpleReference(string)': return type must be `System.Collections.Generic.IEnumerable`1<System.Type>' to match overridden member `Java.Interop.JniRuntime.JniTypeManager.GetTypesForSimpleReference(string)'
	Android.Runtime/AndroidRuntime.cs(219,42): error CS0115: `Android.Runtime.AndroidTypeManager.GetSimpleReferences(System.Type)' is marked as an override but no suitable method found to override
	Android.Runtime/XAPeerMembers.cs(17,27): error CS0115: `Android.Runtime.XAPeerMembers.UsesVirtualDispatch(Java.Interop.IJavaPeerable, System.Type)' is marked as an override but no suitable method found to override
Comment 1 Jonathan Pryor 2016-04-28 12:18:31 UTC
Diagnostic build output?

> xbuild /v:diag > log.txt

What Mono version is this? I've only tested builds with Mono 4.4 (on OS X...).

What *should* have happened is that src/Mono.Android/Mono.Android.csproj has a project reference dependency on build-tools/mono-runtimes.mdproj, which is responsible for building and installing mscorlib.dll and related assemblies.

Have they been installed?

> ls -l bin/Debug/lib/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll
> ls -l bin/Debug/lib/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.dll

Additionally, Mono.Android.csproj has a _BuildJavaInterop target which should run before the BeforeResolveReferences target, and builds Java.Interop.dll. Does it exist?

> ls -l bin/Debug/lib/xbuild-frameworks/MonoAndroid/v1.0/Java.Interop.dll
Comment 2 Dylan Borg 2016-04-28 12:32:13 UTC
I have managed to build the Java interop library as well as the Facades. The only remaining problem I have is that the mandroid binary is not being generated.
Comment 3 Jonathan Pryor 2016-04-29 16:18:11 UTC
> the mandroid binary is not being generated.

I assume you mean libmonodroid.so.

Building src/monodroid requires that xxd(1) be installed.
Comment 4 Dylan Borg 2016-04-29 16:48:34 UTC
I did not know about xxd. Thanks for the heads up. xbuild says that "mandroid" is not able to be found. If its the library for monodroid that cannot be found, the message should be corrected.
Comment 5 Dylan Borg 2016-04-29 16:50:02 UTC
I searched in the package manager for xxd but only found xx-diff. Is that it?
Comment 6 Dylan Borg 2016-04-29 17:06:53 UTC
I found out I already have xxd installed as part of the vim-common package.
Comment 7 Jonathan Pryor 2016-04-29 18:13:31 UTC
> xbuild says that "mandroid" is not able to be found. 

Please provide the exact error message. `mandroid` is many things -- a directory to contain various files part of the Xamarin.Android SDK such as class-parse.exe (not yet created in the xamarin-android repo), and a program which was removed after Cycle 7 was branched.

You may want to consider joining the gitter channel:

https://gitter.im/xamarin/xamarin-android
Comment 8 Dylan Borg 2016-04-30 06:41:50 UTC
XBuild Engine Version 14.0
Mono, Version 4.5.1.0
Copyright (C) 2005-2013 Various Mono authors

Build started 30/04/2016 08:36:39.
__________________________________________________
Project "/home/dylan/Desktop/git/mobile-samples/Tasky/TaskyAndroid/TaskyAndroid.csproj" (default target(s)):
	Target _BuildSdkCache:
: error XA0020: Could not find mandroid!
	Task "ResolveSdks" execution -- FAILED
	Done building target "_BuildSdkCache" in project "/home/dylan/Desktop/git/mobile-samples/Tasky/TaskyAndroid/TaskyAndroid.csproj".-- FAILED
Done building project "/home/dylan/Desktop/git/mobile-samples/Tasky/TaskyAndroid/TaskyAndroid.csproj".-- FAILED

Build FAILED.
Errors:

/home/dylan/Desktop/git/mobile-samples/Tasky/TaskyAndroid/TaskyAndroid.csproj (default targets) ->
/usr/local/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_BuildSdkCache target) ->

	: error XA0020: Could not find mandroid!

	 0 Warning(s)
	 1 Error(s)
Comment 9 Atsushi Eno 2016-08-12 09:18:49 UTC
It should be already fixed weeks ago.