I need to use a crate which is hosted in my company's GitHub repo. There are two versions of this same crate for different OSes, namely vxworks and linux. In my application I have added this crate in the Cargo.toml like below depending on the target_os:
[target.'cfg(target_os = "vxworks")'.dependencies]
dep1= { git = "https://repo_url", branch = "vxworks", default-features = false }
[target.'cfg(not(target_os = "vxworks"))'.dependencies]
dep1= { git = "https://repo_url", branch = "linux", default-features = false }
When I compile I'm getting the below error:
Dependency 'dep1' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target.
jonrsharpe
124k32 gold badges290 silver badges493 bronze badges
lang-rust
dep1_vxworksanddep1_linux, then have adep1module that imports one or the other depending on the target, and re-exports it for the rest of your code.