From 2a3af1c2d76446a3125fba88e91f194e1de8401a Mon Sep 17 00:00:00 2001 From: Victor Polevoy Date: Tue, 14 Nov 2023 16:27:15 +0100 Subject: [PATCH 1/3] Don't produce a shared library artifact. The crate is not shipped as a shared library, and is not used as such. --- Cargo.toml | 1 - build.rs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c928f98..ac5b03d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ ctor = "0.2.4" [lib] name = "v8_rs" path = "src/lib.rs" -crate-type = ["cdylib", "rlib"] [features] default = ["debug-server"] diff --git a/build.rs b/build.rs index 88855ea..ac2780a 100644 --- a/build.rs +++ b/build.rs @@ -107,9 +107,9 @@ fn main() { "cargo:rustc-flags=-L{} -lv8 -lv8_monolith_{} -ldl -lc", output_dir, *PROFILE ); - println!("cargo:rustc-cdylib-link-arg=-Wl,-Bstatic"); - println!("cargo:rustc-cdylib-link-arg=-lstdc++"); - println!("cargo:rustc-cdylib-link-arg=-Wl,-Bdynamic"); + println!( + "cargo:rustc-link-lib=stdc++", + ); } "macos" => { println!( From 7ae879fff854c19c4e575078cc8d78844fc28485 Mon Sep 17 00:00:00 2001 From: Victor Polevoy Date: Tue, 14 Nov 2023 18:44:20 +0100 Subject: [PATCH 2/3] Fix the code formatting. --- build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.rs b/build.rs index ac2780a..3620303 100644 --- a/build.rs +++ b/build.rs @@ -107,9 +107,7 @@ fn main() { "cargo:rustc-flags=-L{} -lv8 -lv8_monolith_{} -ldl -lc", output_dir, *PROFILE ); - println!( - "cargo:rustc-link-lib=stdc++", - ); + println!("cargo:rustc-link-lib=stdc++"); } "macos" => { println!( From cb2331a17c02b42e7facc652e5f748f7864523cd Mon Sep 17 00:00:00 2001 From: Victor Polevoy Date: Wed, 15 Nov 2023 12:40:51 +0100 Subject: [PATCH 3/3] Explicitly specify static linkage with whole archive. --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 3620303..6e30cc5 100644 --- a/build.rs +++ b/build.rs @@ -107,7 +107,7 @@ fn main() { "cargo:rustc-flags=-L{} -lv8 -lv8_monolith_{} -ldl -lc", output_dir, *PROFILE ); - println!("cargo:rustc-link-lib=stdc++"); + println!("cargo:rustc-link-lib=static:-bundle,+whole-archive=stdc++"); } "macos" => { println!(