Skip to content

Commit

Permalink
Upgrade to LLVM 17, fix linux debug build, upgrade JSC, remove some C…
Browse files Browse the repository at this point in the history
… API usages (#10161)

* Upgrade to LLVM 17, JSC, remove more C API usages

* [autofix.ci] apply automated fixes

* Update scripts/setup.sh

Co-authored-by: Dylan Conway <[email protected]>

* more

* update

* bump

* Fix unused variable

* Fix merge conflict

* [autofix.ci] apply automated fixes

* Increase limit

* double the limit

* CI

* Update CMakeLists.txt

* Update CMakeLists.txt

* Upgrade

* Upgrade more things

* Bump

* Remove ld64 flag

* typo

* Update Dockerfile

* update

* Update

* Up

* asd

* up

* Upgrade

* Bump!

* Fix crash

* Remove unnecessary cahnge

* Propagate canary flag + bump macOS 13

* Upgrades

---------

Co-authored-by: Jarred Sumner <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <[email protected]>
  • Loading branch information
4 people authored Apr 22, 2024
1 parent ab79940 commit c604c57
Show file tree
Hide file tree
Showing 45 changed files with 481 additions and 581 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
type: boolean

env:
LLVM_VERSION: 16
LLVM_VERSION: 17
BUN_VERSION: 1.1.2

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

env:
# Must specify exact version of LLVM for Windows
LLVM_VERSION: 16.0.6
LLVM_VERSION: 17.0.6
BUN_VERSION: 1.1.2

jobs:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
name: Install LLVM
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
with:
version: ${{ env.LLVM_VERSION }}
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
with:
submodules: recursive
- name: Install LLVM
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
with:
version: ${{ env.LLVM_VERSION }}
- name: Install Ninja
Expand Down Expand Up @@ -224,7 +224,7 @@ jobs:
with:
submodules: recursive
- name: Install LLVM
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
with:
version: ${{ env.LLVM_VERSION }}
- name: Install Ninja
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
run-id:
type: string
description: The workflow ID to download artifacts (skips the build step)
canary:
type: boolean
description: "Is this a canary build?"
default: true
pull_request:
push:
branches:
Expand Down Expand Up @@ -44,6 +48,7 @@ jobs:
tag: linux-x64
arch: x64
cpu: haswell
canary: ${{ inputs.canary }}
linux-x64-baseline:
if: ${{ !github.event.inputs.run-id }}
name: Build linux-x64-baseline
Expand All @@ -54,6 +59,7 @@ jobs:
tag: linux-x64-baseline
arch: x64
cpu: nehalem
canary: ${{ inputs.canary }}
linux-aarch64:
if: ${{ !github.event.inputs.run-id && github.repository_owner == 'oven-sh' }}
name: Build linux-aarch64
Expand All @@ -64,26 +70,29 @@ jobs:
tag: linux-aarch64
arch: aarch64
cpu: native
canary: ${{ inputs.canary }}
darwin-x64:
if: ${{ !github.event.inputs.run-id }}
name: Build darwin-x64
uses: ./.github/workflows/build-darwin.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64
arch: x64
cpu: haswell
canary: ${{ inputs.canary }}
darwin-x64-baseline:
if: ${{ !github.event.inputs.run-id }}
name: Build darwin-x64-baseline
uses: ./.github/workflows/build-darwin.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64-baseline
arch: x64
cpu: nehalem
canary: ${{ inputs.canary }}
darwin-aarch64:
if: ${{ !github.event.inputs.run-id }}
name: Build darwin-aarch64
Expand All @@ -94,6 +103,7 @@ jobs:
tag: darwin-aarch64
arch: aarch64
cpu: native
canary: ${{ inputs.canary }}
windows-x64:
if: ${{ !github.event.inputs.run-id }}
name: Build windows-x64
Expand All @@ -104,6 +114,7 @@ jobs:
tag: windows-x64
arch: x64
cpu: haswell
canary: ${{ inputs.canary }}
windows-x64-baseline:
if: ${{ !github.event.inputs.run-id }}
name: Build windows-x64-baseline
Expand All @@ -114,6 +125,7 @@ jobs:
tag: windows-x64-baseline
arch: x64
cpu: nehalem
canary: ${{ inputs.canary }}
linux-x64-test:
if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test linux-x64
Expand Down Expand Up @@ -156,7 +168,7 @@ jobs:
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64
darwin-x64-baseline-test:
if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
Expand All @@ -167,7 +179,7 @@ jobs:
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64-baseline
darwin-aarch64-test:
if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
Expand Down
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@ cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0067 NEW)

set(Bun_VERSION "1.1.5")
set(WEBKIT_TAG e3a2d89a0b1644cc8d5c245bd2ffee4d4bd6c1d5)
set(WEBKIT_TAG 2ce7bb4314c516d9c7ba12be3581f6a986013781)

set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "Configuring Bun ${Bun_VERSION} in ${BUN_WORKDIR}")

set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD_REQUIRED ON)

# WebKit uses -std=gnu++20 on non-macOS non-Windows
# If we do not set this, it will crash at startup on the first memory allocation.
if (NOT WIN32 AND NOT APPLE)
set(CMAKE_CXX_EXTENSIONS ON)
endif()

# --- Build Type ---
if(NOT CMAKE_BUILD_TYPE)
message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to Debug.\nSet a build type with -DCMAKE_BUILD_TYPE=<Debug|Release>")
Expand Down Expand Up @@ -51,11 +63,7 @@ endif()

# --- MacOS SDK ---
if(APPLE AND DEFINED ENV{CI})
if(ARCH STREQUAL "x86_64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
endif()

if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
Expand Down Expand Up @@ -99,7 +107,7 @@ 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)
set(LLVM_VERSION 17)

macro(BUN_FIND_LLVM)
find_program(
Expand Down Expand Up @@ -214,12 +222,6 @@ else()
)
endif()

set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD_REQUIRED ON)

project(Bun VERSION "${Bun_VERSION}")

# if(MSVC)
Expand Down Expand Up @@ -1103,15 +1105,14 @@ else()
target_compile_options(${bun} PUBLIC
-fPIC
-mtune=${CPU_TARGET}
-fconstexpr-steps=1271242
-fconstexpr-depth=27
-fconstexpr-steps=2542484
-fconstexpr-depth=54
-fno-exceptions
-fvisibility=hidden
-fvisibility-inlines-hidden
-fno-rtti
-fno-omit-frame-pointer
)
string(APPEND CMAKE_CXX_FLAGS " -std=c++2a")
endif()

if(APPLE)
Expand All @@ -1130,7 +1131,6 @@ if(UNIX AND NOT APPLE)
"-fuse-ld=lld"
"-static-libstdc++"
"-static-libgcc"
"-fuse-ld=lld"
"-Wl,-z,now"
"-Wl,--as-needed"
"-Wl,--gc-sections"
Expand All @@ -1143,16 +1143,17 @@ if(UNIX AND NOT APPLE)
"-Wl,--wrap=log"
"-Wl,--wrap=log2"
"-Wl,--wrap=lstat"
"-Wl,--wrap=stat64"
"-Wl,--wrap=stat"
"-Wl,--wrap=fstat"
"-Wl,--wrap=fstatat"
"-Wl,--wrap=lstat64"
"-Wl,--wrap=stat64"
"-Wl,--wrap=fstat64"
"-Wl,--wrap=fstatat64"
"-Wl,--wrap=mknod"
"-Wl,--wrap=mknodat"
"-Wl,--wrap=statx"
"-Wl,--wrap=fmod"
"-Wl,--compress-debug-sections=zlib"
"-Bsymbolics-functions"
"-rdynamic"
Expand Down
41 changes: 21 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ ARG BUILD_MACHINE_ARCH=x86_64
ARG BUILDARCH=amd64
ARG TRIPLET=${ARCH}-linux-gnu
ARG GIT_SHA=""
ARG BUN_VERSION="bun-v1.0.30"
ARG BUN_VERSION="bun-v1.1.4"
ARG BUN_DOWNLOAD_URL_BASE="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/${BUN_VERSION}"
ARG CANARY=0
ARG ASSERTIONS=OFF
ARG ZIG_OPTIMIZE=ReleaseFast
ARG CMAKE_BUILD_TYPE=Release

ARG NODE_VERSION="20"
ARG LLVM_VERSION="16"
ARG LLVM_VERSION="17"
ARG ZIG_VERSION="0.12.0-dev.1828+225fe6ddb"

ARG SCCACHE_BUCKET
Expand All @@ -34,7 +34,7 @@ ARG SCCACHE_ENDPOINT
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY

FROM bitnami/minideb:bullseye as bun-base
FROM bitnami/minideb:bookworm as bun-base

ARG BUN_DOWNLOAD_URL_BASE
ARG DEBIAN_FRONTEND
Expand All @@ -51,10 +51,10 @@ ENV CPU_TARGET=${CPU_TARGET}
ENV BUILDARCH=${BUILDARCH}
ENV BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR}

ENV CXX=clang++-16
ENV CC=clang-16
ENV AR=/usr/bin/llvm-ar-16
ENV LD=lld-16
ENV CXX=clang++-${LLVM_VERSION}
ENV CC=clang-${LLVM_VERSION}
ENV AR=/usr/bin/llvm-ar
ENV LD=lld-${LLVM_VERSION}

ENV SCCACHE_BUCKET=${SCCACHE_BUCKET}
ENV SCCACHE_REGION=${SCCACHE_REGION}
Expand All @@ -63,18 +63,15 @@ ENV SCCACHE_ENDPOINT=${SCCACHE_ENDPOINT}
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

RUN apt-get update -y \
&& install_packages \
RUN install_packages \
ca-certificates \
curl \
gnupg \
&& echo "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \
&& echo "deb-src https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-${LLVM_VERSION} main" >> /etc/apt/sources.list.d/llvm.list \
&& echo "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \
&& echo "deb-src https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VERSION} main" >> /etc/apt/sources.list.d/llvm.list \
&& curl -fsSL "https://apt.llvm.org/llvm-snapshot.gpg.key" | apt-key add - \
&& echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& curl -fsSL "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | apt-key add - \
&& echo "deb https://apt.kitware.com/ubuntu/ focal main" > /etc/apt/sources.list.d/kitware.list \
&& curl -fsSL "https://apt.kitware.com/keys/kitware-archive-latest.asc" | apt-key add - \
&& install_packages \
wget \
bash \
Expand All @@ -88,6 +85,8 @@ RUN apt-get update -y \
lld-${LLVM_VERSION} \
lldb-${LLVM_VERSION} \
clangd-${LLVM_VERSION} \
libc++-${LLVM_VERSION}-dev \
libc++abi-${LLVM_VERSION}-dev \
make \
cmake \
ninja-build \
Expand All @@ -104,14 +103,16 @@ RUN apt-get update -y \
perl \
python3 \
ruby \
ruby-dev \
golang \
nodejs \
&& ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
&& ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
&& ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
&& ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
&& ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
&& ln -s /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
nodejs && \
for f in /usr/lib/llvm-${LLVM_VERSION}/bin/*; do ln -sf "$f" /usr/bin; done \
&& ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
&& ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
&& ln -sf /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
&& ln -sf /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
&& ln -sf /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
&& ln -sf /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
&& arch="$(dpkg --print-architecture)" \
&& case "${arch##*-}" in \
amd64) variant="x64";; \
Expand Down
Loading

0 comments on commit c604c57

Please sign in to comment.