You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.
[package]
name = "libfoo"
version = "0.0.1"
edition = "2018"
build = "rust/build.rs"
[build-dependencies]
cbindgen = "0.8"
[lib]
name = "foo"
path = "rust/src/lib.rs"
crate-type = ["staticlib"]
build.rs:
externcrate cbindgen;use std::env;fnmain(){let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
cbindgen::Builder::new().with_crate(crate_dir).with_language(cbindgen::Language::C).generate().expect("Unable to generate bindings").write_to_file("foo.h");}
Building via the command-line, this works fine. But when opening the crate in VSCode, the Cargo.toml is annotated with a build error:
failed to run custom build command for `libfoo v0.1.0 (C:\Users\me\Documents\dev\rust\libfoo)`
process didn't exit successfully: `c:\Users\me\Documents\dev\rust\libfoo\target\rls\debug\build\libfoo-d3abfb7100f32bd4\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to generate bindings: CargoMetadata("c:\\Users\\me\\Documents\\dev\\rust\\libfoo\\Cargo.toml", Metadata(Output { status: ExitStatus(ExitStatus(101)), stdout: "Unknown argument \'metadata\'. Supported arguments:\n\n --version or -V to print the version and commit info\n --help or -h for this message\n --cli starts the RLS in command line mode\n No input starts the RLS as a language server\n \n", stderr: "" }))', src\libcore\result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I believe this is being triggered by the following code from cbindgen:
Cargo.toml
:build.rs
:Building via the command-line, this works fine. But when opening the crate in VSCode, the
Cargo.toml
is annotated with a build error:I believe this is being triggered by the following code from
cbindgen
:https://github.com/eqrion/cbindgen/blob/5ec5a82d268c8fe907767394ee7ad15718f3f09d/src/bindgen/cargo/cargo_metadata.rs#L181-L197
What I don't know is whether this is a problem with
rls
orrls-vscode
exposingcargo metadata
, or a problem withcbindgen
assuming how to access it.The text was updated successfully, but these errors were encountered: