Skip to content

[Xamarin.Android.Build.Tasks] make $(AndroidNdkDirectory) optional - #6539

Merged
jonpryor merged 1 commit into
dotnet:mainfrom
jonathanpeppers:ndk-optional
Dec 6, 2021
Merged

jonpryor merged 1 commit into
dotnet:mainfrom
jonathanpeppers:ndk-optional

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Dec 1, 2021 •

Copy link
Copy Markdown
Member

It is possible for us to not require the Android NDK to be installed,
but we have checks in place that would emit errors, such as:

error XA5104: Could not locate the Android NDK. Please make sure the Android NDK is installed in the Android SDK Manager, or if using a custom NDK path, please ensure the $(AndroidNdkDirectory) MSBuild property is set to the custom path.

To make it possible to build with AOT without the NDK:

  1. Make a NullNdkTools class to use when an NDK is not found.

  2. Make the NDK only actually required when $(EnableLLVM) is true.

  3. Update our MSBuild tests so they leave $(AndroidNdkDirectory)
    blank.

After these changes, I'm able to build full and profiled AOT applications without
an Android NDK installed.

After this is merged, we might be able to make Release builds in .NET 6 default
to use profiled AOT.


[Required]
public string AndroidNdkDirectory { get; set; }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed [Required] because the NdkTools.Create() call below gives a much better error message:

error XA5104: Could not locate the Android NDK. Please make sure the Android NDK is installed in the Android SDK Manager, or if using a custom NDK path, please ensure the $(AndroidNdkDirectory) MSBuild property is set to the custom path.

@jonathanpeppers
jonathanpeppers marked this pull request as ready for review December 3, 2021 13:08
if (ndk == null) {
return; // NdkTools.Create will log appropriate error
}
NdkTools ndk = NdkTools.Create (AndroidNdkDirectory, logErrors: false, log: Log);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathanpeppers: should we similarly check Log.HasLoggedErrors here as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, whoops I put this check back, so it should be closer to what we had before.

It is possible for us to not require the Android NDK to be installed,
but we have checks in place that would emit errors.

To make it possible to build with AOT without the NDK:

1. Make a `NullNdkTools` class to use when an NDK is not found.

2. Make the NDK only actually required when `$(EnableLLVM)` is `true`.

3. Update our MSBuild tests so they leave `$(AndroidNdkDirectory)`
   blank.

If this works, we can make `Release` builds in .NET 6 default to use
profiled AOT.
AotAssemblies = true,
PackageName = "com.xamarin.buildaotappandbundlewithspecialchars",
};
proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this property added, when it (apparently?) wasn't previously required? Ditto elsewhere.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(AndroidNdkDirectory) is not passed into the MSBuild tests anymore, I deleted:

https://github.com/xamarin/xamarin-android/blob/5dcf2945e4cd7da50c5c8f76608e0d0266022b09/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs#L314-L317

And so we need to pass it in, for tests using LLVM or $(BundleAssemblies) now. We should also have some confidence that the other tests work now without $(AndroidNdkDirectory) passed in.

@jonpryor
jonpryor merged commit c96d9f4 into dotnet:main Dec 6, 2021
@jonathanpeppers
jonathanpeppers deleted the ndk-optional branch December 6, 2021 17:36
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Dec 9, 2021
…nal (dotnet#6539)"

This reverts commit c96d9f4.

Context? dotnet#6520

On CI, ever since c96d9f4 landed, the
`NoSymbolsArgShouldReduceAppSize` test has been failing.

Is this because of c96d9f4?

Try reverting c96d9f4, see if the test passes again.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Dec 9, 2021
)"

This reverts commit 5dcf294.

Context: dotnet#6520
Context: dotnet#6560
Context: 5dcf294
Context: c96d9f4

There was a "curious" interaction between 5dcf294 (PR dotnet#6544) and
commit c96d9f4 (PR dotnet#6539): they both had green PRs, but each of
their PR build ran without the other existing.  Once both were merged,
all subsequent commits, and PRs based on c96d9f4, had a unit test
failure in `NoSymbolsArgShouldReduceAppSize`:

	Task "MonoAOTCompiler" requested 6 cores, acquired 6 cores, and now holds 6 cores total.
	[System.Private.CoreLib.dll] Running: C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\mono-aot-cross.exe --response="C:\Users\cloudtest\AppData\Local\Temp\tmp4D48.tmp"
	[System.Private.CoreLib.dll] Using working directory: C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked
	[System.Private.CoreLib.dll] Setting environment variables for execution:
	[System.Private.CoreLib.dll] 	MONO_PATH = C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked;
	[System.Private.CoreLib.dll] 	MONO_ENV_OPTIONS =
	[System.Private.CoreLib.dll] Exit code: 1
	[System.Private.CoreLib.dll] Exec (with response file contents expanded) in C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked: MONO_PATH=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked; MONO_ENV_OPTIONS= C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\mono-aot-cross.exe --debug --llvm "--aot=asmwriter,mtriple=aarch64-linux-android,tool-prefix=C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-,ld-name=ld.EXE,ld-flags=-LC:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21 C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so,temp-path=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib,nodebug,llvm-path=C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools,outfile=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll.so,llvm-outfile=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll-llvm.o" "System
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find C:\Program\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find C:\Program\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so: No such file or directory
	AOT of image System.Private.CoreLib.dll failed.
	Mono Ahead of Time compiler - compiling assembly C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked\System.Private.CoreLib.dll
	AOTID EE73FF83-5340-500C-4239-56CE4D83F91B
	Executing opt: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\opt" -f -O2 -disable-tail-calls -place-safepoints -spp-all-backedges -o "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.opt.bc" "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.bc"
	Executing llc: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\llc"  -enable-implicit-null-checks -disable-fault-maps -march=aarch64 -asm-verbose=false -mtriple=aarch64-linux-android -disable-gnu-eh-frame -enable-mono-eh-frame -mono-eh-frame-symbol=mono_aot_corlib_eh_frame -disable-tail-calls -relocation-model=pic -filetype=obj -o "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp-llvm.o" "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.opt.bc"
	Compiled: 7440/7440
	Executing the native assembler: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-as"   -o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s.o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s
	Executing the native linker: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE" -Bsymbolic -shared -o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll.so.tmp "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp-llvm.o" C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s.o -LC:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21 C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so
	1:8>C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\targets\Microsoft.Android.Sdk.Aot.targets(71,5): error : Precompiling failed for C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked\System.Private.CoreLib.dll [C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\UnnamedProject.csproj]

This is the same error scenario as Issue dotnet#6520.

The "curious interaction" is as follows: the
`NoSymbolsArgShouldReduceAppSize` works under .NET 6 *so long as* the
NDK toolchain is installed into a directory that doesn't have spaces.
When dotnet#6544 ran, this was the case: it used the NDK provisioned by our
build process, located in `$HOME`.

Commit c96d9f4 / PR dotnet#6539 changed this: the NDK became optional
except when LLVM is required, because NDK tools located within the
Xamarin.Android install could be used instead.  As part of this
change, `$(AndroidNdkDirectory)` was *not* always set to the NDK
provisioned by the unit tests.  When an NDK *was* required, the
system-wide / VS-provided NDK was used instead, at:

	C:\Program Files (x86)\Android\android-sdk\ndk\23.1.7779620

Once both commits 5dcf294 and c96d9f4 landed, the *now running*
`NoSymbolsArgShouldReduceAppSize` test failed, as it was trying to
use the system-wide NDK directory.

Revert commit 5dcf294, disabling the
`NoSymbolsArgShouldReduceAppSize`.  We'll re-enable it once we fix
Issue dotnet#6520.
jonpryor added a commit that referenced this pull request Dec 10, 2021
…6561)

This reverts commit 5dcf294.

Context: #6520
Context: #6560
Context: 5dcf294
Context: c96d9f4

There was a "curious" interaction between 5dcf294 (PR #6544) and
commit c96d9f4 (PR #6539): they both had green PRs, but each of
their PR builds ran without the other existing.  Once both were
merged, all subsequent commits, and PRs based on c96d9f4, had a unit
test failure in `NoSymbolsArgShouldReduceAppSize`:

	Task "MonoAOTCompiler" requested 6 cores, acquired 6 cores, and now holds 6 cores total.
	[System.Private.CoreLib.dll] Running: C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\mono-aot-cross.exe --response="C:\Users\cloudtest\AppData\Local\Temp\tmp4D48.tmp"
	[System.Private.CoreLib.dll] Using working directory: C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked
	[System.Private.CoreLib.dll] Setting environment variables for execution:
	[System.Private.CoreLib.dll] 	MONO_PATH = C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked;
	[System.Private.CoreLib.dll] 	MONO_ENV_OPTIONS =
	[System.Private.CoreLib.dll] Exit code: 1
	[System.Private.CoreLib.dll] Exec (with response file contents expanded) in C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked: MONO_PATH=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked; MONO_ENV_OPTIONS= C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\mono-aot-cross.exe --debug --llvm "--aot=asmwriter,mtriple=aarch64-linux-android,tool-prefix=C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-,ld-name=ld.EXE,ld-flags=-LC:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21 C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so,temp-path=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib,nodebug,llvm-path=C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools,outfile=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll.so,llvm-outfile=C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll-llvm.o" "System
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find C:\Program\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find C:\Program\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find Files\: No such file or directory
	C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE: cannot find (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so: No such file or directory
	AOT of image System.Private.CoreLib.dll failed.
	Mono Ahead of Time compiler - compiling assembly C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked\System.Private.CoreLib.dll
	AOTID EE73FF83-5340-500C-4239-56CE4D83F91B
	Executing opt: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\opt" -f -O2 -disable-tail-calls -place-safepoints -spp-all-backedges -o "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.opt.bc" "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.bc"
	Executing llc: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\6.0.1-mauipre.1.21602.7\Sdk\..\tools\llc"  -enable-implicit-null-checks -disable-fault-maps -march=aarch64 -asm-verbose=false -mtriple=aarch64-linux-android -disable-gnu-eh-frame -enable-mono-eh-frame -mono-eh-frame-symbol=mono_aot_corlib_eh_frame -disable-tail-calls -relocation-model=pic -filetype=obj -o "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp-llvm.o" "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.opt.bc"
	Compiled: 7440/7440
	Executing the native assembler: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-as"   -o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s.o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s
	Executing the native linker: "C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\tools\binutils\aarch64-linux-android-ld.EXE" -Bsymbolic -shared -o C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\System.Private.CoreLib.dll.so.tmp "C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp-llvm.o" C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\aot\arm64-v8a\System.Private.CoreLib\temp.s.o -LC:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21 C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libc.so C:\Program\ Files\ (x86)\Android\android-sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\21\libm.so
	1:8>C:\Users\cloudtest\android-toolchain\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.12.134\targets\Microsoft.Android.Sdk.Aot.targets(71,5): error : Precompiling failed for C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\obj\Release\android-arm64\linked\System.Private.CoreLib.dll [C:\a\_work\1\a\TestRelease\12-09_14.48.54\temp\NoSymbolsArgShouldReduceAppSize\UnnamedProject.csproj]

This is the same error scenario as Issue #6520.

The "curious interaction" is as follows: the
`NoSymbolsArgShouldReduceAppSize` works under .NET 6 *so long as* the
NDK toolchain is installed into a directory that doesn't have spaces.
When #6544 ran, this was the case: it used the NDK provisioned by our
build process, located in `$HOME`.

Commit c96d9f4 / PR #6539 changed this: the NDK became optional
except when LLVM is required, because NDK tools located within the
Xamarin.Android install could be used instead.  As part of this
change, `$(AndroidNdkDirectory)` was *not* always set to the NDK
provisioned by the unit tests.  When an NDK *was* required, the
system-wide / VS-provided NDK was used instead, at:

	C:\Program Files (x86)\Android\android-sdk\ndk\23.1.7779620

Once both commits 5dcf294 and c96d9f4 landed, the *now running*
`NoSymbolsArgShouldReduceAppSize` test failed, as it was trying to
use the system-wide NDK directory.

Revert commit 5dcf294, disabling the
`NoSymbolsArgShouldReduceAppSize`.  We'll re-enable it once we fix
Issue #6520.
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants