Skip to content

Fix non-portable coreclr arm64 build #63121

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

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

gbalykov
Copy link
Member

Without this change arm64 coreclr build for tizen breaks with:

/home/runtime/.dotnet/sdk/6.0.100/Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "/home/runtime/.packages/runtime.tizen.6.5.0-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.21612.2/tools/libobjwriter.so" because it was not found. [/home/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]

Build command:

ROOTFS_DIR=`pwd`/.tools/rootfs/arm64 ./build.sh --portablebuild false --cross --clang10 --arch arm64 --runtimeConfiguration Release --librariesConfiguration Release --subset clr+libs.native /p:EnableSourceLink=false

This is related to #62563 and #63035.

cc @alpencolt

@ghost ghost added area-Infrastructure-coreclr community-contribution Indicates that the PR has been added by a community member labels Dec 24, 2021
@ghost
Copy link

ghost commented Dec 24, 2021

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

Without this change arm64 coreclr build for tizen breaks with:

/home/runtime/.dotnet/sdk/6.0.100/Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "/home/runtime/.packages/runtime.tizen.6.5.0-arm64.microsoft.dotnet.ilcompiler/7.0.0-alpha.1.21612.2/tools/libobjwriter.so" because it was not found. [/home/runtime/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj]

Build command:

ROOTFS_DIR=`pwd`/.tools/rootfs/arm64 ./build.sh --portablebuild false --cross --clang10 --arch arm64 --runtimeConfiguration Release --librariesConfiguration Release --subset clr+libs.native /p:EnableSourceLink=false

This is related to #62563 and #63035.

cc @alpencolt

Author: gbalykov
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

@gbalykov
Copy link
Member Author

@MichalStrehovsky could you, please, take a look?

@am11
Copy link
Member

am11 commented Dec 24, 2021

@gbalykov, if this project has same packaging plan as crossgen2 (i.e. only portable platform packages are produced), then I think a better / scalable solution is to replace these lines:

<RuntimeIdentifier>$(__DistroRid)</RuntimeIdentifier>
<!-- DistroRid is injected through environment variables in build scripts. Provide reasonable default
when the build is invoked directly, e.g. building inside Visual Studio -->
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' and '$(TargetsWindows)' == 'true'">win-$(TargetArchitecture)</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' and '$(TargetsLinux)' == 'true'">linux-$(TargetArchitecture)</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == '' and '$(TargetsOSX)' == 'true'">osx-$(TargetArchitecture)</RuntimeIdentifier>

with a single:

<RuntimeIdentifier>$(Crossgen2PackageRID)</RuntimeIdentifier>

and keep it enabled on all platforms.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. If @am11's suggestion works for you, that one also looks good.

@gbalykov gbalykov force-pushed the fix-non-portable-arm64-build branch from 0a3ba44 to 656540a Compare December 27, 2021 09:27
@gbalykov
Copy link
Member Author

gbalykov commented Dec 27, 2021

I've updated this PR to @am11 solution, I think it's a better one, but I've also renamed Crossgen2PackageRID to PortablePackageRID. This approach also fixes build.

@am11
Copy link
Member

am11 commented Dec 27, 2021

SourceBuild's failure is related, others are networking issues. This means it's not on the same packaging plan as crossgen2. We can try using MicrosoftNetCoreIlasmPackageRuntimeId instead.

@gbalykov gbalykov force-pushed the fix-non-portable-arm64-build branch from 656540a to adc0270 Compare January 4, 2022 13:07
@gbalykov
Copy link
Member Author

gbalykov commented Jan 4, 2022

@am11 approach with MicrosoftNetCoreIlasmPackageRuntimeId seemed to work

@am11
Copy link
Member

am11 commented Jan 4, 2022

Assuming it works with both armel and arm64 Tizen builds, looks good, thanks!
Perhaps we can add a property with a neutral name and use that one in ILCompiler.csproj (while keeping the existing one; currently used by source-build):

--- Directory.Build.props
+++ Directory.Build.props

-    <!-- There are no non-portable builds for Ilasm/Ildasm -->
-    <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</MicrosoftNetCoreIlasmPackageRuntimeId>
-    <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(_toolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId>

+    <!-- There are no non-portable builds for Ilasm, Ildasm, ILC etc. -->
+    <ToolsRID Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</ToolsRID>
+    <ToolsRID Condition="'$(ToolsRID)' == ''">$(_toolRuntimeRID)</ToolsRID>
+    <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>

@gbalykov, (not related to this PR but) one interesting thing I noticed from 63122 in your build steps is that in case of libs/libs.tests, you don't pass -portablebuild=false. Is there a particular reason for that? If not, please do pass that argument to all relevant commands and then we can simplify the RID calculation a little bit by deleting this hacky line:

<_runtimeOS Condition="$(_runtimeOS.StartsWith('tizen'))">linux</_runtimeOS>

@gbalykov
Copy link
Member Author

gbalykov commented Jan 4, 2022

@am11 thanks for ToolsRID name suggestion, I'll update PR.

Regarding portable build of libs. There were build problems with non-portable build of libs for tizen, which I first met with .net 5 (if I remember correctly). This is related to the fact that we do not ship tizen nuget packages. So, dotnet restore failed. Now I do not see any problems when libs are also built with --portablebuild false (both with and without the line that sets _runtimeOS for tizen). However, this same error with not found nuget packages still shows up for coreclr tests build with portablebuild=false, so we use two step build of clr tests too: native part as non-portable, managed part as portable.

@gbalykov gbalykov force-pushed the fix-non-portable-arm64-build branch from adc0270 to 1662704 Compare January 4, 2022 20:52
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(_toolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
<!-- There are no non-portable builds for Ilasm, Ildasm, ILC etc. -->
<ToolsRID Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</ToolsRID>
<ToolsRID Condition="'$(ToolsPackageRID)' == ''">$(_toolRuntimeRID)</ToolsRID>
Copy link
Member

@am11 am11 Jan 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are at it, could you please rename the (private) property _toolRuntimeRID -> _toolsRID as well? It is only defined and used in this file. (word "runtime" is redundant)

@gbalykov gbalykov force-pushed the fix-non-portable-arm64-build branch from 1662704 to c31c20b Compare January 9, 2022 16:44
@gbalykov
Copy link
Member Author

gbalykov commented Jan 9, 2022

@am11 I've updated PR, could you, please, take a look?

Copy link
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you!
Linux failure is #61359 and OSX timeout is unrelated as well.

<!-- There are no non-portable builds for Ilasm, Ildasm, ILC etc. -->
<ToolsRID Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</ToolsRID>
<ToolsRID Condition="'$(ToolsRID)' == ''">$(_toolsRID)</ToolsRID>
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
<MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks

@gbalykov gbalykov force-pushed the fix-non-portable-arm64-build branch from c31c20b to 620fe36 Compare January 10, 2022 07:31
@MichalStrehovsky MichalStrehovsky merged commit 917d369 into dotnet:main Jan 11, 2022
@gbalykov
Copy link
Member Author

Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants