diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90ae3a5ec16076e..e7ab3f932097849 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -374,15 +374,6 @@ jobs: with: toolchain: 1.95.0 targets: aarch64-apple-ios-sim - # GitHub recommends explicitly selecting the desired Xcode version: - # https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140 - # This became a necessity as a result of - # https://github.com/actions/runner-images/issues/12541 and - # https://github.com/actions/runner-images/issues/12751. - - name: Select Xcode version - run: | - sudo xcode-select --switch /Applications/Xcode_16.4.app - - name: Build and test run: python3 Platforms/Apple ci iOS --fast-ci diff --git a/.github/workflows/reusable-emscripten.yml b/.github/workflows/reusable-emscripten.yml index c8832342d9892da..c48904848bbaab7 100644 --- a/.github/workflows/reusable-emscripten.yml +++ b/.github/workflows/reusable-emscripten.yml @@ -55,6 +55,10 @@ jobs: uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: '3.x' + - uses: dtolnay/rust-toolchain@f133eefe930d61f0d9371efd474daf0125ed3dd1 # 1.95.0 + with: + toolchain: 1.95.0 + targets: wasm32-unknown-emscripten - name: "Runner image version" run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV" - name: "Install Emscripten" diff --git a/Modules/cpython-sys/build.rs b/Modules/cpython-sys/build.rs index a4e92b9ea90d1d8..a0898972ec99544 100644 --- a/Modules/cpython-sys/build.rs +++ b/Modules/cpython-sys/build.rs @@ -38,6 +38,7 @@ fn emit_rerun_instructions(builddir: Option<&str>) { "PY_CFLAGS", "TARGET", "WASI_SDK_PATH", + "EMSDK", ] { println!("cargo:rerun-if-env-changed={var}"); } @@ -227,6 +228,21 @@ fn generate_c_api_bindings( } } + if !have_sysroot + && cargo_target.contains("emscripten") + && let Ok(emsdk) = env::var("EMSDK") + { + let sysroot = PathBuf::from(&emsdk) + .join("upstream") + .join("emscripten") + .join("cache") + .join("sysroot"); + if sysroot.is_dir() { + builder = builder.clang_arg(format!("--sysroot={}", sysroot.display())); + have_sysroot = true; + } + } + // Android NDK: ANDROID_HOME is set by the CI/user environment, and // Android/android-env.sh sets CC to the NDK clang binary at: // $ANDROID_HOME/ndk//toolchains/llvm/prebuilt//bin/-clang diff --git a/configure b/configure index 9ebeb0ca5ed46cf..7b5f7bd98caaebd 100755 --- a/configure +++ b/configure @@ -9815,6 +9815,7 @@ fi as_fn_append LINKFORSHARED " -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=20971520" as_fn_append LDFLAGS_NODIST " -sWASM_BIGINT" + as_fn_append LDFLAGS_NODIST " -fwasm-exceptions" as_fn_append LINKFORSHARED " -sFORCE_FILESYSTEM -lidbfs.js -lnodefs.js -lproxyfs.js -lworkerfs.js" as_fn_append LINKFORSHARED " -sEXPORTED_RUNTIME_METHODS=FS,callMain,ENV,HEAPU32,TTY,ERRNO_CODES" diff --git a/configure.ac b/configure.ac index 2f3c7641afe7354..7fde993529f8312 100644 --- a/configure.ac +++ b/configure.ac @@ -2410,6 +2410,7 @@ AS_CASE([$ac_sys_system], dnl map int64_t and uint64_t to JS bigint AS_VAR_APPEND([LDFLAGS_NODIST], [" -sWASM_BIGINT"]) + AS_VAR_APPEND([LDFLAGS_NODIST], [" -fwasm-exceptions"]) dnl Include file system support AS_VAR_APPEND([LINKFORSHARED], [" -sFORCE_FILESYSTEM -lidbfs.js -lnodefs.js -lproxyfs.js -lworkerfs.js"])