Hi, I am trying to run some tests in a crate that uses a custom *-sys. Here's how my folder tree is organized:
tcl_tk-rs/
- src/
- Cargo.toml
- tests/
- tcl_tk-sys/
- src/
- build.rs
- Cargo.toml
My tcl_tk-rs/Cargo.toml
is
[package]
name = "tk-rs"
version = "0.1.0"
authors = ["Darley Barreto"]
edition = "2018"
[lib]
name = "tcl_tk"
path = "src/lib.rs"
[dependencies]
num-bigint = "0.3"
[dependencies.tcl_tk-sys]
path = "tcl_tk-sys"
version = "0.1.0"
My tcl_tk-rs/tcl_tk-sys/Cargo.toml
is
[package]
name = "tcl_tk-sys"
version = "0.1.0"
authors = ["Darley Barreto"]
edition = "2018"
links = "tcl8.6"
build = "build.rs"
[dependencies]
libc = "*"
[build-dependencies]
pkg-config = "0.3.19"
[lib]
name = "tcl_tk_sys"
path = "src/lib.rs"
And my build.rs
is
use pkg_config;
fn main() {
if !build_pkgconfig() {
println!("cargo:rustc-flags=-l tcl8.6");
println!("cargo:rustc-flags=-l tk8.6");
}
}
fn build_pkgconfig() -> bool {
let conf = pkg_config::Config::new();
if (&conf.probe("tcl8.6")).is_err() || (&conf.probe("tk8.6")).is_err() {
print!("Could not find Tcl or Tk via pkgconfig");
false
} else {
true
}
}
Building is fine, but when I do cargo test
lots of cc
errors (undefined reference to
related to symbols) show up. What am I doing wrong?
Thanks in advance!