Fix libc++ link errors on CI on linux release builds. https://logs.chromium.org/logs/gn/buildbucket/cr-buildbucket/8673621231167449729/+/u/release/linux-amd64/build/stdout Change-Id: Ifab782010048073212d6e80118e649f76a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/25340 Commit-Queue: Matt Stark <msta@google.com> Reviewed-by: Takuto Ikuta <tikuta@google.com>
diff --git a/build/gen.py b/build/gen.py index 1f95679..031bb0c 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -449,11 +449,12 @@ } ninja.CargoLibTarget( library_to_a('gn_starlark'), + cargo_flags='--features ninja', **starlark_common_args, ) rust_tests = ninja.CargoTestTarget( 'rust_unittests', - cargo_flags='--workspace', + cargo_flags='--workspace --features ninja', implicit_inputs=[ library_to_a('base'), library_to_a('gn_lib'),
diff --git a/src/gn/starlark/Cargo.lock b/src/gn/starlark/Cargo.lock index 2a744ae..d215767 100644 --- a/src/gn/starlark/Cargo.lock +++ b/src/gn/starlark/Cargo.lock
@@ -748,6 +748,7 @@ version = "0.1.0" dependencies = [ "ffi", + "link-cplusplus", ] [[package]]
diff --git a/src/gn/starlark/Cargo.toml b/src/gn/starlark/Cargo.toml index c16cdfd..6aa551e 100644 --- a/src/gn/starlark/Cargo.toml +++ b/src/gn/starlark/Cargo.toml
@@ -12,6 +12,7 @@ [dependencies] ffi = { path = "crates/ffi" } +link-cplusplus = { workspace = true } [workspace] members = [ @@ -34,11 +35,17 @@ # in sync unless you're trying to use new C++ features in the bridge. cxx = { version = "1.0", features = ["c++20"] } either = "1.16" +link-cplusplus = "1.0" starlark = "0.14" starlark_derive = "0.14" thiserror = "2.0" strum = { version = "0.26", features = ["derive"] } +[features] +# When compiling with ninja, ninja has its own set of link flags. +# Thus, we need to tell link-cplusplus not to generate any of its own. +ninja = ["link-cplusplus/nothing"] + # A short-lived fork until my PR gets merged. # Basically all it does is make some pub(crate) things public, so that we can # create records directly in rust (could only create them by running in starlark