Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unable to parse string '20' as a valid Ubuntu release version #4929

Closed
realBigZ opened this issue Jul 16, 2020 · 0 comments · Fixed by #5463
Closed

Error: Unable to parse string '20' as a valid Ubuntu release version #4929

realBigZ opened this issue Jul 16, 2020 · 0 comments · Fixed by #5463
Assignees
Labels
Area: xamarin-android Build Issues building the xamarin-android repo *itself*.

Comments

@realBigZ
Copy link

realBigZ commented Jul 16, 2020

Steps to Reproduce

These are the relevant steps I followed from here:

  1. Run sudo apt install mono-complete nuget
  2. Run sudo apt install autoconf autotools-dev automake cmake build-essential curl gcc g++ g++-mingw-w64 gcc-mingw-w64 git libncurses5-dev libtool libz-mingw-w64-dev libzip-dev linux-libc-dev make ninja-build p7zip-full sqlite3 vim-common zlib1g-dev linux-libc-dev:i386 zlib1g-dev:i386 libx32tinfo-dev to build xamarin-android
  3. Download xamarin-android's source code git clone https://github.com/xamarin/xamarin-android.git
  4. Run make prepare inside the xamarin-android folder

Expected Behavior

make prepare is supposed to build all the dependencies for xamarin-android, so I can run make jenkins and fully build xamarin-android.

Actual Behavior

Xamarin initially lists my OS as Linux Mint, but for whatever reason, Xamarin views my OS as Ubuntu later in the code:

   OS type: Linux
   OS name: Linux Mint
OS release: 20
   OS bits: x86_64
 CPU count: 2

  Error: Unable to parse string '20' as a valid Ubuntu release version

Failed to initialize operating system support
System.InvalidOperationException: Failed to initialize operating system support
  at Xamarin.Android.Prepare.OS.Init () [0x00024] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs:243 
  at Xamarin.Android.Prepare.Context.Init (System.String scenarioName) [0x0022d] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:766 
  at Xamarin.Android.Prepare.App.Run (System.String[] args) [0x00793] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:153

make: *** [Makefile:204: prepare] Error 1

Going on the latest version (11.0.0.3) produces almost identical results:

   OS type: Linux
   OS name: Linuxmint
OS release: 20
   OS bits: x86_64
 CPU count: 2

  Error: Unable to parse string '20' as a valid Ubuntu release version

Failed to initialize operating system support
System.InvalidOperationException: Failed to initialize operating system support
  at Xamarin.Android.Prepare.OS.Init () [0x00024] in /home/zola/Desktop/xamarin-android-10.3.1.4/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs:245 
  at Xamarin.Android.Prepare.Context.Init (System.String scenarioName) [0x0026c] in /home/zola/Desktop/xamarin-android-10.3.1.4/build-tools/xaprepare/xaprepare/Application/Context.cs:761 
  at Xamarin.Android.Prepare.App.Run (System.String[] args) [0x0078a] in /home/zola/Desktop/xamarin-android-10.3.1.4/build-tools/xaprepare/xaprepare/Main.cs:153 

make: *** [Makefile:202: prepare] Error 1

Version Information

The version I wish to fix this issue on is 10.3.1.4, although this issue happens with 11.0.0.3 as well.

Log File

This is the log file for 10.3.1.4 (The terminal output is here just in case):

[00:00:00.0438924] All defined properties:
[00:00:00.0636711]   AndroidCmakeVersion = 3.10.2
[00:00:00.0637333]   AndroidCmakeVersionPath = 3.10.2.4988404
[00:00:00.0637463]   AndroidLatestStableFrameworkVersion = v11.0
[00:00:00.0637557]   AndroidMxeFullPath = /usr
[00:00:00.0638016]   AndroidNdkDirectory = /home/zola/android-toolchain/ndk
[00:00:00.0638196]   AndroidSdkDirectory = /home/zola/Android/Sdk
[00:00:00.0638284]   AndroidSupportedHostJitAbis = Linux
[00:00:00.0638369]   AndroidSupportedTargetAotAbis = armeabi-v7a:arm64:x86:x86_64
[00:00:00.0638454]   AndroidSupportedTargetJitAbis = armeabi-v7a:arm64-v8a:x86:x86_64
[00:00:00.0638542]   AndroidToolchainCacheDirectory = /home/zola/android-archives
[00:00:00.0638624]   AndroidToolchainDirectory = /home/zola/android-toolchain
[00:00:00.0638712]   AutoProvision = False
[00:00:00.0639037]   AutoProvisionUsesSudo = False
[00:00:00.0639172]   CommandLineToolsFolder = 1.0
[00:00:00.0639258]   CommandLineToolsVersion = 6200805_latest
[00:00:00.0639345]   Configuration = Debug
[00:00:00.0639889]   EmulatorPkgRevision = 30.0.12
[00:00:00.0639994]   EmulatorVersion = 6466327
[00:00:00.0640076]   IgnoreMaxMonoVersion = True
[00:00:00.0640156]   IgnoreMinMonoVersion = @IgnoreMinMonoVersion@
[00:00:00.0640238]   JavaInteropFullPath = /home/zola/Desktop/xamarin-android/external/Java.Interop
[00:00:00.0640568]   JavaSdkDirectory = 
[00:00:00.0640696]   LibZipSourceFullPath = 
[00:00:00.0640782]   ManagedRuntime = mono
[00:00:00.0640861]   MingwCommandPrefix32 = i686-w64-mingw32
[00:00:00.0640940]   MingwCommandPrefix64 = x86_64-w64-mingw32
[00:00:00.0641023]   MingwDependenciesRootDirectory = /home/zola/Desktop/xamarin-android/bin/BuildDebug/mingw-deps
[00:00:00.0641113]   MingwZlibLibraryName = libz.a
[00:00:00.0641192]   MingwZlibRootDirectory32 = /usr/i686-w64-mingw32
[00:00:00.0641460]   MingwZlibRootDirectory64 = /usr/x86_64-w64-mingw32
[00:00:00.0641630]   MonoDarwinPackageUrl = https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2020-02/45/d90665a422e9f8d015585b3ca381d74faa033cc4/MonoFramework-MDK-6.12.0.43.macos10.xamarin.universal.pkg
[00:00:00.0641857]   MonoRequiredMaximumVersion = 6.12.99
[00:00:00.0641944]   MonoRequiredMinimumVersion = 6.12.0.43
[00:00:00.0642032]   MonoSourceFullPath = /home/zola/Desktop/xamarin-android/external/mono
[00:00:00.0642116]   ProductVersion = 11.1.99
[00:00:00.0642200]   RemapAssemblyRefToolExecutable = /home/zola/Desktop/xamarin-android/bin/BuildDebug/remap-assembly-ref.exe
[00:00:00.0642523]   XABinRelativeInstallPrefix = lib/xamarin.android
[00:00:00.0642661]   XABuildToolsFolder = 29.0.2
[00:00:00.0642745]   XABuildToolsVersion = 29.0.2
[00:00:00.0642833]   XAInstallPrefix = /home/zola/Desktop/xamarin-android/bin/Debug/lib/xamarin.android/
[00:00:00.0642920]   XAPackagesDir = /home/zola/Desktop/xamarin-android/packages
[00:00:00.0643008]   XAPlatformToolsPackagePrefix = 
[00:00:00.0643084]   XAPlatformToolsVersion = 30.0.2
[00:00:00.2051567] Setting condition AllowProgramInstallation to 'True'
[00:00:00.2112680] Main log file: [00:00:00.2121140] /home/zola/Desktop/xamarin-android/bin/BuildDebug/prepare-20200716T182747.log
[00:00:00.2136645] 
[00:00:00.2144446] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[00:00:00.2153578] Detecting operating system
[00:00:00.2155641] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[00:00:00.2157953] 
[00:00:00.3306862] Running: uname "-m"
[00:00:00.3986177] 
[00:00:00.3992715]    OS type: [00:00:00.3999262] Linux
[00:00:00.4005319]    OS name: [00:00:00.4012670] Linux Mint
[00:00:00.4018295] OS release: [00:00:00.4027067] 20
[00:00:00.4032952]    OS bits: [00:00:00.4040494] x86_64
[00:00:00.4049658]  CPU count: [00:00:00.4054127] 2
[00:00:00.4058663] 
[00:00:00.4684486] Initializing scenario Standard
[00:00:00.4935300] Windows JIT ABis DISABLED, SKIPPING MinGW dependencies build step
[00:00:00.4938637] Adding Windows GAS download step (AFTER bundle)
[00:00:00.5069311]   Error: Unable to parse string '20' as a valid Ubuntu release version
[00:00:00.5249730] 
[00:00:00.5252756] Failed to initialize operating system support
[00:00:00.5495689] System.InvalidOperationException: Failed to initialize operating system support
[00:00:00.5495689]   at Xamarin.Android.Prepare.OS.Init () [0x00024] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs:243 
[00:00:00.5495689]   at Xamarin.Android.Prepare.Context.Init (System.String scenarioName) [0x0022d] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:766 
[00:00:00.5495689]   at Xamarin.Android.Prepare.App.Run (System.String[] args) [0x00793] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:153 
[00:00:00.5502445] 
@grendello grendello self-assigned this Jul 16, 2020
@grendello grendello added the Area: xamarin-android Build Issues building the xamarin-android repo *itself*. label Jul 16, 2020
@grendello grendello added this to the Under Consideration milestone Jul 16, 2020
grendello added a commit to grendello/xamarin-android that referenced this issue Jan 5, 2021
Fixes: dotnet#4929

Some releases of Ubuntu use only a single digit for their version, which
the `Version` class is not able to parse properly.  Add a special case
to handle it.

Additionally, don't hardcode `Ubuntu` into error message, use the
actual (derived) distro name instead.
jonpryor pushed a commit that referenced this issue Jan 7, 2021
Fixes: #4929

Some releases of Ubuntu use only a single digit for their version:

	   OS type: Linux
	   OS name: Linux Mint
	OS release: 20
	   OS bits: x86_64
	 CPU count: 2

This would cause `xaprepare` to error out on these platforms:

	$ make prepare
	…
	  Error: Unable to parse string '20' as a valid Ubuntu release version

	Failed to initialize operating system support
	System.InvalidOperationException: Failed to initialize operating system support
	  at Xamarin.Android.Prepare.OS.Init () [0x00024] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs:243 
	  at Xamarin.Android.Prepare.Context.Init (System.String scenarioName) [0x0022d] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:766 
	  at Xamarin.Android.Prepare.App.Run (System.String[] args) [0x00793] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:153

	make: *** [Makefile:204: prepare] Error 1

If `Version.TryParse()` fails to parse `OS release`, add a fallback
which uses `Int32.TryParse()`.  This should allow `make prepare` to
run on these Linux platforms.

Additionally, don't hardcode `Ubuntu` into the error message, use the
actual (derived) distro name instead.
@ghost ghost locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: xamarin-android Build Issues building the xamarin-android repo *itself*.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants