Description
The output of uname -m
in virtualized 32-bit arm environment on 64-bit ARM cores is armv8l
. Unfortunately, the build process of dotnet 6.0.102 doesn't know what to do with this output, thus defaults to building x64
. Just as armv7l
is detected as arm
, and builds as such, armv8l
should also be detected as arm
.
I've thus been trying to figure this out, but I've hit a wall. Here are my current patches:
tarball:
From d759d299a1793b5adba86b4f0c42ff4d2f32aa9f Mon Sep 17 00:00:00 2001
From: Antoine Martin <[email protected]>
Date: Mon, 21 Feb 2022 19:37:21 +0000
Subject: [PATCH 1/1] force arm build
Detection logics for armv7 is broken on Alpine build pipelines due to
detecting CPU armv8l. runtime_detect-armv8l-as-armv7l.patch is supposed
to fix this, but somehow Platform comes off as x64 on aspnetcore, rather
than arm. This patch, more of a temp fix to move things along, forces
arm build on arm7 platform for aspnetcore
---
repos/aspnetcore.proj | 2 +-
repos/installer.proj | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index 480f3c713..43fd35d01 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -5,7 +5,7 @@
<!-- StandardSourceBuildArgs include -publish which is not supported by the aspnetcore build script. -->
<BuildCommandArgs>$(StandardSourceBuildArgs.Replace('--publish', ''))</BuildCommandArgs>
<!-- The arch flag (defaults to x64) overrides any value of TargetArchitecture that we might set -->
- <BuildCommandArgs>$(BuildCommandArgs) --arch $(Platform)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) --arch arm</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
diff --git a/repos/installer.proj b/repos/installer.proj
index 712d7cd14..ab1784af7 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -6,6 +6,7 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
+ <Platform>arm</Platform>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OSNameOverride>$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</OSNameOverride>
--
2.34.1
runtime:
From 79ddbec165071d8f8e51fd7c06600be466972758 Mon Sep 17 00:00:00 2001
From: Antoine Martin <[email protected]>
Date: Mon, 21 Feb 2022 06:03:34 +0000
Subject: [PATCH 1/1] detect armv8l as armv7l
Alpine pipeline emulates 32bit arm, but CPU is aarch64 coming off as
arm8l. Thus arm detection logics don't know how to read armv8l, thus
this patch reads armv8l as arm platform.
---
eng/native/configureplatform.cmake | 2 +-
eng/native/init-os-and-arch.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index af1c88bce5b..99556d80c05 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -36,7 +36,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux)
# "amd64" string. Accept either of the two here.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv8l)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
set(CLR_CMAKE_HOST_UNIX_ARMV7L 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a)
diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh
index fc4078fa3a9..9ba5b3c227a 100644
--- a/eng/native/init-os-and-arch.sh
+++ b/eng/native/init-os-and-arch.sh
@@ -41,7 +41,7 @@ case "$CPUName" in
arch=x64
;;
- armv7l)
+ armv7l|armv8l)
if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
arch=armel
else
--
2.34.1
Despite that, during installer build, I get the following error:
/builds/ayakael/aports/testing/dotnet6-bootstrap/src/source-build-tarball-6.0.102/src/installer.49861cb924cdd74be8de19206b48de4f04c0ecbe/artifacts/source-build/self/src/src/redist/targets/Crossgen.targets(122,5): error : Error: Unable to load shared library 'clrjit_unix_x64_arm' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library libclrjit_unix_x64_arm: No such file or directory [/builds/ayakael/aports/testing/dotnet6-bootstrap/src/source-build-tarball-6.0.102/src/installer.49861cb924cdd74be8de19206b48de4f04c0ecbe/artifacts/source-build/self/src/src/redist/redist.csproj]
So either libclrjit_unix_x64_arm
is incorrect, or the file is never generated. I've tried following in the same direction as dotnet/runtime#49734, but instead of armel it's armv8l. Unfortunately, this didn't work.
Are there any arm detection logics that I'm missing?
Made as part of Alpine Linux dotnet6 packaging project, see #2782