How can I specify a git dependency from a workspace?

I would like to use the newest version of a crate that has a repository which is a workspace containing the library I want.

Ususally, in Cargo.toml:

[dependencies]
onnxruntime = { git = "https://github.com/nbigaouette/onnxruntime-rs" }

But because it is a workspace I get errors about the repository not containing one library.

How would I specify which library I want from the workspace?

The Cargo.toml that you pasted works for me. Can you paste the exact error you are getting?

$ cat Cargo.toml 
[package]
name = "git-test"
version = "0.1.0"
edition = "2018"

[dependencies]
onnxruntime = { git = "https://github.com/nbigaouette/onnxruntime-rs" }

$ cargo check
   Compiling onnxruntime-sys v0.0.14 (https://github.com/nbigaouette/onnxruntime-rs#88c6bab9)
    Checking onnxruntime v0.0.14 (https://github.com/nbigaouette/onnxruntime-rs#88c6bab9)
    Checking git-test v0.1.0 (/home/mbrubeck/src/test/ony)
    Finished dev [unoptimized + debuginfo] target(s) in 1.94s
error: failed to parse manifest at `/Users/fulopl/Rust/ocr/Cargo.toml`

Caused by:
  Dependency 'onnxruntime' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target.

Oh, I think I know what it might be. I am trying this on a mac with an M1 chip. Which I know onnxruntime doesn't support.

I am going to try it on my other computer to see, but it should work.

Edit:
Nope I get the same error on my other mac. I'll try it within an empty cargo new..

Edit 2:
Omg I am so dumb. I misunderstood the error. I had different versions of the crate for build and dev dependencies.

[dependencies]
onnxruntime = "0.0.14"

[build-dependencies]
onnxruntime = { git = "https://github.com/nbigaouette/onnxruntime-rs" }

@mbrubeck Thanks for trying it out and everything.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.