Closed Bug 1742870 Opened 3 years ago Closed 3 years ago

Unable to build wgpu-core in cbindgen when overriding local dependencies

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: kvark, Unassigned)

References

Details

Steps:

  1. Check out wgpu rev 37288a6 from https://github.com/gfx-rs/wgpu locally (current revision used by Gecko).

  2. Add this patch to the root Cargo toml:

+[patch."https://github.com/gfx-rs/wgpu"]
+wgpu-core = { path = "/x/code/wgpu/wgpu-core" }
+wgpu-types = { path = "/x/code/wgpu/wgpu-types" }
+wgpu-hal = { path = "/x/code/wgpu/wgpu-hal" }
  1. Do ./mach vendor rust - should succeed
  2. Do ./mach build - should succeed, but fails with
 0:01.72 /x/code/firefox/obj-x86_64-pc-linux-gnu/_virtualenvs/build/bin/python -m mozbuild.action.file_generate /x/code/firefox/build/RunCbindgen.py generate gfx/webrender_bindings/webrender_ffi_generated.h gfx/webrender_bindings/.deps/webrender_ffi_generated.h.pp gfx/webrender_bindings/.deps/webrender_ffi_generated.h.stub config/cbindgen-metadata.json /x/code/firefox/gfx/webrender_bindings /x/code/firefox/gfx/wr/webrender /x/code/firefox/gfx/wr/webrender_api
 0:01.72 make[3]: *** No rule to make target '/x/code/firefox/third_party/rust/wgpu-core', needed by 'gfx/wgpu_bindings/.deps/wgpu_ffi_generated.h.stub'.  Stop.

Hopefully, Emilio can have a quick look tomorrow, and it's not a serious issue.

Flags: needinfo?(emilio)

This is a quirk of cargo-vendor, as it turned out. When an override points to a local path, vendoring doesn't try to copy the contents over to 3rd party folder. So the source can't be found by cbindgen (reasonably).

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID

Actually, things aren't quite good yet. I thought I can trivially work around this by pushing my changes to github and picking them up via a github cargo patch. But doing this causes Gecko to rebuild almost completely, and 35-min turnaround times are not efficient for me.
It would be useful to be able to cargo-patch things to local paths, which I hope don't require full Gecko rebuild on changing.

Status: RESOLVED → REOPENED
Resolution: INVALID → ---

Found out that I can just modify the source code right in third_party (if the cargo patch points to it), and it doesn't rebuild the whole tree. So that's an acceptable workaround.

Yeah so this is because this hardcodes /third_party/rust/wgpu-core and co.

Given this is a third-party path this is only needed for correctness when wgpu-core is patched. So the right fix might be to make cbindgen emit the dependencies rather than hardcoding them ourselves, I guess. But this is sorta expected given how this works.

Flags: needinfo?(emilio)

So this is clearly not a blocker. I can modify the third_party copy, or vendor it externally while changing cbindgen toml.
Would you still want to keep the bug open in order to look into "make cbindgen emit the dependencies" at some point?
If not, please feel free to close.

Flags: needinfo?(emilio)
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Flags: needinfo?(emilio)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.