i'm trying to get some C library integrated, and have been following bindgen tutorial at:
However, doing all the previous steps, i stop at the error (removed some empty lines to save space):
# cargo build --verbose error: environment variable `OUT_DIR` not defined --> src/lib.rs:5:18 5 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); | ^^^^^^^^^^^^^^^ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error error: could not compile `rust-demo-lib`. Caused by: process didn't exit successfully: `rustc --crate-name rust_demo_lib --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=d74e1daf97a74d57 -C extra-filename=-d74e1daf97a74d57 --out-dir /.../target/debug/deps -C incremental=/.../target/debug/incremental -L dependency=/.../target/debug/deps` (exit code: 1)
... in verbose paths above is placeholder for some long path in local filesystem and is valid existing directory)
Is there some relation between the "OUT_DIR" in include! macro, and the "--out-dir" that seem to be set in verbose rustc command?
According to https://doc.rust-lang.org/cargo/reference/environment-variables.html, the variable should be set by cargo automatically? Is there something deprecated in the tutorial, or some parts i may be missing?