-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Unable to cross-compile CoreCLR for Linux ARM vfpv4-d16 #83170
Comments
Tagging subscribers to this area: @hoyosjs Issue DetailsDescriptionTring to cross compile .net 7 for Linux ARM with VFP configuration for I am able to cross compile .net 6 for ARM Using docs here: https://github.com/dotnet/runtime/blob/release/7.0/docs/workflow/building/coreclr/cross-building.md Reproduction Steps.net 7.x* build in Docker: I am using source from tag: https://github.com/dotnet/runtime/tree/v7.0.3 Expected behaviorBuild logs (native parts) should contain correct Actual behaviorWrong Regression?No response Known WorkaroundsNo response ConfigurationMy build host is Docker container (running on Windows 11 + WSL2) Other informationI have .net 6.x build using Docker which works on target HW OK:
|
Could you try applying this patch on v7.0.3: --- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -294,6 +294,9 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
+ # persist variables across multiple try_compile passes
+ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLR_ARM_FPU_TYPE CLR_ARM_FPU_CAPABILITY)
+
if(TARGET_ARCH_NAME STREQUAL "armel")
add_compile_options(-mfloat-abi=softfp)
endif() I am not sure how it would be working on v6.0.14 since they both have this issue in cross-compile mode. |
Thanks, but even with your patch I still getting: |
How about: diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index 964610524..2c3d50da7 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -294,6 +294,9 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
+ # persist variables across multiple try_compile passes
+ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLR_ARM_FPU_TYPE CLR_ARM_FPU_CAPABILITY)
+
if(TARGET_ARCH_NAME STREQUAL "armel")
add_compile_options(-mfloat-abi=softfp)
endif()
diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj
index a320ab4d8..5a653423f 100644
--- a/src/native/corehost/corehost.proj
+++ b/src/native/corehost/corehost.proj
@@ -77,7 +77,7 @@
<BuildArgs Condition="'$(KeepNativeSymbols)' != 'false'">$(BuildArgs) -keepnativesymbols</BuildArgs>
<BuildArgs Condition="'$(CrossBuild)' == 'true'">$(BuildArgs) -cross</BuildArgs>
<BuildArgs Condition="'$(Compiler)' != ''">$(BuildArgs) $(Compiler)</BuildArgs>
- <BuildArgs Condition="'$(CMakeArgs)' != ''">$(BuildArgs) $(CMakeArgs)</BuildArgs>
+ <BuildArgs Condition="'$(CMakeArgs)' != ''">$(BuildArgs) -cmakeargs "$(CMakeArgs)"</BuildArgs>
<BuildArgs Condition="'$(Ninja)' == 'true'">$(BuildArgs) -ninja</BuildArgs>
<BuildArgs>$(BuildArgs) -runtimeflavor $(RuntimeFlavor)</BuildArgs>
<BuildArgs Condition="'$(OfficialBuildId)' != ''">$(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)"</BuildArgs>
diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj
index b102a6b84..aef78b0dd 100644
--- a/src/native/libs/build-native.proj
+++ b/src/native/libs/build-native.proj
@@ -28,7 +28,7 @@
<_PortableBuildArg Condition="'$(PortableBuild)' != 'true'"> -portablebuild=false</_PortableBuildArg>
<_CrossBuildArg Condition="'$(CrossBuild)' == 'true'"> -cross</_CrossBuildArg>
<_KeepNativeSymbolsBuildArg Condition="'$(KeepNativeSymbols)' != 'false'"> -keepnativesymbols</_KeepNativeSymbolsBuildArg>
- <_CMakeArgs Condition="'$(CMakeArgs)' != ''"> $(CMakeArgs)</_CMakeArgs>
+ <_CMakeArgs Condition="'$(CMakeArgs)' != ''"> -cmakeargs "$(CMakeArgs)"</_CMakeArgs>
<!--
BuildNativeCompiler is a pass-through argument, to pass an argument to build-native.sh. It is intended to be |
I did quick recompile Just for reference originally it was failing here:
|
Did some more testing and looks OK with the patch. Thanks. |
Description
Tring to cross compile .net 7 for Linux ARM with VFP configuration for
vfpv4-d16
. Build succeeds, but running simple console app on target HW fails withIllegal instruction
. After checking build logs it seems that wrong-mfpu=vfpv3
switch is used compilation.I am able to cross compile .net 6 for ARM
vfpv4-d16
and it works well on target HW! So now I am trying to migrate my existing solution to .net 7Using docs here: https://github.com/dotnet/runtime/blob/release/7.0/docs/workflow/building/coreclr/cross-building.md
Reproduction Steps
.net 7.x* build in Docker:
docker run --rm -v /lab/runtime7:/runtime -w /runtime -e ROOTFS_DIR=/crossrootfs/arm mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-cross-arm-20220426130400-6e40d49 ./build.sh -subset clr+host.native+libs.native -runtimeFlavor CoreCLR -cross -arch arm -clang9 -configuration Release -librariesConfiguration Release -runtimeConfiguration Release -verbosity detailed -cmakeargs -DCLR_ARM_FPU_CAPABILITY=0x3 -cmakeargs -DCLR_ARM_FPU_TYPE=vfpv4-d16
And check build logs (native parts) for correct
-mfpu
andCLR_ARM_FPU_CAPABILITY
switch value.I am using source from tag: https://github.com/dotnet/runtime/tree/v7.0.3
Expected behavior
Build logs (native parts) should contain correct
-mfpu=vfpv4-d16
and-DCLR_ARM_FPU_CAPABILITY=0x3
switch values used for native compilation.Actual behavior
Wrong
-mfpu=vfpv3
and-DCLR_ARM_FPU_CAPABILITY=0x7
is currently used.Regression?
No response
Known Workarounds
No response
Configuration
My build host is Docker container (running on Windows 11 + WSL2)
My target is Linux on ARM
Other information
I have .net 6.x build using Docker which works on target HW OK:
docker run --rm -v /lab/runtime6:/runtime -w /runtime -e ROOTFS_DIR=/crossrootfs/arm mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-20210719121212-8a8d3be ./build.sh -subset clr+host.native+libs.native -clang9 --arch arm -c release --cross -cmakeargs -DCLR_ARM_FPU_CAPABILITY=0x3 -cmakeargs -DCLR_ARM_FPU_TYPE=vfpv4-d16
The text was updated successfully, but these errors were encountered: