Created
June 12, 2026 18:46
-
-
Save alexcrichton/da374325e5318405dc6db43b006aea04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/build.rs b/build.rs | |
| index 9a0ee3a..2bc39a8 100644 | |
| --- a/build.rs | |
| +++ b/build.rs | |
| @@ -1,7 +1,7 @@ | |
| #![deny(warnings)] | |
| use { | |
| - anyhow::{Context, Result, anyhow, bail}, | |
| + anyhow::{anyhow, bail, Context, Result}, | |
| std::{ | |
| env, | |
| fmt::Write as _, | |
| @@ -537,40 +537,34 @@ fn make_runtime( | |
| let target = if async_ { "async" } else { "sync" }; | |
| + let clang = wasi_sdk.join(format!("bin/{CLANG_EXECUTABLE}")); | |
| cmd.env( | |
| "RUSTFLAGS", | |
| - "--cfg pyo3_disable_reference_pool -C link-args=--skip-wit-component", | |
| + "--cfg pyo3_disable_reference_pool \ | |
| + -Clink-args=-Wl,--skip-wit-component \ | |
| + -Clink-args=-shared \ | |
| + -Clink-self-contained=n", | |
| ) | |
| + .env("CARGO_TARGET_WASM32_WASIP2_LINKER", clang) | |
| .env("CARGO_TARGET_DIR", out_dir.join(target)) | |
| .env("PYO3_CONFIG_FILE", out_dir.join("pyo3-config.txt")); | |
| + println!("{wasi_sdk:?}"); | |
| + println!("{cpython_wasi_dir:?}"); | |
| let status = cmd.status()?; | |
| assert!(status.success()); | |
| println!("cargo:rerun-if-changed=runtime"); | |
| let build = if DEBUG_RUNTIME { "debug" } else { "release" }; | |
| let path = out_dir.join(target).join(format!( | |
| - "wasm32-wasip2/{build}/libcomponentize_py_runtime.a" | |
| + "wasm32-wasip2/{build}/componentize_py_runtime.wasm" | |
| )); | |
| if path.exists() { | |
| - let clang = wasi_sdk.join(format!("bin/{CLANG_EXECUTABLE}")); | |
| - if clang.exists() { | |
| - run(Command::new(clang) | |
| - .arg("--target=wasm32-wasip2") | |
| - .arg("-shared") | |
| - .arg("-o") | |
| - .arg(out_dir.join(name)) | |
| - .arg("-Wl,--whole-archive") | |
| - .arg(&path) | |
| - .arg("-Wl,--no-whole-archive") | |
| - .arg(format!("-L{}", cpython_wasi_dir.to_str().unwrap())) | |
| - .arg("-lpython3.14"))?; | |
| - | |
| - compress(out_dir, name, out_dir, false)?; | |
| - } else { | |
| - bail!("no such file: {}", clang.display()) | |
| - } | |
| + let _ = cpython_wasi_dir; | |
| + println!("{cpython_wasi_dir:?}"); | |
| + std::fs::copy(&path, out_dir.join(name))?; | |
| + compress(out_dir, name, out_dir, false)?; | |
| } else { | |
| bail!("no such file: {}", path.display()) | |
| } | |
| diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml | |
| index fb25216..9da9a5b 100644 | |
| --- a/runtime/Cargo.toml | |
| +++ b/runtime/Cargo.toml | |
| @@ -4,7 +4,7 @@ version = "0.1.0" | |
| edition = "2024" | |
| [lib] | |
| -crate-type = ["staticlib"] | |
| +crate-type = ["cdylib"] | |
| [dependencies] | |
| anyhow = "1.0.91" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment