dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.32k stars 4.74k forks source link

WSL2 Ubuntu ARM64 build error #38958

Open pgovind opened 4 years ago

pgovind commented 4 years ago

Just logging an issue I ran into while building dotnet/runtime on WSL2 Arm64:

_$ ./build.sh clr -c release_
.
.
.
Build FAILED.

/home/prgovi/repos/runtime_2/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj(87,5): error MSB3030: Could not copy the file "/home/prgovi/repos/runtime_2/artifacts/bin/coreclr/Linux.arm64.Release//x64/libjitinterface.so" because it was not found.
/home/prgovi/.nuget/packages/microsoft.build.traversal/2.0.34/Sdk/Sdk.targets(116,5): error MSB4181: The "MSBuild" task returned false but did not log an error. [/home/prgovi/repos/runtime_2/Build.proj]
    0 Warning(s)
    2 Error(s)

I'm not super familiar with the build infra, but it looks like a bad path? I see a "/x64" in the error message. Running find . -name libjitinterface* gives this:

./artifacts/obj/coreclr/Linux.arm64.Release/src/tools/aot/jitinterface/libjitinterface.so
./artifacts/bin/coreclr/Linux.arm64.Release/libjitinterface.so
./artifacts/bin/coreclr/Linux.arm64.Release/crossgen2/libjitinterface.so

@carlossanlop @safern @eiriktsarpalis

ghost commented 4 years ago

Tagging subscribers to this area: @ViktorHofer Notify danmosemsft if you want to be subscribed.

safern commented 4 years ago

cc: @jkoritzinsky @jashook @trylek

carlossanlop commented 4 years ago

I hit this too:

/home/carlos/runtime/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj(87,5):
error MSB3030:
Could not copy the file "/home/carlos/runtime/artifacts/bin/coreclr/Linux.arm64.Release//x64/libjitinterface.so" because it was not found.

I think the problem is in the path creation - notice the second string has a double // - I suspect the string was expecting something to get embedded in there.

safern commented 4 years ago

The problem is here:

https://github.com/dotnet/runtime/blob/3527fdefde316439b0b28f88febd02fcd93ea34b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj#L83

since that is using CrossHostArch which defaults to x64 if TargetArchitecture == arm64 -- I think this is very specialized for cross build inside an x64 host.

https://github.com/dotnet/runtime/blob/3527fdefde316439b0b28f88febd02fcd93ea34b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj#L45

As a temporary workaround you could just pass that property globally as empty: /p:CrossHostArch=.

@trylek @jkoritzinsky maybe we should check the host architecture instead to see if it differs from TargetArchitecture or is there a way to know if it is a cross build?

jkoritzinsky commented 4 years ago

Yes we should. We have checks in the installer build for not using the "cross host arch" when Host = Target Arch.

safern commented 4 years ago

Yeah, $(BuildArchitecture) is the property.

https://github.com/dotnet/runtime/blob/74b173787bad85eac022b9fb680f247aeda76305/Directory.Build.props#L103

And we have some properties for this apparently: https://github.com/dotnet/runtime/blob/74b173787bad85eac022b9fb680f247aeda76305/eng/liveBuilds.targets#L77

We should probably just use that property instead to construct the file path.

AndyAyersMS commented 2 years ago

Hitting this now too, building natively for arm64 on a Macbook.