Skip to content

Commit 1e93d06

Browse files
committed
Bug 1794001 - Part 6: Patch rure to remove cdylib and staticlib targets, r=#xpcom-reviewers CLOSED TREE
Cargo will attempt to build all targets for dependencies, and there appears to be no option to turn that functionality off (see rust-lang/cargo#11232). If we try to build the `rure` crate as a cdylib during a PGO build, it causes linker issues, which make the build fail. As this artifact isn't necessary for our build, we can patch the crate to remove the cdylib and staticlib crate-type definitions, making the build pass as only the artifact we need is built. Differential Revision: https://phabricator.services.mozilla.com/D159332
1 parent 28b6c5c commit 1e93d06

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

Cargo.lock

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ web-sys = { path = "build/rust/dummy-web/web-sys" }
138138
# Overrides to allow easier use of common internal crates.
139139
moz_asserts = { path = "mozglue/static/rust/moz_asserts" }
140140

141+
# Patch `rure` to disable building the cdylib and staticlib targets
142+
# Cargo has no way to disable building targets your dependencies provide which
143+
# you don't depend on, and linking the cdylib breaks during instrumentation
144+
# builds.
145+
# Workaround for https://github.com/rust-lang/cargo/issues/11232
146+
rure = { path = "third_party/rust/rure" }
147+
141148
# Other overrides
142149
async-task = { git = "https://github.com/smol-rs/async-task", rev="f6488e35beccb26eb6e85847b02aa78a42cd3d0e" }
143150
chardetng = { git = "https://github.com/hsivonen/chardetng", rev="3484d3e3ebdc8931493aa5df4d7ee9360a90e76b" }

supply-chain/config.toml

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ notes = "This is a first-party crate which is entirely unrelated to the crates.i
126126
audit-as-crates-io = true
127127
notes = "This is a first-party crate which is also published to crates.io, but we should publish audits for it for the benefit of the ecosystem."
128128

129+
[policy.rure]
130+
audit-as-crates-io = true
131+
notes = "Identical to upstream, but with cdylib and staticlib targets disabled to avoid unnecessary build artifacts and linker errors."
132+
129133
[policy.selectors]
130134
audit-as-crates-io = true
131135
notes = "This is a first-party crate which is also published to crates.io, but we should publish audits for it for the benefit of the ecosystem."

third_party/rust/rure/Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ repository = "https://github.com/rust-lang/regex"
2525

2626
[lib]
2727
name = "rure"
28-
crate-type = [
29-
"staticlib",
30-
"cdylib",
31-
"rlib",
32-
]
3328

3429
[dependencies.libc]
3530
version = "0.2"

0 commit comments

Comments
 (0)