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

Hello world example does not compile #1537

Open
GaelicGabe opened this issue Sep 27, 2023 · 5 comments
Open

Hello world example does not compile #1537

GaelicGabe opened this issue Sep 27, 2023 · 5 comments

Comments

@GaelicGabe
Copy link

Bug Report

Version

Latests master on github

Platform

Linux dev-fedora 6.1.43-1.qubes.fc32.x86_64

Description

I did the following
git clone https://github.com/hyperium/tonic.git
cd tonic/examples
cargo build --bin helloworld-server
and then I get the following error:

   Compiling examples v0.1.0 (/home/user/dev/experiments/tonic/examples)
error: failed to run custom build command for `examples v0.1.0 (/home/user/dev/experiments/tonic/examples)`

Caused by:
  process didn't exit successfully: `/home/user/dev/experiments/tonic/target/debug/build/examples-e0eba3978652fe71/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=proto/routeguide/route_guide.proto
  cargo:rerun-if-changed=proto
  cargo:rerun-if-changed=proto/helloworld/helloworld.proto
  cargo:rerun-if-changed=proto
  cargo:rerun-if-changed=proto/echo/echo.proto
  cargo:rerun-if-changed=proto/echo
  cargo:rerun-if-changed=proto/unaryecho/echo.proto
  cargo:rerun-if-changed=proto/unaryecho
  cargo:rerun-if-changed=proto/attrs/attrs.proto
  cargo:rerun-if-changed=proto
  cargo:rerun-if-changed=proto/googleapis/google/pubsub/v1/pubsub.proto
  cargo:rerun-if-changed=proto/googleapis

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: google/protobuf/descriptor.proto: File not found.\ngoogle/api/annotations.proto:20:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ngoogle/api/annotations.proto:28:8: \"google.protobuf.MethodOptions\" is not defined.\ngoogle/api/client.proto:19:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ngoogle/api/client.proto:27:8: \"google.protobuf.MethodOptions\" is not defined.\ngoogle/api/client.proto:66:8: \"google.protobuf.ServiceOptions\" is not defined.\ngoogle/api/client.proto: \"google.protobuf.ServiceOptions\" is not defined.\ngoogle/api/field_behavior.proto:19:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ngoogle/api/field_behavior.proto:27:8: \"google.protobuf.FieldOptions\" is not defined.\ngoogle/api/resource.proto:19:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ngoogle/api/resource.proto:28:8: \"google.protobuf.FieldOptions\" is not defined.\ngoogle/api/resource.proto:34:8: \"google.protobuf.FileOptions\" is not defined.\ngoogle/api/resource.proto:40:8: \"google.protobuf.MessageOptions\" is not defined.\ngoogle/protobuf/duration.proto: File not found.\ngoogle/protobuf/empty.proto: File not found.\ngoogle/protobuf/field_mask.proto: File not found.\ngoogle/protobuf/timestamp.proto: File not found.\ngoogle/pubsub/v1/schema.proto:19:1: Import \"google/api/annotations.proto\" was not found or had errors.\ngoogle/pubsub/v1/schema.proto:20:1: Import \"google/api/client.proto\" was not found or had errors.\ngoogle/pubsub/v1/schema.proto:21:1: Import \"google/api/field_behavior.proto\" was not found or had errors.\ngoogle/pubsub/v1/schema.proto:22:1: Import \"google/api/resource.proto\" was not found or had errors.\ngoogle/pubsub/v1/schema.proto:23:1: Import \"google/protobuf/empty.proto\" was not found or had errors.\ngoogle/pubsub/v1/schema.proto:70:50: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:19:1: Import \"google/api/annotations.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:20:1: Import \"google/api/client.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:21:1: Import \"google/api/field_behavior.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:22:1: Import \"google/api/resource.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:23:1: Import \"google/protobuf/duration.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:24:1: Import \"google/protobuf/empty.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:25:1: Import \"google/protobuf/field_mask.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:26:1: Import \"google/protobuf/timestamp.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:27:1: Import \"google/pubsub/v1/schema.proto\" was not found or had errors.\ngoogle/pubsub/v1/pubsub.proto:159:3: \"Encoding\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:230:3: \"google.protobuf.Timestamp\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:261:3: \"google.protobuf.FieldMask\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:692:3: \"google.protobuf.Duration\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:760:3: \"google.protobuf.Duration\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:764:3: \"google.protobuf.Duration\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:809:3: \"google.protobuf.Duration\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:919:3: \"google.protobuf.FieldMask\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:1192:3: \"google.protobuf.FieldMask\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:1225:3: \"google.protobuf.Timestamp\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:1304:5: \"google.protobuf.Timestamp\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:118:48: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:463:16: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:476:16: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:492:48: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:529:16: \"google.protobuf.Empty\" is not defined.\ngoogle/pubsub/v1/pubsub.proto:607:54: \"google.protobuf.Empty\" is not defined.\n" }', examples/build.rs:33:10

If I remove the following lines from examples/build.rs it works again

    tonic_build::configure()
        .build_server(false)
        .compile(
            &["proto/googleapis/google/pubsub/v1/pubsub.proto"],
            &["proto/googleapis"],
        )
        .unwrap();
@fmartinsons
Copy link

Hello, did you try re-installing the protoc package ?
moreover can you specify the tonic commit you tried, telling "current master" is not enough.

@seanlossef-kce
Copy link

I am having the same issue. I have a fresh install of protoc running on version v0.11.0 of tonic (https://github.com/hyperium/tonic/releases/tag/v0.11.0).

@inevity
Copy link

inevity commented Mar 13, 2024

When in protoc 25.1 on arch , build ok. when protoc 3.14.0 on rockylinux, same issue.
Now just workaround as above remove line.

@mxtm
Copy link

mxtm commented Mar 27, 2024

I am having this issue with protoc 3.19.6 and tonic 0.9 on Fedora 39.

Commands in the description give me the same error

@Yingming29
Copy link

Has someone solved this problem? I also have the issue on protoc 3.12.4.

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

6 participants