From 38834f059fea9df3585e2d76d31c255fa13f5dc9 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 7 Sep 2026 21:57:58 -0700 Subject: [PATCH] fix(v8): use Python-safe 11.9.9 prebuilts Promote the prepared 11.9.9 version updates across Cargo, CMake and native test consumers. Link libatomic on Linux ARM64 and retain the required system libraries when CMake consumes static V8 archives. Integrated and validated by Codex, an OpenAI coding agent, at the repository owner's request. --- Makefile | 2 +- build.rs | 5 ++++- tests/build-test-native.sh | 2 +- v8/cmake/NapiV8Resolver.cmake | 22 +++++++++++++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b4d7c62..fb6e452 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ NAPI_NATIVE_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/native) NAPI_WASIX_TEST_OUT_DIR ?= $(abspath $(BUILD_WASIX_NAPI_DIR)/wasm32-wasix/release) NAPI_V8_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze' NAPI_QUICKJS_CTEST_ARGS ?= -E 'SandboxGlobalThisAndMarkerAreNotEnumerableForDeepFreeze' -NAPI_V8_PREBUILT_VERSION ?= 11.9.8 +NAPI_V8_PREBUILT_VERSION ?= 11.9.9 NAPI_V8_PLATFORM := NAPI_V8_DIST_ROOT ?= NAPI_V8_CARGO_DIST_ROOT ?= diff --git a/build.rs b/build.rs index ec9129a..8f8a803 100644 --- a/build.rs +++ b/build.rs @@ -4,7 +4,7 @@ use std::{ path::{Path, PathBuf}, }; -const PREBUILT_V8_VERSION: &str = "11.9.8"; +const PREBUILT_V8_VERSION: &str = "11.9.9"; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum V8Method { @@ -219,6 +219,9 @@ fn main() { println!("cargo:rustc-link-lib=dylib=m"); println!("cargo:rustc-link-lib=dylib=pthread"); println!("cargo:rustc-link-lib=dylib=rt"); + if target_os == "linux" && env::var("CARGO_CFG_TARGET_ARCH").as_deref() == Ok("aarch64") { + println!("cargo:rustc-link-lib=dylib=atomic"); + } } } diff --git a/tests/build-test-native.sh b/tests/build-test-native.sh index f8a0d29..e4d97eb 100755 --- a/tests/build-test-native.sh +++ b/tests/build-test-native.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -PREBUILT_V8_VERSION="11.9.8" +PREBUILT_V8_VERSION="11.9.9" if [[ $# -ne 1 ]]; then echo "usage: $0 " >&2 diff --git a/v8/cmake/NapiV8Resolver.cmake b/v8/cmake/NapiV8Resolver.cmake index 109c63f..fbf704d 100644 --- a/v8/cmake/NapiV8Resolver.cmake +++ b/v8/cmake/NapiV8Resolver.cmake @@ -1,4 +1,4 @@ -set(NAPI_V8_PREBUILT_VERSION "11.9.8") +set(NAPI_V8_PREBUILT_VERSION "11.9.9") set(NAPI_V8_PREBUILT_BASE_URL "https://github.com/wasmerio/v8-custom-builds/releases/download/${NAPI_V8_PREBUILT_VERSION}") @@ -66,6 +66,12 @@ function(_napi_v8_local_strategy out_ok out_include out_library out_extra out_de break() endif() endforeach() + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND _extra STREQUAL "") + set(_extra "pthread;dl;m;rt") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR + CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + list(PREPEND _extra "atomic") + endif() endif() if(_include STREQUAL "") @@ -195,8 +201,18 @@ function(_napi_v8_prebuilt_strategy out_ok out_include out_library out_extra out set(_defines "${defines_override}") endif() - if(extra_override STREQUAL "" AND CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(_extra "/System/Library/Frameworks/CoreFoundation.framework") + if(extra_override STREQUAL "") + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(_extra "/System/Library/Frameworks/CoreFoundation.framework") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(_extra "pthread;dl;m;rt") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR + CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + list(PREPEND _extra "atomic") + endif() + else() + set(_extra "") + endif() else() set(_extra "${extra_override}") endif()