-
Notifications
You must be signed in to change notification settings - Fork 533
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
Could not AOT the Assemblies - Visual Studio 16.10 #5964
Comments
This looks like a duplicate of #5764 |
Sorry @dellis1972, I missed that because it was raised in March, I assumed it would have been amongst the more recent issues. |
@EP01 no problem :D |
@dellis1972 Can you reopen this issue. Because #5764 is a different issue. I discovered that llvm with Visual Studio 2019 16.10 doesn't work. Works: And altough azure devops builds start failing because of this. |
The same issue for AzureDevOps builds:
|
Fixes dotnet#5964 We missed a few paths which might need to be quoted in order to handle spaces in the paths. ``` 2021-05-28T22:15:09.3191452Z [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" 2021-05-28T22:15:09.3195848Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3197593Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory 2021-05-28T22:15:09.3199375Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3200935Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory 2021-05-28T22:15:09.3202549Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3204244Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory 2021-05-28T22:15:09.3205865Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind 2021-05-28T22:15:09.3207138Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras 2021-05-28T22:15:09.3208785Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real 2021-05-28T22:15:09.3210086Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl ``` So lets quote ALL the things.
Fixes dotnet#5964 We missed a few paths which might need to be quoted in order to handle spaces in the paths. ``` 2021-05-28T22:15:09.3191452Z [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" 2021-05-28T22:15:09.3195848Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3197593Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory 2021-05-28T22:15:09.3199375Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3200935Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory 2021-05-28T22:15:09.3202549Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3204244Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory 2021-05-28T22:15:09.3205865Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind 2021-05-28T22:15:09.3207138Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras 2021-05-28T22:15:09.3208785Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real 2021-05-28T22:15:09.3210086Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl ``` So lets quote ALL the things.
Same issue on home PC and on Github actions |
Fixes dotnet#5964 We missed a few paths which might need to be quoted in order to handle spaces in the paths. ``` 2021-05-28T22:15:09.3191452Z [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" 2021-05-28T22:15:09.3195848Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3197593Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory 2021-05-28T22:15:09.3199375Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3200935Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory 2021-05-28T22:15:09.3202549Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory 2021-05-28T22:15:09.3204244Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory 2021-05-28T22:15:09.3205865Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind 2021-05-28T22:15:09.3207138Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras 2021-05-28T22:15:09.3208785Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real 2021-05-28T22:15:09.3210086Z [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl ``` So lets quote ALL the things.
@AndreyBespamyatnov or @VictorKochetkov : would either of you be able to provide a complete I'm confused, because the GitHub Actions Microsoft Windows Server 2019 Datacenter Image states that the Android NDK is installed under |
Fixes: #5964 Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1336413 Context: accc846 Context: 8923c11 Context: 9b928f9 Customers report that when building a project: 1. On Windows 2. With Visual Studio 16.10, *not* 16.9 or earlier 3. In Release configuration 4. With `$(AotAssemblies)`=True *and* `$(EnableLLVM)`=True 5. With the NDK installed into a directory containing spaces then the app fails to build: [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl The *immediate* cause of the failure is path quoting: the `arm-linux-androideabi-ld.EXE` invocation contains: -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x This value is not quoted, and parts of that path are seen in the error messages: error: cannot open Files: No such file or directory error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory "So", we say, "let's quote those paths!" Update the `<Aot/>` task so that *all* the paths passed to Mono in the `ld-flags` parameter are quoted, not just `libgcc.a`, `libc.so`, and `libm.so`. This fixes the above linker invocation. Additionally, update the `AotTests` test fixture so that when the tests run on Windows, Android SDK and NDK installation locations are symlinked into a directory containing spaces and Ümläüts. These "SDK Ümläüts" directories are then used by the unit tests. This helps *ensure* that we're appropriately wrapping paths, by ensuring that the SDK & NDK are in a directory with spaces. We don't (yet) use these "SDK Ümläüts" for macOS unit tests because the Android NDK `aarch64-linux-android21-clang` & related scripts don't properly quote paths either: `dirname $0`/clang --target=aarch64-linux-android21 "$@" which means an `SDK Ümläüts/ndk/…/aarch64-linux-android21-clang` invocation fails with: usage: dirname path TODO: address this shortcoming, by skipping `aarch64-linux-android21-clang` and instead directly executing `…/clang --target=aarch64-linux-android21`. --- …except. Except. Except a lot of this doesn't *quite* make sense. Lack of path quoting, *in and of itself*, is readily explainable and plainly observed here. The problem is that `ld-flags` construction hasn't changed much since commit 8923c11, in 2019-Sep-4 (21 months ago!), in particular the `libs.Add($"-L{toolchainLibDir}")` and `libs.Add($"-L{androidLibPath}")` statements. Commit 9b928f9 changed this slightly, wrapping `libgcc.a`/etc. with quotes, but did *not* touch `toolchainLibDir` or `androidLibPath`, both of which are responsible for the `-L…` values implicated in the above errors. Thus, we are getting customer complaints related to AOT path quoting when none of the relevant code has changed between d16-9 and d16-10. The only AOT-related change is accc846, which added support to pass the new-to-mono `ld-name` option for AOT. `ld-name` *doesn't* involve the directory name, and thus doesn't seem relevant here. We *know* `ld-flags` is *involved*, because updating the `ld-flags` value we provide to mono fixes the issue. However, is this a *fix* or a *workaround*? ¯\_(ツ)_/¯ Additionally, *why* did this start failing with d16-10? * Xamarin.Android change that isn't "obviously" related to AOT? * Mono changes? mono/mono@5e9cb6d...b4a3858 There are no "obvious" changes in behavior related to `ld-flags` or `ld_flags`, nor anything else "obvious" that would alter behavior. * "Environment" change, e.g. in d16-9 the NDK was installed into a directory that lacked spaces, while in d16-10 the NDK is now installed into a directory containing spaces? There *may* be something here, but it's hard to say. The [GitHub Actions Microsoft Windows Server 2019 Datacenter][0] environment lists the NDK installation location as a path with *no* spaces: C:\Android\android-sdk\ndk\22.1.7171670 Yet we have a report of the same "path quoting" failure happening ["on Github actions"][1], referencing a path that differs from the documented path: C:\Program Files (x86)\Android\android-sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x Why does the documentation mention `C:\Android`, while `C:\Program Files (x86)` is used? Did our NDK path lookup logic change? We don't currently know why things started blowing up in Visual Studio 16.10. Investigation is ongoing. [0]: https://github.com/actions/virtual-environments/blob/2823a3cb6a62cc74961527bdf7623b4b9afb4107/images/win/Windows2019-Readme.md [1]: #5964 (comment)
Fixes: #5964 Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1336413 Context: accc846 Context: 8923c11 Context: 9b928f9 Customers report that when building a project: 1. On Windows 2. With Visual Studio 16.10, *not* 16.9 or earlier 3. In Release configuration 4. With `$(AotAssemblies)`=True *and* `$(EnableLLVM)`=True 5. With the NDK installed into a directory containing spaces then the app fails to build: [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl The *immediate* cause of the failure is path quoting: the `arm-linux-androideabi-ld.EXE` invocation contains: -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x This value is not quoted, and parts of that path are seen in the error messages: error: cannot open Files: No such file or directory error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory "So", we say, "let's quote those paths!" Update the `<Aot/>` task so that *all* the paths passed to Mono in the `ld-flags` parameter are quoted, not just `libgcc.a`, `libc.so`, and `libm.so`. This fixes the above linker invocation. Additionally, update the `AotTests` test fixture so that when the tests run on Windows, Android SDK and NDK installation locations are symlinked into a directory containing spaces and Ümläüts. These "SDK Ümläüts" directories are then used by the unit tests. This helps *ensure* that we're appropriately wrapping paths, by ensuring that the SDK & NDK are in a directory with spaces. We don't (yet) use these "SDK Ümläüts" for macOS unit tests because the Android NDK `aarch64-linux-android21-clang` & related scripts don't properly quote paths either: `dirname $0`/clang --target=aarch64-linux-android21 "$@" which means an `SDK Ümläüts/ndk/…/aarch64-linux-android21-clang` invocation fails with: usage: dirname path TODO: address this shortcoming, by skipping `aarch64-linux-android21-clang` and instead directly executing `…/clang --target=aarch64-linux-android21`. --- …except. Except. Except a lot of this doesn't *quite* make sense. Lack of path quoting, *in and of itself*, is readily explainable and plainly observed here. The problem is that `ld-flags` construction hasn't changed much since commit 8923c11, in 2019-Sep-4 (21 months ago!), in particular the `libs.Add($"-L{toolchainLibDir}")` and `libs.Add($"-L{androidLibPath}")` statements. Commit 9b928f9 changed this slightly, wrapping `libgcc.a`/etc. with quotes, but did *not* touch `toolchainLibDir` or `androidLibPath`, both of which are responsible for the `-L…` values implicated in the above errors. Thus, we are getting customer complaints related to AOT path quoting when none of the relevant code has changed between d16-9 and d16-10. The only AOT-related change is accc846, which added support to pass the new-to-mono `ld-name` option for AOT. `ld-name` *doesn't* involve the directory name, and thus doesn't seem relevant here. We *know* `ld-flags` is *involved*, because updating the `ld-flags` value we provide to mono fixes the issue. However, is this a *fix* or a *workaround*? ¯\_(ツ)_/¯ Additionally, *why* did this start failing with d16-10? * Xamarin.Android change that isn't "obviously" related to AOT? * Mono changes? mono/mono@5e9cb6d...b4a3858 There are no "obvious" changes in behavior related to `ld-flags` or `ld_flags`, nor anything else "obvious" that would alter behavior. * "Environment" change, e.g. in d16-9 the NDK was installed into a directory that lacked spaces, while in d16-10 the NDK is now installed into a directory containing spaces? There *may* be something here, but it's hard to say. The [GitHub Actions Microsoft Windows Server 2019 Datacenter][0] environment lists the NDK installation location as a path with *no* spaces: C:\Android\android-sdk\ndk\22.1.7171670 Yet we have a report of the same "path quoting" failure happening ["on Github actions"][1], referencing a path that differs from the documented path: C:\Program Files (x86)\Android\android-sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x Why does the documentation mention `C:\Android`, while `C:\Program Files (x86)` is used? Did our NDK path lookup logic change? We don't currently know why things started blowing up in Visual Studio 16.10. Investigation is ongoing. [0]: https://github.com/actions/virtual-environments/blob/2823a3cb6a62cc74961527bdf7623b4b9afb4107/images/win/Windows2019-Readme.md [1]: #5964 (comment)
Fixes: #5964 Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1336413 Context: accc846 Context: 8923c11 Context: 9b928f9 Customers report that when building a project: 1. On Windows 2. With Visual Studio 16.10, *not* 16.9 or earlier 3. In Release configuration 4. With `$(AotAssemblies)`=True *and* `$(EnableLLVM)`=True 5. With the NDK installed into a directory containing spaces then the app fails to build: [aot-compiler stdout] Executing the native linker: "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE" -Bsymbolic -shared -o obj\Release\110\aot\armeabi-v7a\libaot-Xamarin.AndroidX.CardView.dll.so.tmp "obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp-llvm.o" obj\Release\110\aot\armeabi-v7a\Xamarin.AndroidX.CardView.dll\temp.s.o -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\libgcc.a" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libc.so" "C:\Program Files (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib\libm.so" [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\platforms\android-21\arch-arm\usr\lib: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open Files: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\..\sysroot\usr\lib\arm-linux-androideabi: No such file or directory [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lunwind [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lcompiler_rt-extras [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -lgcc_real [aot-compiler stderr] C:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ld.EXE: error: cannot find -ldl The *immediate* cause of the failure is path quoting: the `arm-linux-androideabi-ld.EXE` invocation contains: -LC:\Program Files (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x This value is not quoted, and parts of that path are seen in the error messages: error: cannot open Files: No such file or directory error: cannot open (x86)\Android\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x: No such file or directory "So", we say, "let's quote those paths!" Update the `<Aot/>` task so that *all* the paths passed to Mono in the `ld-flags` parameter are quoted, not just `libgcc.a`, `libc.so`, and `libm.so`. This fixes the above linker invocation. Additionally, update the `AotTests` test fixture so that when the tests run on Windows, Android SDK and NDK installation locations are symlinked into a directory containing spaces and Ümläüts. These "SDK Ümläüts" directories are then used by the unit tests. This helps *ensure* that we're appropriately wrapping paths, by ensuring that the SDK & NDK are in a directory with spaces. We don't (yet) use these "SDK Ümläüts" for macOS unit tests because the Android NDK `aarch64-linux-android21-clang` & related scripts don't properly quote paths either: `dirname $0`/clang --target=aarch64-linux-android21 "$@" which means an `SDK Ümläüts/ndk/…/aarch64-linux-android21-clang` invocation fails with: usage: dirname path TODO: address this shortcoming, by skipping `aarch64-linux-android21-clang` and instead directly executing `…/clang --target=aarch64-linux-android21`. --- …except. Except. Except a lot of this doesn't *quite* make sense. Lack of path quoting, *in and of itself*, is readily explainable and plainly observed here. The problem is that `ld-flags` construction hasn't changed much since commit 8923c11, in 2019-Sep-4 (21 months ago!), in particular the `libs.Add($"-L{toolchainLibDir}")` and `libs.Add($"-L{androidLibPath}")` statements. Commit 9b928f9 changed this slightly, wrapping `libgcc.a`/etc. with quotes, but did *not* touch `toolchainLibDir` or `androidLibPath`, both of which are responsible for the `-L…` values implicated in the above errors. Thus, we are getting customer complaints related to AOT path quoting when none of the relevant code has changed between d16-9 and d16-10. The only AOT-related change is accc846, which added support to pass the new-to-mono `ld-name` option for AOT. `ld-name` *doesn't* involve the directory name, and thus doesn't seem relevant here. We *know* `ld-flags` is *involved*, because updating the `ld-flags` value we provide to mono fixes the issue. However, is this a *fix* or a *workaround*? ¯\_(ツ)_/¯ Additionally, *why* did this start failing with d16-10? * Xamarin.Android change that isn't "obviously" related to AOT? * Mono changes? mono/mono@5e9cb6d...b4a3858 There are no "obvious" changes in behavior related to `ld-flags` or `ld_flags`, nor anything else "obvious" that would alter behavior. * "Environment" change, e.g. in d16-9 the NDK was installed into a directory that lacked spaces, while in d16-10 the NDK is now installed into a directory containing spaces? There *may* be something here, but it's hard to say. The [GitHub Actions Microsoft Windows Server 2019 Datacenter][0] environment lists the NDK installation location as a path with *no* spaces: C:\Android\android-sdk\ndk\22.1.7171670 Yet we have a report of the same "path quoting" failure happening ["on Github actions"][1], referencing a path that differs from the documented path: C:\Program Files (x86)\Android\android-sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x Why does the documentation mention `C:\Android`, while `C:\Program Files (x86)` is used? Did our NDK path lookup logic change? We don't currently know why things started blowing up in Visual Studio 16.10. Investigation is ongoing. [0]: https://github.com/actions/virtual-environments/blob/2823a3cb6a62cc74961527bdf7623b4b9afb4107/images/win/Windows2019-Readme.md [1]: #5964 (comment)
While trying to investigate what's going on… d16-10 install with the following files from 16-9:
d16-10 install with the following files from d16-9:
d16-10 install with the following files from d16-9:
Which implies a xamarin-android change. The change to This also allows us to ask a related question: Why isn't the path quoting in commit 6a5df16 needed? How did this work in d16-9? (I could install d16-9, but now that I have a "Frankenstein" build environment…) The answer? This explains why the lack of quotes around They weren't previously used because, by inference, This allows us to focus on |
Now we start getting to where I can't as easily provide URLs for diffs… git diff origin/d16-9...origin/d16-10 src/Xamarin.Android.Build.Tasks/Tasks/NdkUtils.cs Nothing directly related to the
And indeed, if I install an NDK r18 release, d16-10 is able to build with However, my frankenstein environment was able to build with an NDK >= 19. Why? Commit accc846 isn't present in d16-9, is present in d16-10, and has an important change: accc846#diff-d4dcca33896738b8e073a8fde94253a72f9b76cf0923179cb06a94a8db740f41R234 public async override System.Threading.Tasks.Task RunTaskAsync ()
{
// NdkUtil must always be initialized - once per thread
if (!NdkUtil.Init (LogCodedError, AndroidNdkDirectory)) {
LogDebugMessage ("Failed to initialize NdkUtil");
return;
} d16-9 has the same method override, but lacks the
Additionally, Consequently, on d16-9, d16-10 does appropriately call The reason it never broke before d16-10 is because we never properly set the info needed to know we were on a newer NDK until d16-10! |
Is a fix coming with the next update of VS 16.10? I am currently blocked and cannot archive apps... unfortunately switching over to a path without spaces does not work as a workarround for me, it still fails due to the same error. And still wondering why the path in the error message has a line break and a missing character at the position where the concatenation takes places:
|
Context: dotnet#5996 Context: dotnet#5964 Context: dotnet#5964 (comment) The `NdkUtils` class used by Xamarin.Andrid.Build.Tasks to find tooling shipped with the Android NDK, has grown increasingly complicated over the years due to a number of incompatibilities between various versions of the NDK. The code became hard to follow and untidy. This commit attempts to address the issue by replacing the single static `NdkUtils` class with a hierarchy of dynamically instantiated classes rooted in a new base class, `NdkTools`. `NdkUtils` had to be initialized for each thread that needed to access its methods, which led to various issues with concurrency and lack of proper initialization since the initialization had to be done wherever `NdkUtils` was first accessed, meaning that any task using it had to do it. `NdkTools` doesn't require such initialization, instead it provides a factory method called `Create` which takes path to the NDK as its parameter and returns an instance of `NdkTools` child class (or `null` if an error occurs) which the can be safely used by the caller. Callers need not concern themselves with what is the actual type of the returned instance, they access only methods and properties defined in the `NdkTools` base abstract class. The hierarchy of `NdkTools` derivatives is structured and named after the breaking changes in the NDK. For instance, NDK versions before 16 used the GNU compilers, while release 16 and above use the clang compilers - this is reflected in existence of two classes derived from `NdkTools`, `NoClang` for NDKs older than r16 and `WithClang` for the newer ones. The other breaking changes are the addition of unified headers in r19, removal of the `platforms` directory in r22 and removal of GNU Binutils in r23. NDK r23 is recognized in this commit but it is NOT supported. Support for r23 is being worked on in PR dotnet#6073 which will be merged once r23 is out of beta.
Context: dotnet#5996 Context: dotnet#5964 Context: dotnet#5964 (comment) The `NdkUtils` class used by Xamarin.Andrid.Build.Tasks to find tooling shipped with the Android NDK, has grown increasingly complicated over the years due to a number of incompatibilities between various versions of the NDK. The code became hard to follow and untidy. This commit attempts to address the issue by replacing the single static `NdkUtils` class with a hierarchy of dynamically instantiated classes rooted in a new base class, `NdkTools`. `NdkUtils` had to be initialized for each thread that needed to access its methods, which led to various issues with concurrency and lack of proper initialization since the initialization had to be done wherever `NdkUtils` was first accessed, meaning that any task using it had to do it. `NdkTools` doesn't require such initialization, instead it provides a factory method called `Create` which takes path to the NDK as its parameter and returns an instance of `NdkTools` child class (or `null` if an error occurs) which the can be safely used by the caller. Callers need not concern themselves with what is the actual type of the returned instance, they access only methods and properties defined in the `NdkTools` base abstract class. The hierarchy of `NdkTools` derivatives is structured and named after the breaking changes in the NDK. For instance, NDK versions before 16 used the GNU compilers, while release 16 and above use the clang compilers - this is reflected in existence of two classes derived from `NdkTools`, `NoClang` for NDKs older than r16 and `WithClang` for the newer ones. The other breaking changes are the addition of unified headers in r19, removal of the `platforms` directory in r22 and removal of GNU Binutils in r23. NDK r23 is recognized in this commit but it is NOT supported. Support for r23 is being worked on in PR dotnet#6073 which will be merged once r23 is out of beta.
Context: dotnet#5996 Context: dotnet#5964 Context: dotnet#5964 (comment) The `NdkUtils` class used by Xamarin.Andrid.Build.Tasks to find tooling shipped with the Android NDK, has grown increasingly complicated over the years due to a number of incompatibilities between various versions of the NDK. The code became hard to follow and untidy. This commit attempts to address the issue by replacing the single static `NdkUtils` class with a hierarchy of dynamically instantiated classes rooted in a new base class, `NdkTools`. `NdkUtils` had to be initialized for each thread that needed to access its methods, which led to various issues with concurrency and lack of proper initialization since the initialization had to be done wherever `NdkUtils` was first accessed, meaning that any task using it had to do it. `NdkTools` doesn't require such initialization, instead it provides a factory method called `Create` which takes path to the NDK as its parameter and returns an instance of `NdkTools` child class (or `null` if an error occurs) which the can be safely used by the caller. Callers need not concern themselves with what is the actual type of the returned instance, they access only methods and properties defined in the `NdkTools` base abstract class. The hierarchy of `NdkTools` derivatives is structured and named after the breaking changes in the NDK. For instance, NDK versions before 16 used the GNU compilers, while release 16 and above use the clang compilers - this is reflected in existence of two classes derived from `NdkTools`, `NoClang` for NDKs older than r16 and `WithClang` for the newer ones. The other breaking changes are the addition of unified headers in r19, removal of the `platforms` directory in r22 and removal of GNU Binutils in r23. NDK r23 is recognized in this commit but it is NOT supported. Support for r23 is being worked on in PR dotnet#6073 which will be merged once r23 is out of beta.
Context: dotnet#5996 Context: dotnet#5964 Context: dotnet#5964 (comment) The `NdkUtils` class used by Xamarin.Andrid.Build.Tasks to find tooling shipped with the Android NDK, has grown increasingly complicated over the years due to a number of incompatibilities between various versions of the NDK. The code became hard to follow and untidy. This commit attempts to address the issue by replacing the single static `NdkUtils` class with a hierarchy of dynamically instantiated classes rooted in a new base class, `NdkTools`. `NdkUtils` had to be initialized for each thread that needed to access its methods, which led to various issues with concurrency and lack of proper initialization since the initialization had to be done wherever `NdkUtils` was first accessed, meaning that any task using it had to do it. `NdkTools` doesn't require such initialization, instead it provides a factory method called `Create` which takes path to the NDK as its parameter and returns an instance of `NdkTools` child class (or `null` if an error occurs) which the can be safely used by the caller. Callers need not concern themselves with what is the actual type of the returned instance, they access only methods and properties defined in the `NdkTools` base abstract class. The hierarchy of `NdkTools` derivatives is structured and named after the breaking changes in the NDK. For instance, NDK versions before 16 used the GNU compilers, while release 16 and above use the clang compilers - this is reflected in existence of two classes derived from `NdkTools`, `NoClang` for NDKs older than r16 and `WithClang` for the newer ones. The other breaking changes are the addition of unified headers in r19, removal of the `platforms` directory in r22 and removal of GNU Binutils in r23. NDK r23 is recognized in this commit but it is NOT supported. Support for r23 is being worked on in PR dotnet#6073 which will be merged once r23 is out of beta.
Context: #5964 Context: #5964 (comment) Context: #5996 Context: #6073 The `NdkUtils` class is used by Xamarin.Andrid.Build.Tasks to find tooling shipped with the Android NDK, and has grown increasingly complicated over the years due to a number of incompatibilities between various NDK versions. The code became hard to follow and untidy. Address this issue by replacing the single static `NdkUtils` class with a hierarchy of dynamically instantiated classes rooted in a new base class, `NdkTools`. `NdkUtils` had to be initialized for each thread that needed to access its methods, which led to various issues with concurrency and lack of proper initialization since the initialization had to be done wherever `NdkUtils` was first accessed, meaning that every task using it had to do it; see accc846 & [this comment][0]. `NdkTools` doesn't require such initialization, instead it provides an `NdkTools.Create()` factory method takes the path to the NDK and returns an instance of an `NdkTools` subclass (or `null` if an error occurs), which the can be safely used by the caller. Callers need not concern themselves with what is the actual type of the returned instance, they access only methods and properties defined in the `NdkTools` base abstract class. The hierarchy of `NdkTools` derivatives is structured and named after the breaking changes in the NDK. For instance, NDK versions before 16 used the GNU compilers, while release 16 and above use the clang compilers - this is reflected in existence of two classes derived from `NdkTools`, `NoClang` for NDKs older than r16 and `WithClang` for the newer ones. The other breaking changes are the addition of unified headers in r19, removal of the `platforms` directory in r22 and removal of GNU Binutils in r23. NDK r23 is recognized in this commit but it is NOT supported. Support for r23 is being worked on in PR #6073, which will be merged once r23 is out of beta. [0]: #5964 (comment)
@jonpryor I'm using Visual Studio for Mac 8.10.6 and this is still broken. Did the fix not land in the latest version? If not, when will it be released? It would be nice being able to make release builds again. Thank you. |
@Tommigun1980 I believe this fix is only available in VS Windows 16.11, there isn't an equivalent release for VS Mac yet. Can you try this build and see if it solves your issue, thanks! |
Steps to Reproduce
App2.zip
The text was updated successfully, but these errors were encountered: