Unit test requires a library module.. not found
⚓ Rust 📅 2025-09-25 👤 surdeus 👁️ 7So I have two crates (PARENT, and CHILD)
The CHILD module(crate) - module - I check out using GIT via cargo...
Cargo hides this in a UUID like directory as such:
    c:\Users\myname\.cargo\git\checkouts\edebug-6afe8e0f98063d76\6dc6bed>
At the command line, I can CD to that directory and type "cargo test"
This crate uses/requires a custom static lib: 'edebug_windows.lib"
On linux it would require a different library, and other targets( other libraries ).
The windows prebuilt static library is (A) in git, and (B) present cause the above 'cargo test' works.. AND in the child: "cargo test" - properly provides the library search directory where the library is located. This tells me:
a) The library is present, and it works correctly
b) It is not missing from GIT.
C) The CHILD builds correctly..
In the child, I use 'build.rs' to output (A) the name of the library to link, and (B) the search directory, which - as I see is "relative to the cargo.toml" file.
But D) The parent does not so the problem is in the parent.
E) The parent KNOWS that it requires the library - i see that in the error message.
F) BUT The PARENT does not know where to find library.
The error message i get is from the linker saying: "cannot open LIBRARYNAME.lib".
SO the question i have is this:
What is the proper way for a CHILD crate to provide a static library to a parent crate?
My hunch is I just need to copy the static library into every possible parent crate that might use the library in 'test mode' - but that too screams NO that is wrong.
BUT - when this information is pushed upto the parent, things go wrong:
A) The library filename is correct.
B) The search directory is WRONG.
IMHO - the child crate, when consumed by the parent should adjust relative paths provided by the child crate. Instead it uses them as is.
Is my thinking wrong here?
what is the proper way to do this?
1 post - 1 participant
🏷️ Rust_feed