-
Notifications
You must be signed in to change notification settings - Fork 190
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
[NativeAOT-LLVM] Build on Linux #2574
Changes from 2 commits
68c98bc
7f4de79
6198eee
91fa499
9ae54c2
ef6cdaa
b4df762
500a55d
6d3ca37
ba2d7af
d08e915
65ba66a
bc6f595
36250d2
d6e968b
14724d5
49a8d0e
88f45f8
e860a5d
f1d8712
e1adb5a
342e14e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,15 +206,25 @@ jobs: | |
df -h | ||
displayName: Disk Usage before Build | ||
|
||
# Install Wasm dependencies: emscripten, LLVM, NodeJS | ||
- ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.archType, 'wasm')) }}: | ||
# Install Wasm dependencies on Windows: emscripten, LLVM, NodeJS | ||
- ${{ if and(eq(parameters.hostedOs, 'windows'), and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.archType, 'wasm'))) }}: | ||
- script: call $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-emscripten.cmd $(Build.SourcesDirectory)\wasm-tools | ||
displayName: Install/activate emscripten | ||
- script: call $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-llvm.cmd $(Build.SourcesDirectory)\wasm-tools $(Build.SourcesDirectory) ${{ parameters.buildConfig }} | ||
displayName: Install/build LLVM | ||
- script: call $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-nodejs.cmd $(Build.SourcesDirectory)\wasm-tools | ||
displayName: Install NodeJS | ||
|
||
# Install Wasm dependencies on Linux: emscripten, LLVM, NodeJS. | ||
- ${{ if and(eq(parameters.hostedOs, 'linux'), and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.archType, 'wasm'))) }}: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we collapse the Windows/Linux into one section now (will require putting Emscripten on the same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, done |
||
- script: $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-emscripten.sh $(Build.SourcesDirectory)/wasm-tools | ||
displayName: Install/activate emscripten | ||
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-llvm.ps1 -Configs ${{ parameters.buildConfig }} -CI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
workingDirectory: $(Build.SourcesDirectory)/wasm-tools | ||
displayName: Install/build LLVM | ||
- script: pwsh $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-nodejs.ps1 $(Build.SourcesDirectory)/wasm-tools | ||
displayName: Install NodeJS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it work to unify the both Windows and Linux on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, removed the |
||
|
||
- ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.platform, 'wasi_wasm_win')) }}: | ||
# Install Wasi Wasm dependencies: wasi-sdk, wasmer | ||
- script: call $(Build.SourcesDirectory)/eng/pipelines/runtimelab/install-wasi-sdk.cmd $(Build.SourcesDirectory)\wasm-tools | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ extends: | |
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml | ||
buildConfig: debug | ||
platforms: | ||
# - linux_x64 | ||
- linux_x64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RIght, have left just Release. |
||
- osx_x64 | ||
- windows_x64 | ||
- Browser_wasm_win | ||
|
@@ -81,7 +81,7 @@ extends: | |
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml | ||
buildConfig: checked | ||
platforms: | ||
# - linux_x64 | ||
- linux_x64 | ||
- windows_x64 | ||
jobParameters: | ||
timeoutInMinutes: 300 | ||
|
@@ -101,7 +101,7 @@ extends: | |
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml | ||
buildConfig: release | ||
platforms: | ||
# - linux_x64 | ||
- linux_x64 | ||
- osx_x64 | ||
- windows_x64 | ||
- Browser_wasm_win | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we can use the same powershell sharing strategy as with the the other scripts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, have deletes the .cmd/.sh and just left the |
||
|
||
mkdir "$1" 2>/dev/null | ||
cd "$1" | ||
|
||
git clone https://github.com/emscripten-core/emsdk.git | ||
|
||
cd emsdk | ||
# Checkout a known good version to avoid a random break when emscripten changes the top of tree. | ||
git checkout 37b85e9 | ||
|
||
python emsdk.py install 3.1.47 || exit 1 | ||
./emsdk activate 3.1.47 || exit 1 | ||
|
||
# We key off of this variable in the common/build.ps1 script. | ||
echo "##vso[task.setvariable variable=NATIVEAOT_CI_WASM_BUILD_EMSDK_PATH]$PWD" |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,6 +6,12 @@ param( | |||||||||||||||||||||||||||||||||||||||||
[switch]$NoBuild | ||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
# Set IsWindows if the version of Powershell does not already have it. | ||||||||||||||||||||||||||||||||||||||||||
if (!(Test-Path variable:global:IsWindows)) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$IsWindows=[environment]::OSVersion.Platform -eq [PlatformID]::Win32NT | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
$ErrorActionPreference="Stop" | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if (!(gcm git -ErrorAction SilentlyContinue)) | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -35,23 +41,45 @@ foreach ($Config in $Configs) | |||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
pushd llvm-project | ||||||||||||||||||||||||||||||||||||||||||
$BuildDirName = "build-$($Config.ToLower())" | ||||||||||||||||||||||||||||||||||||||||||
mkdir $BuildDirName -Force | ||||||||||||||||||||||||||||||||||||||||||
if ($IsWindows) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
mkdir $BuildDirName -Force | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
mkdir $BuildDirName --parents | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, done with |
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
$BuildDirPath = "$pwd/$BuildDirName" | ||||||||||||||||||||||||||||||||||||||||||
$SourceDirName = "$pwd/llvm" | ||||||||||||||||||||||||||||||||||||||||||
popd | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine = "-G", "Visual Studio 17 2022", "-DLLVM_INCLUDE_BENCHMARKS=OFF", "-Thost=x64" | ||||||||||||||||||||||||||||||||||||||||||
if ($IsWindows) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$generator="Visual Studio 17 2022" | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$generator="Unix Makefiles" | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine = "-G", "$generator", "-DLLVM_INCLUDE_BENCHMARKS=OFF" | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nit: pascal case variables. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-S", $SourceDirName, "-B", $BuildDirPath | ||||||||||||||||||||||||||||||||||||||||||
if ($Config -eq "Release") | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$LlvmConfig = "Release" | ||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" | ||||||||||||||||||||||||||||||||||||||||||
if ($IsWindows) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded", "-Thost=x64" | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$LlvmConfig = "Debug" | ||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug" | ||||||||||||||||||||||||||||||||||||||||||
if ($IsWindows) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug", "-Thost=x64" | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
$CmakeConfigureCommandLine += "-DCMAKE_BUILD_TYPE=$LlvmConfig" | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,7 +1,21 @@ | ||||||
$InstallPath = $Args[0] | ||||||
$NodeJSVersion = "v20.2.0" | ||||||
$NodeJSInstallName = "node-$NodeJSVersion-win-x64" | ||||||
$NodeJSZipName = "$NodeJSInstallName.zip" | ||||||
|
||||||
if (!(Test-Path variable:global:IsWindows)) | ||||||
{ | ||||||
$IsWindows=[environment]::OSVersion.Platform -eq [PlatformID]::Win32NT | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
if ($IsWIndows) | ||||||
{ | ||||||
$NodeJSInstallName = "node-$NodeJSVersion-win-x64" | ||||||
$NodeJSZipName = "$NodeJSInstallName.zip" | ||||||
} | ||||||
else | ||||||
{ | ||||||
$NodeJSInstallName = "node-$NodeJSVersion-linux-x64" | ||||||
$NodeJSZipName = "$NodeJSInstallName.tar.xz" | ||||||
} | ||||||
|
||||||
if (!(Test-Path $InstallPath)) | ||||||
{ | ||||||
|
@@ -33,9 +47,17 @@ if ($RetryCount -le 0) | |||||
exit 1 | ||||||
} | ||||||
|
||||||
Expand-Archive -LiteralPath "$InstallPath\$NodeJSInstallName.zip" -DestinationPath $InstallPath -Force | ||||||
if ($IsWindows) | ||||||
{ | ||||||
Expand-Archive -LiteralPath "$InstallPath\$NodeJSZipName" -DestinationPath $InstallPath -Force | ||||||
$NodeJSExePath = "$InstallPath\$NodeJSInstallName\node.exe" | ||||||
Comment on lines
+52
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does, but doesn't support There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And those are our options for linux https://nodejs.org/dist/v9.9.0/ |
||||||
} | ||||||
else | ||||||
{ | ||||||
tar xJf $InstallPath/$NodeJSZipName -C $InstallPath | ||||||
$NodeJSExePath = "$InstallPath/$NodeJSInstallName/bin/node" | ||||||
} | ||||||
|
||||||
$NodeJSExePath = "$InstallPath\$NodeJSInstallName\node.exe" | ||||||
if (!(Test-Path $NodeJSExePath)) | ||||||
{ | ||||||
Write-Error "Did not find NodeJS at: '$NodeJSExePath'" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,26 @@ if [[ -n "$__RequestedBuildComponents" ]]; then | |
__CMakeTarget=" $__RequestedBuildComponents " | ||
__CMakeTarget="${__CMakeTarget// paltests / paltests_install }" | ||
fi | ||
|
||
if [[ "$__CMakeTarget" == *"wasmjit"* ]]; then | ||
__ExtraCmakeArgs="$__ExtraCmakeArgs -DCLR_CMAKE_BUILD_LLVM_JIT=1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missed this one, but is in now. |
||
|
||
if [[ "$__BuildType" == "Release" ]]; then | ||
if [[ -n $LLVM_CMAKE_CONFIG_RELEASE ]]; then | ||
LLVM_CMAKE_CONFIG="$LLVM_CMAKE_CONFIG_RELEASE" | ||
fi | ||
else | ||
if [[ -n $LLVM_CMAKE_CONFIG_DEBUG ]]; then | ||
LLVM_CMAKE_CONFIG="$LLVM_CMAKE_CONFIG_DEBUG" | ||
fi | ||
fi | ||
|
||
if [[ -z "$LLVM_CMAKE_CONFIG" ]]; then | ||
echo The LLVM_CMAKE_CONFIG environment variable pointing to llvm-build-dir/lib/cmake/llvm must be set. 1>&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [[ -z "$__CMakeTarget" ]]; then | ||
__CMakeTarget="install" | ||
fi | ||
|
@@ -185,7 +205,7 @@ fi | |
|
||
eval "$__RepoRootDir/eng/native/version/copy_version_files.sh" | ||
|
||
build_native "$__HostOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component" | ||
build_native "$__HostOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs $__ExtraCmakeArgs" "CoreCLR component" | ||
yowl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Build complete | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,9 @@ function(create_standalone_jit) | |
# We'll be linking against LLVM built without /guard:ehcont, so disable it. | ||
set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES CLR_EH_CONTINUATION OFF) | ||
|
||
find_package(LLVM REQUIRED CONFIG PATHS $ENV{LLVM_CMAKE_CONFIG}) | ||
# Prefer the version specified in LLVM_CMAKE_CONFIG over the "system" installed version | ||
find_package(LLVM REQUIRED CONFIG PATHS $ENV{LLVM_CMAKE_CONFIG} NO_DEFAULT_PATH) | ||
yowl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
find_package(LLVM REQUIRED CONFIG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean we will search for the system LLVM install too? That would not be correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does, removed. |
||
target_include_directories(${TARGETDETAILS_TARGET} PRIVATE ${LLVM_INCLUDE_DIRS}) | ||
separate_arguments(LLVM_DEFINITIONS) | ||
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ${LLVM_DEFINITIONS}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,15 +60,15 @@ source "$__RepoRootDir"/eng/native/build-commons.sh | |
|
||
# Set cross build | ||
if [[ "$__TargetOS" == browser ]]; then | ||
if [[ -z "$EMSDK_PATH" ]]; then | ||
if [[ -z "$EMSDK" ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to just set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks |
||
if [[ -d "$__RepoRootDir"/src/mono/browser/emsdk/ ]]; then | ||
export EMSDK_PATH="$__RepoRootDir"/src/mono/browser/emsdk/ | ||
export EMSDK="$__RepoRootDir"/src/mono/browser/emsdk/ | ||
else | ||
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root." | ||
exit 1 | ||
fi | ||
fi | ||
source "$EMSDK_PATH"/emsdk_env.sh | ||
source "$EMSDK"/emsdk_env.sh | ||
export CLR_CC=$(which emcc) | ||
elif [[ "$__TargetOS" == wasi ]]; then | ||
if [[ -z "$WASI_SDK_PATH" ]]; then | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<TestAssemblyDir Condition="'$(TestAssemblyDir)' == ''">$(BaseOutputPathWithConfig)\tests\</TestAssemblyDir> | ||
<TestAssemblyDir Condition="'$(TestAssemblyDir)' == ''">$(BaseOutputPathWithConfig)\Tests\</TestAssemblyDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does upstream not run into the same problem (in other words - is this an upstream bug)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have reverted this one, it looked wrong, but wasn't the problem I thought it was. |
||
<__TestRunHtmlLog Condition="'$(__TestRunHtmlLog)' == ''">$(__LogsDir)\TestRun.html</__TestRunHtmlLog> | ||
<__TestRunXmlLog Condition="'$(__TestRunXmlLog)' == ''">$(__LogsDir)\TestRun.xml</__TestRunXmlLog> | ||
</PropertyGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Windows equivalent is in
eng/common/build.ps1
. Can we do the same witheng/common/build.sh
to keep the scripts similar?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, moved.