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

Cannot compile dependency #1639

Open
marci1175 opened this issue Feb 22, 2024 · 1 comment
Open

Cannot compile dependency #1639

marci1175 opened this issue Feb 22, 2024 · 1 comment

Comments

@marci1175
Copy link

marci1175 commented Feb 22, 2024

Bug Report

Version

└── tonic v0.11.0
└── tonic-build v0.7.2

Platform

Windows 11 64-bit build: 22631.2715

Description

Every time I try to compile tonic, with no features, I am constantly getting build errors
Ive tried to fix them by editing the codegen file, which worked but ofcourse every time I reopen vs code the errors re-appear.

I tried to compile the hello world example, but it didnt work. Ive been having this issue since january 7th, there i was using tonic "0.7" and when I added the feature "compression" these problems would appear.

error[E0599]: no method named send_gzip found for struct tonic::client::Grpc in the current scope
  --> C:\Users\marci\Desktop\FileHosting\target\debug\build\FileHosting-878bc6a1594928c5\out/file_hosting.rs:69:37
   |
69 |             self.inner = self.inner.send_gzip();
   |                                     ^^^^^^^^^ method not found in Grpc<T>

error[E0599]: no method named accept_gzip found for struct tonic::client::Grpc in the current scope
  --> C:\Users\marci\Desktop\FileHosting\target\debug\build\FileHosting-878bc6a1594928c5\out/file_hosting.rs:75:37
   |
75 |             self.inner = self.inner.accept_gzip();
   |                                     ^^^^^^^^^^^ method not found in Grpc<T>

error[E0308]: arguments to this method are incorrect
   --> C:\Users\marci\Desktop\FileHosting\target\debug\build\FileHosting-878bc6a1594928c5\out/file_hosting.rs:189:30
    |
189 | ...                   .apply_compression_config(
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^
190 | ...                       accept_compression_encodings,
    |                           ---------------------------- expected EnabledCompressionEncodings, found ()
191 | ...                       send_compression_encodings,
    |                           -------------------------- expected EnabledCompressionEncodings, found ()
    |
note: method defined here
   --> C:\Users\marci\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.11.0\src\server\grpc.rs:183:12
    |
183 |     pub fn apply_compression_config(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^

But with the latest version (v0.11.0) I cannot remove this feature I guess.

I edited:

/// The greeting service definition.
    #[derive(Debug)]
    pub struct GreeterServer<T: Greeter> {
        inner: _Inner<T>,
        accept_compression_encodings: (),
        send_compression_encodings: (),
    }

to:

/// The greeting service definition.
    #[derive(Debug)]
    pub struct GreeterServer<T: Greeter> {
        inner: _Inner<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
    }

And also had to bring use tonic::server::NamedService; into scope, but that was in the changleog that I had to do that.

This is my very first issue opened, so Im happy to provide more info if I missed something

@LucioFranco
Copy link
Member

I believe you need to enable this feature https://github.com/hyperium/tonic/blob/master/tonic/Cargo.toml#L27

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

2 participants