Skip to content

Commit

Permalink
Try adding cross-compilers for Musl (#87841)
Browse files Browse the repository at this point in the history
* Add cross-compilers for Musl

* Fix LLVM linkage on Musl
  • Loading branch information
directhex authored Jul 3, 2023
1 parent 19887f7 commit 2fbb7eb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
Expand All @@ -254,6 +262,14 @@
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
</Dependency>
<Dependency Name="runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" Version="16.0.5-alpha.1.23330.2">
<Uri>https://github.com/dotnet/llvm-project</Uri>
<Sha>bd3acea90cae502d9a62164b863708d57d7993bc</Sha>
Expand Down
4 changes: 4 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,12 @@
<!-- Mono LLVM -->
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>16.0.5-alpha.1.23330.2</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>16.0.5-alpha.1.23330.2</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>16.0.5-alpha.1.23330.2</runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>16.0.5-alpha.1.23330.2</runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>16.0.5-alpha.1.23330.2</runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
<runtimeosxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>16.0.5-alpha.1.23330.2</runtimeosxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ extends:
buildConfig: release
platforms:
- linux_x64
- linux_musl_x64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
Expand All @@ -244,6 +245,7 @@ extends:
buildConfig: release
platforms:
- linux_arm64
- linux_musl_arm64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=browser /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ extends:
buildConfig: release
platforms:
- linux_x64
- linux_musl_x64
# - linux_arm64
# - linux_musl_arm64
- windows_x64
Expand Down Expand Up @@ -784,6 +785,7 @@ extends:
buildConfig: release
platforms:
- linux_arm64
- linux_musl_arm64
- osx_arm64
jobParameters:
runtimeVariant: crossaot
Expand Down
3 changes: 3 additions & 0 deletions src/mono/llvm/llvm-init.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
<MonoLLVMHostOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">linux</MonoLLVMHostOS>
<MonoLLVMHostOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">osx</MonoLLVMHostOS>
<MonoLLVMHostOS Condition="'$(OS)' == 'Windows_NT'">win</MonoLLVMHostOS>
<MonoLLVMHostOS Condition="Exists('$(ROOTFS_DIR)/lib/ld-musl-aarch64.so.1') or Exists('$(ROOTFS_DIR)/lib/ld-musl-x86_64.so.1')">linux-musl</MonoLLVMHostOS>
<MonoLLVMSDKVersion Condition="'$(MonoLLVMHostOS)' == 'linux'">$(runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion)</MonoLLVMSDKVersion>
<MonoLLVMSDKVersion Condition="'$(MonoLLVMHostOS)' == 'linux-musl'">$(runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion)</MonoLLVMSDKVersion>
<MonoLLVMSDKVersion Condition="'$(MonoLLVMHostOS)' == 'win'">$(runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion)</MonoLLVMSDKVersion>
<MonoLLVMSDKVersion Condition="'$(MonoLLVMHostOS)' == 'osx'">$(runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion)</MonoLLVMSDKVersion>
<MonoLLVMToolsVersion Condition="'$(MonoLLVMHostOS)' == 'linux'">$(runtimelinuxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion)</MonoLLVMToolsVersion>
<MonoLLVMToolsVersion Condition="'$(MonoLLVMHostOS)' == 'linux-musl'">$(runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion)</MonoLLVMToolsVersion>
<MonoLLVMToolsVersion Condition="'$(MonoLLVMHostOS)' == 'win'">$(runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion)</MonoLLVMToolsVersion>
<MonoLLVMToolsVersion Condition="'$(MonoLLVMHostOS)' == 'osx'">$(runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion)</MonoLLVMToolsVersion>
</PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/mono/monoaotcross.proj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
<PropertyGroup>
<MonoAotTargetOS>$(MonoAotTargetRid.Substring(0,$(MonoAotTargetRid.LastIndexOf('-'))))</MonoAotTargetOS>
<MonoAotTargetArchitecture>$(MonoAotTargetRid.Substring($([MSBuild]::Add(1, $(MonoAotTargetRid.LastIndexOf('-'))))))</MonoAotTargetArchitecture>
<MonoAotHostOS>$(TargetOS)</MonoAotHostOS>
<MonoAotHostOS Condition="'$(TargetsLinuxMusl)' == 'true'">linux-musl</MonoAotHostOS>
</PropertyGroup>

<MSBuild Targets="Build"
Expand All @@ -42,7 +44,7 @@

<MSBuild Targets="BuildMono"
Projects="$(MSBuildThisFileDirectory)mono.proj"
Properties="AotHostOS=$(TargetOS);AotHostArchitecture=$(TargetArchitecture);BuildMonoAOTCrossCompilerOnly=true;SkipMonoCrossJitConfigure=$(SkipMonoCrossJitConfigure);TargetArchitecture=$(MonoAotTargetArchitecture);TargetOS=$(MonoAotTargetOS)" />
Properties="AotHostOS=$(MonoAotHostOS);AotHostArchitecture=$(TargetArchitecture);BuildMonoAOTCrossCompilerOnly=true;SkipMonoCrossJitConfigure=$(SkipMonoCrossJitConfigure);TargetArchitecture=$(MonoAotTargetArchitecture);TargetOS=$(MonoAotTargetOS)" />

<ItemGroup>
<_MonoAOTCrossFiles Include="$(ArtifactsBinDir)mono\$(MonoAotTargetOS).$(MonoAotTargetArchitecture).$(Configuration)\cross\$(MonoAotTargetRid.ToLower())\**" />
Expand Down

0 comments on commit 2fbb7eb

Please sign in to comment.