-
Notifications
You must be signed in to change notification settings - Fork 531
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
Can't build .NET 7 android projects #7939
Comments
@grendello any ideas on this one? |
This code is generated when assembly stores are disabled ( |
Fragment of code generated locally when assembly stores are disabled:
It's an array of such entries, the fragment in the error message in OP isn't sufficient to say what |
@grendello Thanks for the quick response. The zipfile is 26mb and I'm only allowed to upload 25mb. Is there any folders that i can skip to make the file smaller ? EDIT: Uploaded it to file.io |
I can confirm that the ll files in the provided sample fail to build, even though the code between my local test and them is nearly identical (the only difference is buffer size): Local:
Example app:
Syntactically they're identical, so it must be something else in the file throwing llc off. Fascinating. |
If I manually change |
@grendello I don't know if it helps. But the errors for environment is randomly between every build. Sometimes it only complains about ie. environment.arm64-v8a.ll and other builds it complains about one or more. :) |
@mrhenkiz I suspect there's some earlier bit of code that is somehow corrupted (perhaps a filesystem issue, hard to tell). I'll investigate later today and will try to reproduce locally using your sample. |
@grendello Great, thanks. I can also say that i get same errors on a wiped intel mac where I only installed vs 2022 17.5.3 and created a project from the template (same versions as on the M1) and built. |
FWIW, I also get this same error consistently on two different projects when trying to build with .net7.0-android, and it works with .net6.0-android (on an M2 mac). |
OK, I know what happens, but no idea why yet. So, consider these two entries from the same array:
The first one works, the 2nd one doesn't. And you would be forgiven if you don't spot the difference, because it depends on your display font :). The problem is the Since the integer is output to the file with ye olde @mrhenkiz @rhult what are your locales on the machines you see the error occur? |
For context: dotnet/runtime#13363 |
I'm using sv_SE.UTF-8 on macOS. |
@rhult precisely the encoding that causes the problem then. We have the answer, now off to fix it :) The fix is simple, but you might want to work around the problem by using |
Thanks for quick response @grendello. @rhult Did you confirm that it's working if you change LANG ? Where to change the lang in macos? |
FYI, these cultures also use the same minus sign and will be affected by this bug:
|
If you build from command line, you can just do: $ LANG=en_US.UTF-8 dotnet build [...] |
@mrhenkiz you can put export LANG=en_US.UTF-8 in the |
@grendello Thank you. It worked like a charm when I added it to .zshrc :) Great job! |
Fixes: dotnet#7939 Context: dotnet/runtime#13363 Context: https://www.unicode.org/charts/PDF/U2200.pdf (page 2) LLVM IR generator outputs a number of integer values, relying on the standard `ToString()` method to convert the value to string. However, since NET6, this conversion is culture-sensitive and in certain cultures (list below) it will output the minus sign not as the standard ASCII 0x2D character but rather as the Unicode 0x2212 (mathematical operator "minus") character. This breaks LLVM LLC: llc: environment.arm64-v8a.ll:554:7: error: expected value token stderr | i32 −1, ; apk_fd Fix the problem by using invariant culture when converting **all** integers and unknown objects to strings. The reason all of them are converted in this way is to avoid future changes to ICU and/or .NET to-string conversion that might affect the resulting integer format. Locales/cultures affected by this issue are as follows: * et * et-EE * eu * eu-ES * fi * fi-FI * fo * fo-DK * fo-FO * gsw * gsw-CH * gsw-FR * gsw-LI * hr * hr-BA * hr-HR * ksh * ksh-DE * lt * lt-LT * nb * nb-NO * nb-SJ * nn * nn-NO * no * rm * rm-CH * se * se-FI * se-NO * se-SE * sl * sl-SI * sv * sv-AX * sv-FI * sv-SE
How can I change LANG in Windows? |
|
I have same error after changing system language from zh-TW to en-US. 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.26\tools\Xamarin.Android.Common.targets(1979,3): error XA3006: Could not compile native assembly file: typemaps.arm64-v8a.ll |
@PRMrainbow are you absolutely sure it's the same error? The dotnet build -c Release -bl
dotnet msbuild -v:diag msbuild.binlog > msbuild.txt and then locate the string |
Well... It was built successfully with 'dotnet build -c Release -bl' while building in Visual Studio IDE it failed. So I can't get an error in msbuild.txt. |
@PRMrainbow then it's unlikely to be the same issue. However, maybe you'll get more info if you enable diagnostic MSBuild messages inside the IDE and hunt for the error in the output buffer after the build fails there. |
Fixes: #7939 Context: dotnet/runtime#13363 Context: https://www.unicode.org/charts/PDF/U2200.pdf (page 2) Context: 5271f3e The LLVM IR generator (5271f3e) outputs a number of integer values, relying on the standard `int.ToString()` method to convert the value to a string. However, since .NET 6, this conversion is culture- sensitive and in certain cultures (list below) it will output the minus sign not as the "standard" ASCII \u002d character `-` but instead as something else (see complete list below for details). This breaks LLVM LLC: llc: environment.arm64-v8a.ll:554:7: error: expected value token stderr | i32 −1, ; apk_fd Fix the problem by using invariant culture when converting ***all*** integers and unknown objects to strings. The reason all of them are converted in this way is to avoid future changes to ICU and/or .NET to-string conversion that might affect the resulting integer format. Workaround: export `$LANG` to a locale that uses 0x2D `-` for negation, e.g. `LANG=C`. Locales/cultures affected by this issue are as follows: * ARABIC LETTER MARK + HYPHEN-MINUS `-` (\u061c \u002d): 26 cultures * ar * ar-001 * ar-BH * ar-DJ * ar-EG * ar-ER * ar-IL * ar-IQ * ar-JO * ar-KM * ar-KW * ar-LB * ar-MR * ar-OM * ar-PS * ar-QA * ar-SA * ar-SD * ar-SO * ar-SS * ar-SY * ar-TD * ar-YE * sd * sd-Arab * sd-Arab-PK * LEFT-TO-RIGHT MARK + HYPHEN-MINUS `-` (\u200e \u002d): 10 cultures * ar-AE * ar-DZ * ar-EH * ar-LY * ar-MA * ar-TN * he * he-IL * ur * ur-PK * RIGHT-TO-LEFT MARK + HYPHEN-MINUS `-` (\u200f \u002d): 3 cultures * ckb * ckb-IQ * ckb-IR * MINUS SIGN `−` (\u2212): 38 cultures * et * et-EE * eu * eu-ES * fi * fi-FI * fo * fo-DK * fo-FO * gsw * gsw-CH * gsw-FR * gsw-LI * hr * hr-BA * hr-HR * ksh * ksh-DE * lt * lt-LT * nb * nb-NO * nb-SJ * nn * nn-NO * no * rm * rm-CH * se * se-FI * se-NO * se-SE * sl * sl-SI * sv * sv-AX * sv-FI * sv-SE * LEFT-TO-RIGHT MARK + MINUS SIGN `−` (\u200e \u2212): 3 cultures * fa * fa-AF * fa-IR * LEFT-TO-RIGHT MARK + HYPHEN-MINUS + LEFT-TO-RIGHT MARK `-` (\u200e \u002d \u002e): 16 cultures * ks * ks-Arab * ks-Arab-IN * lrc * lrc-IQ * lrc-IR * mzn * mzn-IR * pa-Arab * pa-Arab-PK * ps * ps-AF * ps-PK * ur-IN * uz-Arab * uz-Arab-AF Update `BuildTest2.BuildBasicApplication()` to export `LANG=sv_SE.UTF-8` as part of the `dotnet build` command to test this scenario on macOS and Linux. (This change is ignored on Windows.)
Fixes: #7939 Context: dotnet/runtime#13363 Context: https://www.unicode.org/charts/PDF/U2200.pdf (page 2) Context: 5271f3e The LLVM IR generator (5271f3e) outputs a number of integer values, relying on the standard `int.ToString()` method to convert the value to a string. However, since .NET 6, this conversion is culture- sensitive and in certain cultures (list below) it will output the minus sign not as the "standard" ASCII \u002d character `-` but instead as something else (see complete list below for details). This breaks LLVM LLC: llc: environment.arm64-v8a.ll:554:7: error: expected value token stderr | i32 −1, ; apk_fd Fix the problem by using invariant culture when converting ***all*** integers and unknown objects to strings. The reason all of them are converted in this way is to avoid future changes to ICU and/or .NET to-string conversion that might affect the resulting integer format. Workaround: export `$LANG` to a locale that uses 0x2D `-` for negation, e.g. `LANG=C`. Locales/cultures affected by this issue are as follows: * ARABIC LETTER MARK + HYPHEN-MINUS `-` (\u061c \u002d): 26 cultures * ar * ar-001 * ar-BH * ar-DJ * ar-EG * ar-ER * ar-IL * ar-IQ * ar-JO * ar-KM * ar-KW * ar-LB * ar-MR * ar-OM * ar-PS * ar-QA * ar-SA * ar-SD * ar-SO * ar-SS * ar-SY * ar-TD * ar-YE * sd * sd-Arab * sd-Arab-PK * LEFT-TO-RIGHT MARK + HYPHEN-MINUS `-` (\u200e \u002d): 10 cultures * ar-AE * ar-DZ * ar-EH * ar-LY * ar-MA * ar-TN * he * he-IL * ur * ur-PK * RIGHT-TO-LEFT MARK + HYPHEN-MINUS `-` (\u200f \u002d): 3 cultures * ckb * ckb-IQ * ckb-IR * MINUS SIGN `−` (\u2212): 38 cultures * et * et-EE * eu * eu-ES * fi * fi-FI * fo * fo-DK * fo-FO * gsw * gsw-CH * gsw-FR * gsw-LI * hr * hr-BA * hr-HR * ksh * ksh-DE * lt * lt-LT * nb * nb-NO * nb-SJ * nn * nn-NO * no * rm * rm-CH * se * se-FI * se-NO * se-SE * sl * sl-SI * sv * sv-AX * sv-FI * sv-SE * LEFT-TO-RIGHT MARK + MINUS SIGN `−` (\u200e \u2212): 3 cultures * fa * fa-AF * fa-IR * LEFT-TO-RIGHT MARK + HYPHEN-MINUS + LEFT-TO-RIGHT MARK `-` (\u200e \u002d \u002e): 16 cultures * ks * ks-Arab * ks-Arab-IN * lrc * lrc-IQ * lrc-IR * mzn * mzn-IR * pa-Arab * pa-Arab-PK * ps * ps-AF * ps-PK * ur-IN * uz-Arab * uz-Arab-AF Update `BuildTest2.BuildBasicApplication()` to export `LANG=sv_SE.UTF-8` as part of the `dotnet build` command to test this scenario on macOS and Linux. (This change is ignored on Windows.)
Android application type
.NET Android (net7.0-android, etc.)
Affected platform version
VS 2022 17.5.3, .NET SDK 7.0.200, osx.13-arm64, Mono 6.12.0.188
Description
Can't build .NET 7.0 android project, newly created from template in visual studio. If i change to .net6.0-android however, it will build.
Csproj:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net7.0-android</TargetFramework> <SupportedOSPlatformVersion>23</SupportedOSPlatformVersion> <OutputType>Exe</OutputType> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <ApplicationId>com.companyname.AndroidApp1</ApplicationId> <ApplicationVersion>1</ApplicationVersion> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <TargetFrameworkVersion>v11.0</TargetFrameworkVersion> </PropertyGroup>
My system:
.NET SDK:
Version: 7.0.202
Commit: 6c74320bc3
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.3
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.202/
Host:
Version: 7.0.4
Architecture: arm64
Commit: 0a396acafe
.NET SDKs installed:
6.0.407 [/usr/local/share/dotnet/sdk]
7.0.202 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Workloads:
Installed Workload Id Manifest Version Installation Source
wasm-tools 7.0.4/7.0.100 SDK 7.0.200
macos 13.1.1040/7.0.100 SDK 7.0.200
maui-maccatalyst 7.0.59/7.0.100 SDK 7.0.200
maui-ios 7.0.59/7.0.100 SDK 7.0.200
maui-android 7.0.59/7.0.100 SDK 7.0.200
tvos 16.1.1537/7.0.100 SDK 7.0.200
android 33.0.26/7.0.100 SDK 7.0.200
Steps to Reproduce
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: