Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tonic build is not working in Rust Workspace project #484

Closed
CrazyRoka opened this issue Oct 24, 2020 · 1 comment
Closed

Tonic build is not working in Rust Workspace project #484

CrazyRoka opened this issue Oct 24, 2020 · 1 comment

Comments

@CrazyRoka
Copy link

When compiling the project I receive this error message:

warning: /home/roka/Project/problems-service/Cargo.toml: unused manifest key: build
   Compiling problems-service v0.1.0 (/home/roka/Project/problems-service)
   Compiling httparse v1.3.4
   Compiling want v0.3.0
   Compiling iovec v0.1.4
error[E0433]: failed to resolve: use of undeclared type or module `tonic_build`
 --> problems-service/build.rs:2:5
  |
2 |     tonic_build::compile_protos("proto/problems.proto").unwrap();
  |     ^^^^^^^^^^^ use of undeclared type or module `tonic_build`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
error: could not compile `problems-service`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Project tree

├── Cargo.lock
├── Cargo.toml
└── problems-service
    ├── build.rs
    ├── Cargo.toml
    ├── proto
    │   └── problems.proto
    └── src
        └── main.rs

Outer cargo toml:

[workspace]

members = [
    "problems-service"
]

Inner cargo toml:

[package]
name = "problems-service"
version = "0.1.0"
authors = ["CrazyRoka <rokarostuk@gmail.com>"]
edition = "2018"

[dependencies]
prost = "0.6.1"
tonic = { version = "0.3.1", features = ["tls"] }
tokio = { version = "0.3.1", features = ["stream", "macros"] }
futures = "0.3"

[build.dependencies]
tonic-build = "0.3.1"

build.rs

fn main() {
    tonic_build::compile_protos("proto/problems.proto").unwrap();
}

Platform:
Linux roka-pc 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Default host: x86_64-unknown-linux-gnu
stable-x86_64-unknown-linux-gnu (default)
rustc 1.47.0 (18bf6b4f0 2020-10-07)

@CrazyRoka
Copy link
Author

Issue with [build-dependencies], my bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant