Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[XA.Build.Tasks] Add AndroidBinUtilsDirectory prop (#3567)
Fixes: #3564 Install Visual Studio for Mac on macOS 10.15 Catalina Beta 7, and build a project. Expected results: it builds! Actual results: not so much: Task Parameter:AndroidSdkBuildToolsPath=…/android-sdk-macosx/build-tools/28.0.3/ (TaskId:273) [Native Linker] …/android-sdk-macosx/build-tools/28.0.3/aarch64-linux-android-ld --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -o obj/Release/app_shared_libraries/arm64-v8a/libxamarin-app.so --fix-cortex-a53-843419 -m aarch64linux obj/Release/android/typemap.jm.arm64-v8a.o obj/Release/android/typemap.mj.arm64-v8a.o obj/Release/android/environment.arm64-v8a.o (TaskId:273) [Native Linker] …/android-sdk-macosx/build-tools/28.0.3/arm-linux-androideabi-ld --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -o obj/Release/app_shared_libraries/armeabi-v7a/libxamarin-app.so -X -m armelf_linux_eabi obj/Release/android/typemap.jm.armeabi-v7a.o obj/Release/android/typemap.mj.armeabi-v7a.o obj/Release/android/environment.armeabi-v7a.o (TaskId:273) /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2869,3): error XA3001: Could not link native shared library: libxamarin-app.so Done executing task "LinkApplicationSharedLibraries" -- FAILED. The cause of the error is: 1. `libxamarin-app.so` is required (see decfbcc), which 2. Requires that we be able to execute `arm-linux-androideabi-ld`, and 3. macOS 10.15 Catalina no longer executes 32-bit binaries. As it happens™, the Android SDK Build-tools package still contains 32-bit native binaries, up through and including Build-tools 29.0.0. (The Android NDK *does* contain 64-bit binaries.) At this time, we don't know if there will *be* a Build-tools package which contains 64-bit binaries before Catalina drops. It is also moot: as of f0b1e8a we now redistribute *our own* `*-ld` and `*-strip` utilities, which are 64-bit. There is thus no need to use the Build-tools versions of these files. The problem here was that some of our tasks used the bundled NDK tools, while some of our tasks didn't, and instead required that they exist within `$(AndroidSdkBuildToolsPath)`, the Android SDK Build-tools directory. Add a new overridable `$(AndroidBinUtilsDirectory)` MSBuild property which contains the `*-as`, `*-ld`, and `*-strip` utilities needed for assembling and linking native code. The value of this new property defaults to inside the Xamarin.Android installation path, `$(MonoAndroidBinDirectory)\ndk\`. `$(AndroidBinUtilsDirectory)` is an overridable property because the NDK utilities are GPL'd, and if someone wishes to use their own version of these utilities, overriding `$(AndroidBinUtilsDirectory)` will be much easier than replacing files within the installation directory. The result is that builds now use reliably 64-bit binaries: Task "LinkApplicationSharedLibraries" [Native Linker] /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/ndk/aarch64-linux-android-ld --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -o obj/Release/app_shared_libraries/arm64-v8a/libxamarin-app.so --fix-cortex-a53-843419 -m aarch64linux obj/Release/android/typemap.jm.arm64-v8a.o obj/Release/android/typemap.mj.arm64-v8a.o obj/Release/android/environment.arm64-v8a.o [Native Linker] /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/ndk/arm-linux-androideabi-ld --unresolved-symbols=ignore-in-shared-libs --export-dynamic -soname libxamarin-app.so -z relro -z noexecstack --enable-new-dtags --eh-frame-hdr -shared --build-id --warn-shared-textrel --fatal-warnings -o obj/Release/app_shared_libraries/armeabi-v7a/libxamarin-app.so -X -m armelf_linux_eabi obj/Release/android/typemap.jm.armeabi-v7a.o obj/Release/android/typemap.mj.armeabi-v7a.o obj/Release/android/environment.armeabi-v7a.o Done executing task "LinkApplicationSharedLibraries".
- Loading branch information