From 715abbc171de5d00d6533f71ef357d6f4f0a646c Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 21 Jul 2025 02:57:33 +0200 Subject: [PATCH] [c] Force cc to not link to stdc++ --- spine-c/tests/rust-wasm/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spine-c/tests/rust-wasm/build.rs b/spine-c/tests/rust-wasm/build.rs index 59bce3e76..b79f2aca1 100644 --- a/spine-c/tests/rust-wasm/build.rs +++ b/spine-c/tests/rust-wasm/build.rs @@ -25,6 +25,10 @@ fn main() { // Always avoid C++ runtime (consistent with no-cpprt approach) cpp_build.flag("-nostdlib++"); + // Tell cc crate linker to not link libc++ + cpp_build.flag_if_supported("-Wl,-undefined,dynamic_lookup"); + cpp_build.cpp_link_stdlib(None); + if is_wasm { // For WASM, we may need additional setup, but let's first try without extra flags // The target is already handled by cc-rs when building for wasm32-unknown-unknown @@ -67,6 +71,9 @@ fn main() { // Add spine-c extensions cpp_build.file(spine_c_dir.join("src/extensions.cpp")); + // Add no-cpprt.cpp for C++ runtime stubs + cpp_build.file(spine_cpp_dir.join("src/no-cpprt.cpp")); + cpp_build.compile("spine"); // Link libraries - no C++ stdlib since we're using no-cpprt variant