-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tasks] Fix libzip build on Linux #170
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
Conversation
|
Hello! I'm the build bot for the Mono project. I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Contributors can ignore this message. |
|
Hi @akihikodaki, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! The agreement was validated by .NET Foundation and real humans are currently evaluating your PR. TTYL, DNFBOT; |
|
I believe that the intention on Linux is to use/require the distro-provided @akihikodaki: Is there a reason you want to build |
|
The old OS check in
No, I even wonder why it does have such a thing. It may be for a specific distribution (old Ubuntu?), but any guess on dependencies provided by distribution just doesn't make sense. If you still need to provide missing dependencies on a particular distribution, why don't you make a private repository (PPA for Ubuntu)? |
I'm confused about what "it" refers to in this sentence. Is it the building of We need to build libzip for macOS and Windows, neither of which include |
|
@jonpryor I see. Not sure about macOS, but it may make sense for other OSes. Please don't mind. |
|
We have explicit package setup for Ubuntu for now, implying that we depend on distro-based libzip. There is no reason to provide our own libzip build. Either distros or linux users should be responsible to offer a working one. |
|
@akihikodaki The build system is prepared to provide dependencies for any Linux distro, see the link provided by @atsushieno. What does not make sense is to build the libraries/code that's readily available from the Linux distro's repository. We have support for Ubuntu because that's what we use, but we welcome contributions to support any other Linux distro. http://packages.ubuntu.com/xenial/libzip4 Debian: |
|
Still |
|
We should not accept build-tools/libzip/libzip.mdproj as that just results in extraneous build. The other change is okay IMO to have (in case we would like to change mind and bundle libzip, depending on the future situation) but so far it's totally optional. |
Actually it builds nothing if |
|
|
|
|
|
@akihikodaki I'm not sure what you mean by "intentionally forces to build"? We don't use "other distributions" - that's where there's room for community contributions. Your distro build is broken? Extend the detection and configuration process to support it, open a PR and we'll review it. |
|
@grendello Let me explain As you can see, if the host is Linux and the distribution is not Ubuntu, it tries to build libzip, but it always fails because of the bug this pull request fixes. (Sorry I commented with a different identity by mistake) |
As stated in prior comments, the intention is to use the system I see two plausible solutions:
|
Atcutally it's not to counter to the, as also stated:
Doesn't the logic make sense? |
|
@akihikodaki This PR doesn't fix the problem you indicate. If you could, please, re-read the comments (and especially the last comment by @jonpryor above which nicely and accurately outlines what needs to be done) and make the changes in the correct places to support your distribution, then we'd have a working solution instead of a discussion that appears to linger and lead nowhere. Locations of code to modify:
Tip: run |
|
I'm quite a confident that I understand what you mean, but please let me explain my understanding to make sure that. This pull request includes the following change: - <BuildDependsOnLocal Condition="'$(HostOS)' == 'Windows' OR '$(HostOS)' == 'Darwin'">
+ <BuildDependsOnLocal>You suspect this change "causes That's your opinion. However, I do NOT think it's correct. I explain why and would like you to correct if I am wrong.
<_LibZipTarget Include="host-Linux" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:')) AND '$(_LinuxBuildLibZip)' == 'true' ">
(snip)
</_LibZipTarget>As you say, <BuildDependsOnLocal>
ResolveReferences;
_Configure;
_Make
</BuildDependsOnLocal>
<Target Name="_Configure"
Condition=" '@(_LibZipTarget)' != '' "
DependsOnTargets="_SetCMakeListsTxtTimeToLastCommitTimestamp"
Inputs="$(LibZipSourceFullPath)\CMakeLists.txt"
Outputs="$(IntermediateOutputPath)\%(_LibZipTarget.Identity)\Makefile">
(snip)
</Target>
<Target Name="_Make"
Condition=" '@(_LibZipTarget)' != '' "
Inputs="$(IntermediateOutputPath)\%(_LibZipTarget.Identity)\Makefile"
Outputs="@(Content)">
(snip)
</Target>The As the result, NOTHING will be built. |
|
The last time I built XA, libzip was not automatically buillt yet was expected to be inside a particular directory. The build system did not copy the system's libzip to the correct place, if it copied it at all. |
- Remove an OS check making Linux distributions other than Ubuntu fail to build the library - Fix OutputLibraryPath
|
Tested on Ubuntu 16.04 Xenial Xerus and it didn't build libzip as expected. (For curious people, I tested on WSL of build 14936, and the entire build failed because linker got aborted.) |
Context: https://github.com/mono/Embeddinator-4000 Embeddinator-4000 will bring a lot more developers to consume C# objects from their Java code. One pain point here is that all constructors are generating `throws java.lang.Throwable` regardless of the `[Export]` declaration. Looking into it further, there was also the issue if you declared an empty Type[], jcw-gen was not handling that case. Changes: - Added `ThrowsDeclaration` property for reuse, which also handles the case of empty `Type[]` - Constructors now use `ThrowsDeclaration` along with methods - New test cases: a class with constructors with plain `[Export]` and a class with `[Export]` declaring `Throws` - Expanded methods test case: method with `Throws` and method with `Throws` and an empty `Type[]`
Context: 70272db Context: 38b1236 Context: https://github.com/actions/virtual-environments/blob/9cf1ebd754807fba137c8ce9fa2140311609fdd6/images/win/Windows2022-Readme.md Context: actions/runner-images@2950cbf Changes: http://github.com/xamarin/xamarin-android-tools/compare/20f611202bef0fc7c1659366dd38865eb119dde5...ec346d07cf3ac7fc74d08eae4f19043b51485724 * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171) * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170) We've had an "inadvertent thinko" for the past couple of months: in commit 70272db we updated the default `$(AndroidNdkDirectory)` value to be `$(ANDROID_NDK_LATEST_HOME)`, if set. *At the time*, we think this was NDK r23. In commit 38b1236, we updated `xaprepare` to install NDK r24. The "thinko" is that commit 38b1236 was *irrelevant*, as commit 70272db was "in control". The Windows **Prepare Solution** log would contain e.g.: Checking if android-ndk-r24-windows exists in C:\Android\android-sdk\ndk\23.2.8568313 Component 'android-ndk-r24-windows' requires Pkg.Revision to be '24.0.8215888', verifying installed It also *mis-detected* NDK r23 as r24 (?!). It "worked" only by coincidence. Around 2022-Jun-09, GitHub actions updated the default NDK installed on their Windows images; previously, `$(ANDROID_NDK_LATEST_HOME)` was NDK r23 or earlier (we're not sure); *now*, it is NDK r24. This subtle change -- invisible! The build environment changed! -- *introduced* unit test failures, of two patterns. Pattern 1 is that `readelf` could not be found: System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf' with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489 -or- System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489 This happened because `readelf` was *removed* in NDK r24. Fix this pattern by updating `$(AndroidNdkDirectory)` to instead default to `$(ANDROID_NDK_HOME)`, which is now NDK r23. Additionally, update `EnvironmentHelper.AssertValidEnvironmentSharedLibrary()` to also look for `llvm-readelf`, the replacement for `readelf` in NDK r24+. Pattern 2 is that the `aarch64-linux-android28-clang.cmd` & related scripts on Windows don't support being run from a directory containing spaces: CC="C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD" … [CC] "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" ^ -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" ^ obj\Release\bundles\armeabi-v7a\temp.c [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK' is not recognized as an internal or external command, [cc stderr] operable program or batch file. Fix this pattern by updating `NdkToolsWithClangNoBinutils` to override the C and C++ compiler toolnames, a'la: 71ae556.
Context: 70272db Context: 38b1236 Context: https://github.com/actions/virtual-environments/blob/9cf1ebd754807fba137c8ce9fa2140311609fdd6/images/win/Windows2022-Readme.md Context: actions/runner-images@2950cbf Changes: http://github.com/xamarin/xamarin-android-tools/compare/20f611202bef0fc7c1659366dd38865eb119dde5...ec346d07cf3ac7fc74d08eae4f19043b51485724 * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171) * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170) We've had an "inadvertent thinko" for the past couple of months: in commit 70272db we updated the default `$(AndroidNdkDirectory)` value to be `$(ANDROID_NDK_LATEST_HOME)`, if set. *At the time*, we think this was NDK r23. In commit 38b1236, we updated `xaprepare` to install NDK r24. The "thinko" is that commit 38b1236 was *irrelevant*, as commit 70272db was "in control". The Windows **Prepare Solution** log would contain e.g.: Checking if android-ndk-r24-windows exists in C:\Android\android-sdk\ndk\23.2.8568313 Component 'android-ndk-r24-windows' requires Pkg.Revision to be '24.0.8215888', verifying installed It also *mis-detected* NDK r23 as r24 (?!). It "worked" only by coincidence. Around 2022-Jun-09, GitHub actions updated the default NDK installed on their Windows images; previously, `$(ANDROID_NDK_LATEST_HOME)` was NDK r23 or earlier (we're not sure); *now*, it is NDK r24. This subtle change -- invisible! The build environment changed! -- *introduced* unit test failures, of two patterns. Pattern 1 is that `readelf` could not be found: System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf' with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489 -or- System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489 This happened because `readelf` was *removed* in NDK r24. Fix this pattern updating `EnvironmentHelper.AssertValidEnvironmentSharedLibrary()` to also look for `llvm-readelf`, the replacement for `readelf` in NDK r24+. Pattern 2 is that the `aarch64-linux-android28-clang.cmd` & related scripts on Windows don't support being run from a directory containing spaces: CC="C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD" … [CC] "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" ^ -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" ^ obj\Release\bundles\armeabi-v7a\temp.c [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK' is not recognized as an internal or external command, [cc stderr] operable program or batch file. Fix this pattern by updating `NdkToolsWithClangNoBinutils` to override the C and C++ compiler toolnames, a'la: 71ae556.
Context: 70272db Context: 38b1236 Context: https://github.com/actions/virtual-environments/blob/9cf1ebd754807fba137c8ce9fa2140311609fdd6/images/win/Windows2022-Readme.md Context: actions/runner-images@2950cbf Changes: http://github.com/xamarin/xamarin-android-tools/compare/20f611202bef0fc7c1659366dd38865eb119dde5...ec346d07cf3ac7fc74d08eae4f19043b51485724 * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (dotnet#171) * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (dotnet#170) We've had an "inadvertent thinko" for the past couple of months: in commit 70272db we updated the default `$(AndroidNdkDirectory)` value to be `$(ANDROID_NDK_LATEST_HOME)`, if set. *At the time*, we think this was NDK r23. In commit 38b1236, we updated `xaprepare` to install NDK r24. The "thinko" is that commit 38b1236 was *irrelevant*, as commit 70272db was "in control". The Windows **Prepare Solution** log would contain e.g.: Checking if android-ndk-r24-windows exists in C:\Android\android-sdk\ndk\23.2.8568313 Component 'android-ndk-r24-windows' requires Pkg.Revision to be '24.0.8215888', verifying installed It also *mis-detected* NDK r23 as r24 (?!). It "worked" only by coincidence. Around 2022-Jun-09, GitHub actions updated the default NDK installed on their Windows images; previously, `$(ANDROID_NDK_LATEST_HOME)` was NDK r23 or earlier (we're not sure); *now*, it is NDK r24. This subtle change -- invisible! The build environment changed! -- *introduced* unit test failures, of two patterns. Pattern 1 is that `readelf` could not be found: System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf' with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489 -or- System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489 This happened because `readelf` was *removed* in NDK r24. Fix this pattern updating `EnvironmentHelper.AssertValidEnvironmentSharedLibrary()` to also look for `llvm-readelf`, the replacement for `readelf` in NDK r24+. Pattern 2 is that the `aarch64-linux-android28-clang.cmd` & related scripts on Windows don't support being run from a directory containing spaces: CC="C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD" … [CC] "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" ^ -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" ^ obj\Release\bundles\armeabi-v7a\temp.c [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK' is not recognized as an internal or external command, [cc stderr] operable program or batch file. Fix this pattern by updating `NdkToolsWithClangNoBinutils` to override the C and C++ compiler toolnames, a'la: 71ae556.
Context: 70272db Context: 38b1236 Context: https://github.com/actions/virtual-environments/blob/9cf1ebd754807fba137c8ce9fa2140311609fdd6/images/win/Windows2022-Readme.md Context: actions/runner-images@2950cbf Changes: http://github.com/xamarin/xamarin-android-tools/compare/20f611202bef0fc7c1659366dd38865eb119dde5...ec346d07cf3ac7fc74d08eae4f19043b51485724 * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (#171) * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (#170) We've had an "inadvertent behavior" for the past couple of months: in commit 70272db we updated the default `$(AndroidNdkDirectory)` value to be `$(ANDROID_NDK_LATEST_HOME)`, if set. *At the time*, we think this was NDK r23. In commit 38b1236, we updated `xaprepare` to install NDK r24. This appears to have caused `xaprepare` to update the *system* `$(ANDROID_NDK_LATEST_HOME)` location, not a xamarin-android-specific NDK installation. The Windows **Prepare Solution** log would contain e.g.: Checking if android-ndk-r24-windows exists in C:\Android\android-sdk\ndk\23.2.8568313 Component 'android-ndk-r24-windows' requires Pkg.Revision to be '24.0.8215888', verifying installed This appears to imply that `C:\Android\android-sdk\ndk\23.2.8568313` was updated to have NDK 24.0.8215888. Meanwhile, *unit tests* were using `$(ANDROID_SDK_PATH)` and `$(ANDROID_NDK_PATH)`, which had been using NDK *r21*. Around 2022-Jun-09, GitHub actions updated the default NDK installed on their Windows images; previously, `$(ANDROID_NDK_LATEST_HOME)` was NDK r23 or earlier (we're not sure); *now*, it is NDK r24. `$(ANDROID_NDK_PATH)` had been NDK r21; now it is NDK r23. This subtle change -- invisible! The build environment changed! -- *introduced* unit test failures, of two patterns. Scenario 1 is that `readelf` could not be found: System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf' with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489 -or- System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489 This happened because `readelf` was *removed* in NDK r24. Fix this scenario updating `EnvironmentHelper.AssertValidEnvironmentSharedLibrary()` to also look for `llvm-readelf`, the replacement for `readelf` in NDK r24+. Scenario 2 is that the `aarch64-linux-android28-clang.cmd` & related scripts on Windows in NDK r23+ don't support being run from a directory containing spaces: CC="C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD" … [CC] "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" ^ -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" ^ obj\Release\bundles\armeabi-v7a\temp.c [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK' is not recognized as an internal or external command, [cc stderr] operable program or batch file. Fix this scenario by updating `NdkToolsWithClangNoBinutils` to override the C and C++ compiler toolnames, a'la commit 71ae556. To help make investigating `AndroidDependenciesTests.InstallAndroidDependenciesTest()` tests failures easier, send the `InstallAndroidDependencies` target execution output to an `install-deps.log` file. Previously, the subsequent `Build` target would *overwrite* the output of the `InstallAndroidDependencies` output, as they both shared `build.log`. Finally, update `AndroidSdkResolver.GetAndroidSdkPath()` and `AndroidSdkResolver.GetAndroidNdkPath()` to *stop* looking at the `$(ANDROID_SDK_PATH)` and `$(ANDROID_NDK_PATH)` environment variables. Instead, unit tests should use the `$(TEST_ANDROID_SDK_PATH)` environment variable, which is managed by the unit test infrastructure.
Context: 70272db Context: 38b1236 Context: https://github.com/actions/virtual-environments/blob/9cf1ebd754807fba137c8ce9fa2140311609fdd6/images/win/Windows2022-Readme.md Context: actions/runner-images@2950cbf Changes: http://github.com/xamarin/xamarin-android-tools/compare/20f611202bef0fc7c1659366dd38865eb119dde5...ec346d07cf3ac7fc74d08eae4f19043b51485724 * dotnet/android-tools@ec346d0: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r24 (#171) * dotnet/android-tools@47832f1: [Xamarin.Android.Tools.AndroidSdk] AndroidSdkInfo validation locator (#170) We've had an "inadvertent behavior" for the past couple of months: in commit 70272db we updated the default `$(AndroidNdkDirectory)` value to be `$(ANDROID_NDK_LATEST_HOME)`, if set. *At the time*, we think this was NDK r23. In commit 38b1236, we updated `xaprepare` to install NDK r24. This appears to have caused `xaprepare` to update the *system* `$(ANDROID_NDK_LATEST_HOME)` location, not a xamarin-android-specific NDK installation. The Windows **Prepare Solution** log would contain e.g.: Checking if android-ndk-r24-windows exists in C:\Android\android-sdk\ndk\23.2.8568313 Component 'android-ndk-r24-windows' requires Pkg.Revision to be '24.0.8215888', verifying installed This appears to imply that `C:\Android\android-sdk\ndk\23.2.8568313` was updated to have NDK 24.0.8215888. Meanwhile, *unit tests* were using `$(ANDROID_SDK_PATH)` and `$(ANDROID_NDK_PATH)`, which had been using NDK *r21*. Around 2022-Jun-09, GitHub actions updated the default NDK installed on their Windows images; previously, `$(ANDROID_NDK_LATEST_HOME)` was NDK r23 or earlier (we're not sure); *now*, it is NDK r24. `$(ANDROID_NDK_PATH)` had been NDK r21; now it is NDK r23. This subtle change -- invisible! The build environment changed! -- *introduced* unit test failures, of two patterns. Scenario 1 is that `readelf` could not be found: System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\readelf' with working directory 'C:\a_work\1\s\xamarin-android\bin\TestRelease\net6.0'. The system cannot find the file specified. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 550 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Utilities\EnvironmentHelper.cs:line 489 -or- System.ComponentModel.Win32Exception : The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at Xamarin.Android.Build.Tests.EnvironmentHelper.RunCommand(String executablePath, String arguments) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 551 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertSharedLibraryHasRequiredSymbols(String dsoPath, String readElfPath) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 495 at Xamarin.Android.Build.Tests.EnvironmentHelper.AssertValidEnvironmentSharedLibrary(String outputDirectoryRoot, String sdkDirectory, String ndkDirectory, String supportedAbis) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs:line 489 This happened because `readelf` was *removed* in NDK r24. Fix this scenario updating `EnvironmentHelper.AssertValidEnvironmentSharedLibrary()` to also look for `llvm-readelf`, the replacement for `readelf` in NDK r24+. Scenario 2 is that the `aarch64-linux-android28-clang.cmd` & related scripts on Windows in NDK r23+ don't support being run from a directory containing spaces: CC="C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" AS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\binutils\bin\arm-linux-androideabi-as.CMD" … [CC] "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi19-clang.CMD" ^ -c -D__ANDROID_API__=19 -DANDROID -o obj\Release\bundles\armeabi-v7a\temp.o ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\arm-linux-androideabi" ^ -I "C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK Ümläüts\ndk\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include" ^ obj\Release\bundles\armeabi-v7a\temp.c [cc stderr] 'C:\a\_work\1\a\TestRelease\06-13_18.07.09\temp\SDK' is not recognized as an internal or external command, [cc stderr] operable program or batch file. Fix this scenario by updating `NdkToolsWithClangNoBinutils` to override the C and C++ compiler toolnames, a'la commit 71ae556. To help make investigating `AndroidDependenciesTests.InstallAndroidDependenciesTest()` tests failures easier, send the `InstallAndroidDependencies` target execution output to an `install-deps.log` file. Previously, the subsequent `Build` target would *overwrite* the output of the `InstallAndroidDependencies` output, as they both shared `build.log`. Finally, update `AndroidSdkResolver.GetAndroidSdkPath()` and `AndroidSdkResolver.GetAndroidNdkPath()` to *stop* looking at the `$(ANDROID_SDK_PATH)` and `$(ANDROID_NDK_PATH)` environment variables. Instead, unit tests should use the `$(TEST_ANDROID_SDK_PATH)` environment variable, which is managed by the unit test infrastructure.
OutputLibraryPathfor Linux