Skip to content

Commit

Permalink
windows: bump llvm to 18.1.8 (#12490)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway authored Jul 10, 2024
1 parent 02b589b commit 6f8ceb0
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 26 deletions.
41 changes: 25 additions & 16 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:

env:
# Must specify exact version of LLVM for Windows
LLVM_VERSION: 16.0.6
LLVM_VERSION: 18.1.8
BUN_VERSION: ${{ inputs.bun-version }}
BUN_GARBAGE_COLLECTOR_LEVEL: 1
BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: 1
Expand All @@ -43,8 +43,11 @@ jobs:
name: Build Submodules
runs-on: ${{ inputs.runs-on }}
steps:
# - name: Install VS2022 BuildTools 17.9.7
# run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel"
- name: Install Scoop
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: Setup Git
run: |
git config --global core.autocrlf false
Expand Down Expand Up @@ -75,10 +78,11 @@ jobs:
path: bun-deps
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
name: Install Ninja
name: Install LLVM and Ninja
run: |
choco install -y ninja
choco install -y llvm --version=${{ env.LLVM_VERSION }} --force
scoop install ninja
scoop install llvm@${{ env.LLVM_VERSION }}
scoop install [email protected]
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
name: Clone Submodules
run: |
Expand All @@ -91,7 +95,6 @@ jobs:
USE_LTO: 1
run: |
.\scripts\env.ps1 ${{ contains(inputs.tag, '-baseline') && '-Baseline' || '' }}
choco install -y nasm --version=2.16.01
$env:BUN_DEPS_OUT_DIR = (mkdir -Force "./bun-deps")
.\scripts\all-dependencies.ps1
- name: Save Cache
Expand Down Expand Up @@ -139,8 +142,11 @@ jobs:
needs: codegen
runs-on: ${{ inputs.runs-on }}
steps:
# - name: Install VS2022 BuildTools 17.9.7
# run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel"
- name: Install Scoop
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: Setup Git
run: |
git config --global core.autocrlf false
Expand All @@ -149,10 +155,10 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Ninja
- name: Install LLVM and Ninja
run: |
choco install -y ninja
choco install -y llvm --version=${{ env.LLVM_VERSION }} --force
scoop install ninja
scoop install llvm@${{ env.LLVM_VERSION }}
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
Expand Down Expand Up @@ -219,8 +225,11 @@ jobs:
- build-zig
- codegen
steps:
# - name: Install VS2022 BuildTools 17.9.7
# run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel"
- name: Install Scoop
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
- name: Setup Git
run: |
git config --global core.autocrlf false
Expand All @@ -231,8 +240,8 @@ jobs:
submodules: recursive
- name: Install Ninja
run: |
choco install -y ninja
choco install -y llvm --version=${{ env.LLVM_VERSION }} --force
scoop install ninja
scoop install llvm@${{ env.LLVM_VERSION }}
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
Expand Down
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ else()
message(STATUS "The CMake build type is: ${CMAKE_BUILD_TYPE}")
endif()

if (WIN32 AND NOT CMAKE_CL_SHOWINCLUDES_PREFIX)
# workaround until cmake fix is shipped https://github.com/ninja-build/ninja/issues/2280
# './build/.ninja_deps' may need to be deleted, the bug is "Note: including file: ..." is saved
# as part of some file paths
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file:")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG ON)
set(DEFAULT_ZIG_OPTIMIZE "Debug")
Expand Down Expand Up @@ -112,7 +119,11 @@ endif()
# we do some extra work afterwards to double-check, and we will rerun BUN_FIND_LLVM if the compiler did not match.
#
# If the user passes -DLLVM_PREFIX, most of this logic is skipped, but we still warn if invalid.
set(LLVM_VERSION 16)
if(WIN32)
set(LLVM_VERSION 18)
else()
set(LLVM_VERSION 16)
endif()

macro(BUN_FIND_LLVM)
find_program(
Expand Down
6 changes: 3 additions & 3 deletions docs/project/building-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Visual Studio can be installed graphically using the wizard or through WinGet:

After Visual Studio, you need the following:

- LLVM 16
- LLVM 18.1.8
- Go
- Rust
- NASM
Expand All @@ -78,14 +78,14 @@ After Visual Studio, you need the following:

```ps1#WinGet
## Select "Add LLVM to the system PATH for all users" in the LLVM installer
> winget install -i LLVM.LLVM -v 16.0.6 && winget install GoLang.Go Rustlang.Rustup NASM.NASM StrawberryPerl.StrawberryPerl RubyInstallerTeam.Ruby.3.2 OpenJS.NodeJS.LTS
> winget install -i LLVM.LLVM -v 18.1.8 && winget install GoLang.Go Rustlang.Rustup NASM.NASM StrawberryPerl.StrawberryPerl RubyInstallerTeam.Ruby.3.2 OpenJS.NodeJS.LTS
```

```ps1#Scoop
> irm https://get.scoop.sh | iex
> scoop install nodejs-lts go rust nasm ruby perl
# scoop seems to be buggy if you install llvm and the rest at the same time
> scoop install llvm@16.0.6
> scoop install llvm@18.1.8
```

{% /codetabs %}
Expand Down
5 changes: 3 additions & 2 deletions scripts/build-zstd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ $ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pip

Push-Location (Join-Path $BUN_DEPS_DIR 'zstd')
try {
Remove-Item CMakeCache.txt -ErrorAction SilentlyContinue
Remove-Item CMakeCache.txt, CMakeFiles -Recurse -ErrorAction SilentlyContinue

Run cmake -S "build/cmake" @CMAKE_FLAGS -DZSTD_BUILD_STATIC=ON
# CL_SHOWINCLUDES_PREFIX is workaround for cmake bug in 3.28. .ninja_deps still needs to be deleted. Bug is fixed in 3.30
Run cmake -S "build/cmake" @CMAKE_FLAGS -DZSTD_BUILD_STATIC=ON -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file:"
Run cmake --build . --clean-first --config Release

Copy-Item lib/zstd_static.lib $BUN_DEPS_OUT_DIR/zstd.lib
Expand Down
3 changes: 0 additions & 3 deletions scripts/env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ if ($env:VSINSTALLDIR -eq $null) {
}
Push-Location $vsDir
try {
Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools' -DevCmdArguments '-arch=x64 -host_arch=x64'
} catch {
$launchps = (Join-Path -Path $vsDir -ChildPath "Common7\Tools\Launch-VsDevShell.ps1")
. $launchps -Arch amd64 -HostArch amd64
} finally { Pop-Location }
Expand Down
3 changes: 2 additions & 1 deletion src/bun.js/bindings/ZigGlobalObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ static String computeErrorInfoWithPrepareStackTrace(JSC::VM& vm, Zig::GlobalObje
// We need to sourcemap it if it's a GlobalObject.
if (globalObject == lexicalGlobalObject) {
size_t framesCount = stackTrace.size();
ZigStackFrame remappedFrames[framesCount];
ZigStackFrame remappedFrames[64];
framesCount = framesCount > 64 ? 64 : framesCount;
for (int i = 0; i < framesCount; i++) {
remappedFrames[i] = {};
remappedFrames[i].source_url = Bun::toStringRef(lexicalGlobalObject, stackTrace.at(i).sourceURL());
Expand Down

0 comments on commit 6f8ceb0

Please sign in to comment.