Skip to content
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

update Rust #27

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 40 additions & 25 deletions .github/workflows/rust-prebuilt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@ jobs:
runner: ubuntu-22.04

steps:
- name: Preflight
shell: pwsh
run: |
$LlvmVersion = "16.0.6"
$LlvmRunId = '${{ github.event.inputs.run_id }}'
if ($LlvmRunId -eq 'latest') {
$LlvmRunId = $(gh run list -w 'LLVM prebuilt' --json 'status,databaseId,conclusion') |
ConvertFrom-Json | Where-Object { ($_.status -eq 'completed') -and ($_.conclusion -eq 'success') } |
Select-Object -First 1 -ExpandProperty databaseId
}
echo "LLVM_VERSION=$LlvmVersion" >> $Env:GITHUB_ENV
echo "LLVM_RUN_ID=$LlvmRunId" >> $Env:GITHUB_ENV

$RustBuildDir = if ($IsWindows) { "C:\rust" } else { "${{runner.temp}}" }
echo "RUST_BUILD_DIR=$RustBuildDir" >> $Env:GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Configure Windows runner
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --no-progress ninja 7zip wget
Install-Module VsDevShell -Force
docker system prune -a -f # free some space on C:\
New-Item -Path "C:\rust" -ItemType Directory | Out-Null
New-Item -Path $Env:RUST_BUILD_DIR -ItemType Directory | Out-Null

- name: Configure macOS runner
if: runner.os == 'macOS'
Expand Down Expand Up @@ -86,20 +107,26 @@ jobs:

- name: Install clang+llvm
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$CLANG_LLVM_OS='${{matrix.os}}'.ToLower()
$CLANG_LLVM_BASE_URL="https://github.com/awakecoding/llvm-prebuilt/releases/download/v2022.2.0"
$CLANG_LLVM_NAME="clang+llvm-14.0.6-x86_64-${CLANG_LLVM_OS}"
wget -q "${CLANG_LLVM_BASE_URL}/${CLANG_LLVM_NAME}.tar.xz"
$LlvmPlatform='${{matrix.os}}'
$LlvmArch='x86_64'
$LlvmVersion = $Env:LLVM_VERSION
$LlvmRunId = $Env:LLVM_RUN_ID
$LlvmName="clang+llvm-${LlvmVersion}-${LlvmArch}-${LlvmPlatform}"
& gh run download $LlvmRunId --repo $Env:GITHUB_REPOSITORY -n $LlvmName
if ($IsWindows) {
$LLVM_PREFIX="C:/llvm"
cmd.exe /c "7z.exe x ${CLANG_LLVM_NAME}.tar.xz -so | 7z x -si -ttar -o`"C:/temp`""
mv "C:/temp/${CLANG_LLVM_NAME}" $LLVM_PREFIX
$TempDir = "C:/temp"
$LLVM_PREFIX = "C:/llvm"
cmd.exe /c "7z.exe x ${LlvmName}.tar.xz -so | 7z x -si -ttar -o`"C:/temp`""
mv "$TempDir/${LlvmName}" $LLVM_PREFIX
$LLVM_CONFIG="$LLVM_PREFIX/bin/llvm-config.exe"
} else {
$LLVM_PREFIX="/opt/llvm"
tar -xf "${CLANG_LLVM_NAME}.tar.xz" -C /tmp
sudo mv "/tmp/${CLANG_LLVM_NAME}" $LLVM_PREFIX
$TempDir = "/tmp"
$LLVM_PREFIX = "/opt/llvm"
tar -xvf "${LlvmName}.tar.xz" -C $TempDir
sudo mv "$TempDir/${LlvmName}" $LLVM_PREFIX
$LLVM_CONFIG="$LLVM_PREFIX/bin/llvm-config"
}
$LLVM_BIN_PATH="$LLVM_PREFIX/bin"
Expand All @@ -108,18 +135,6 @@ jobs:
echo "LLVM_CONFIG=$LLVM_CONFIG" >> $Env:GITHUB_ENV
echo "PATH=$LLVM_BIN_PATH$([IO.Path]::PathSeparator)$Env:PATH" >> $Env:GITHUB_ENV

- name: Setup dynamic variables
id: dynamic-variables
shell: pwsh
run: |
$RustBuildDir = if ($IsWindows) { "C:\rust" } else { "${{runner.temp}}" }
echo "::set-output name=rust-build-dir::$RustBuildDir"

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Clone project
uses: actions/checkout@v3
with:
Expand All @@ -146,7 +161,7 @@ jobs:
shell: pwsh
working-directory: rust
run: |
$RustBuildDir = "${{steps.dynamic-variables.outputs.rust-build-dir}}".Replace('\','\\')
$RustBuildDir = "$Env:RUST_BUILD_DIR".Replace('\','\\')
$RustLlvmConfig = $Env:LLVM_CONFIG.Replace('\','\\')
$RustHostArch = '${{matrix.arch}}'
$RustHostPlatform = @{'windows'='pc-windows-msvc';
Expand Down Expand Up @@ -197,4 +212,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: rust-${{matrix.version}}-${{matrix.arch}}-${{matrix.os}}
path: ${{steps.dynamic-variables.outputs.rust-build-dir}}/dist
path: ${{ env.RUST_BUILD_DIR }}/dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From 83b2827d0c833b8676677a0053e5c6ea55be668b Mon Sep 17 00:00:00 2001
From e0a1ccb6e00c27ce541f3883d3484827928d24e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= <[email protected]>
Date: Thu, 2 Nov 2023 09:45:19 -0400
Date: Wed, 8 Nov 2023 11:47:42 -0500
Subject: [PATCH] [PATCH] force Windows MSVC dynamic runtime linking

---
src/bootstrap/bin/rustc.rs | 2 +-
src/bootstrap/bootstrap.py | 2 +-
src/bootstrap/builder.rs | 2 +-
src/bootstrap/cc_detect.rs | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
src/bootstrap/cc_detect.rs | 6 +++---
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 10718aeb89f..6bff20c84c1 100644
Expand Down Expand Up @@ -50,14 +50,16 @@ index b3666192853..198b1e0a46d 100644
rustflags.arg("-Ctarget-feature=-crt-static");
}
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
index 2496c2a9db5..6f0985310ae 100644
index 2496c2a9db5..b745a05b78e 100644
--- a/src/bootstrap/cc_detect.rs
+++ b/src/bootstrap/cc_detect.rs
@@ -75,11 +75,11 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
@@ -74,12 +74,12 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
.target(&target.triple)
.host(&build.build.triple);
match build.crt_static(target) {
Some(a) => {
- Some(a) => {
- cfg.static_crt(a);
+ Some(_a) => {
+ cfg.static_crt(false);
}
None => {
Expand Down