Skip to content
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

tf: dotnet 6 [arm64] support? #1329

Closed
mieliespoor opened this issue Sep 22, 2022 · 15 comments
Closed

tf: dotnet 6 [arm64] support? #1329

mieliespoor opened this issue Sep 22, 2022 · 15 comments

Comments

@mieliespoor
Copy link
Contributor

Looking at the releases page, and then also https://github.com/SonarSource/sonar-scanner-msbuild/blob/master/src/DotnetVersions.props#L8 we see the highest framework supported is net5.

Any idea when dotnet 6 will be supported?

When running dotnet sonarscanner begin on an arm build agent trying to build an arm64 binary, we get the following response

You must install .NET to run this application.

App: /home/bambooagent/.dotnet/tools/dotnet-sonarscanner
Architecture: arm64
App host version: 6.0.7
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=amzn.2-arm64&apphost_version=6.0.7
@mieliespoor mieliespoor changed the title dotnet 6 support? tf: dotnet 6 [arm64] support? Sep 26, 2022
@mieliespoor
Copy link
Contributor Author

@andrei-epure-sonarsource is this something that can be looked at before the next release? Given that .NET 6 has been around for a long time already, I'm surprised that it isn't supported here. For ARM specifically, any plans to support that? It is a major blocker for us to not being able to run sonar analysis on ARM infrastructure.

@andrei-epure-sonarsource
Copy link
Contributor

andrei-epure-sonarsource commented Nov 2, 2022

@mieliespoor .NET 6 is supported by the Scanner since version 5.4.0 https://github.com/SonarSource/sonar-scanner-msbuild/releases/tag/5.4.0.40033. The packaging still contains the net5 name, but that means ".NET 5 or later" (including .NET 7, we already have integration tests in place). We have plans to improve the packaging to make it more user friendly, hopefully we'll do that in 2023.

Did you run a scan on .NET 6 infrastructure and it didn't work?

Did you install .NET on that machine? It seems it's a generic error message rather than something related to our scanner per se.

.NET location: Not found

It seems that .NET is not installed.

@mieliespoor
Copy link
Contributor Author

Yes, we only have dotnet 6 installed on it. We don't have any other dotnet versions installed for that matter. We will do some more tests tomorrow.

@bkaidbb
Copy link

bkaidbb commented Nov 4, 2022

I have this issue is well. It seems there is only x64 support, and not arm64 support required for running on newer Mac's.

@andrei-epure-sonarsource
Copy link
Contributor

related problem: dotnet/runtime#72636

Can you try and execute directly the DLL @mieliespoor @bkaidbb (see docs)?

dotnet <path to SonarScanner.MSBuild.dll> begin /k:"project-key" /d:sonar.login="<token>"

@andrei-epure-sonarsource
Copy link
Contributor

@mieliespoor @bkaidbb can you try and install

dotnet tool install --global dotnet-sonarscanner --arch arm64

This should work based on our tests.

@bkaidbb
Copy link

bkaidbb commented Nov 14, 2022

@andrei-epure-sonarsource Thanks, that worked!

@VaughanJ
Copy link

VaughanJ commented Nov 15, 2022

When running on a Linux instance:

dotnet tool install --global dotnet-sonarscanner --arch arm64
Unhandled exception: System.AggregateException: One or more errors occurred. (The runtime identifier linux-arm64 is invalid. Valid runtime identifiers are: win-x64 win-arm64 osx-x64 osx-arm64.)
 ---> Microsoft.DotNet.Cli.Utils.GracefulException: The runtime identifier linux-arm64 is invalid. Valid runtime identifiers are: win-x64 win-arm64 osx-x64 osx-arm64.

It looks like it's setup for OSX Arm, but not on Linux?

dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.302
 Commit:    c857713418

Runtime Environment:
 OS Name:     amzn
 OS Version:  2
 OS Platform: Linux
 RID:         linux-arm64
 Base Path:   /home/bambooagent/dotnet/sdk/6.0.302/

global.json file:
  Not found

Host:
  Version:      6.0.7
  Architecture: arm64
  Commit:       0ec02c8c96

.NET SDKs installed:
  3.1.422 [/home/bambooagent/dotnet/sdk]
  6.0.302 [/home/bambooagent/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.28 [/home/bambooagent/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.7 [/home/bambooagent/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.28 [/home/bambooagent/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.7 [/home/bambooagent/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

@mieliespoor
Copy link
Contributor Author

@andrei-epure-sonarsource Can you please re-open as this is not resolved.

@andrei-epure-sonarsource
Copy link
Contributor

andrei-epure-sonarsource commented Nov 15, 2022

It seems this is related to the fact that we target net5.0 and we have assumed that by using roll-forward LatestMajor, it will always be forward-compatible.

It is forward compatible, but from this comment, I understand this is a limitation of having .net5 as TFM. For some reason, the platform assumes it won't run on arm64.

efcore targetted net6 in dotnet/efcore#27807 especially to improve compatibility with arm64... but they have different building constraints, so it might be relevant.

Others in the ecosystem seem to plan the same ionide/Fornax#117 - but they mention osx-arm64, for which dotnet tool install --global dotnet-sonarscanner --arch arm64 works.

@andrei-epure-sonarsource
Copy link
Contributor

Thinking a bit more about this...

dotnet tool install --global dotnet-sonarscanner --arch arm64

worked for @bkaidbb .

And the error @VaughanJ gets is

Unhandled exception: System.AggregateException: One or more errors occurred. (The runtime identifier linux-arm64 is invalid. Valid runtime identifiers are: win-x64 win-arm64 osx-x64 osx-arm64.)
---> Microsoft.DotNet.Cli.Utils.GracefulException: The runtime identifier linux-arm64 is invalid. Valid runtime identifiers are: win-x64 win-arm64 osx-x64 osx-arm64.

@VaughanJ can you install any other dotnet global tool on your machine? Because this error doesn't seem related at all to our scanner.

@mieliespoor
Copy link
Contributor Author

We have been at this for a bit today and it would seem that the only solution here at the moment is to use the dll directly.

dotnet tool install --global dotnet-sonarscanner --arch arm64

Results in the error posted by Jon there for any tool being installed - we tried a few tools to be sure. This means it is an issue with dotnet rather than Sonarqube.

@bkaidbb however runs his on MacOS which is why all this behaves differently in his case.

I suppose we can close this after all.

@andrei-epure-sonarsource
Copy link
Contributor

Thanks for confirming @mieliespoor .

FYI we have plans to redo the packaging next year and we'll bump the TFM to net6 in that effort, in case that might help.

@mieliespoor
Copy link
Contributor Author

Thanks. This looks like a bug in dotnet sdk. I have logged a bug there and it was accepted.

@andrei-epure-sonarsource
Copy link
Contributor

Thanks @mieliespoor . For reference of future readers dotnet/sdk#29074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants