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

execution hangs #27

Open
electricBonfire opened this issue Mar 6, 2018 · 7 comments
Open

execution hangs #27

electricBonfire opened this issue Mar 6, 2018 · 7 comments

Comments

@electricBonfire
Copy link

Very new to protocol buffers so sorry if this is something simple on my end...

I have installed this repo via composer. I have also installed protoc via homebrew.

When I run the following command execution hangs with no output:
./vendor/bin/protoc-gen-php.php -o ./build -i nyct-subway.proto

I have downloaded this file and removed the .txt extension:
http://datamine.mta.info/sites/all/files/pdfs/nyct-subway.proto.txt

Is there something I am missing? The first 2 lines of the .proto.txt file are:
option java_package = "com.google.transit.realtime";
import "gtfs-realtime.proto";

Do I need to download these dependencies? Is this even a valid .proto file for use with protobuf-php?

@electricBonfire
Copy link
Author

electricBonfire commented Mar 6, 2018

Well made minor headway. I found the gtfs-realtime.proto file. I also changed my execution to: ./vendor/bin/protoc-gen-php.php -vvv -o ./build -i . nyct-subway.proto

Now I get the error:

[libprotobuf WARNING google/protobuf/compiler/parser.cc:546] No syntax specified for the proto file: nyct-subway.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)

--php_out: nyct-subway.proto: Can only generate PHP code for proto3 .proto files. Please add 'syntax = "proto3";' to the top of your .proto file.

When I add syntax = "proto3"; I get the following error:
nyct-subway.proto:12:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.

When I remove all of the optional from the file I get the following errors:

nyct-subway.proto: Extensions in proto3 are only allowed for defining options. nyct-subway.proto: Required fields are not allowed in proto3. nyct-subway.proto: The first enum value must be zero in proto3.</error >

It seems like this file is for an older version of the syntax (?) However the first error stated: --php_out: nyct-subway.proto: Can only generate PHP code for proto3 .proto files

@dstevenson
Copy link

This project is currently using google protocol buffers v2. Right now by default homebrew will install protobuf v3

@electricBonfire
Copy link
Author

electricBonfire commented Mar 7, 2018

Ok thanks, I will try to download v2

@electricBonfire
Copy link
Author

That did the trick! Thank you!

@electricBonfire
Copy link
Author

I am running the following ./vendor/bin/protoc-gen-php.php -o ./build -i . --protoc=/usr/local/opt/[email protected]/bin/protoc nyct-subway.proto

It is reading the nyct-subway.proto file and outputting gtfs-realtime.php in the bin dir.

However, I am not seeing any of the messages that are located inside the nyct file.

I am trying to access the NyctFeedHeader extension, but it is returning NULL, and I do not see any references to it inside the newly created gtfs-realtime file.

When I diff the original gtfs-realtime.php file and the newly created one, there is very little difference.

@dstevenson
Copy link

Do you have a copy of the gtfs-realtime.proto file you can attach here?

@electricBonfire
Copy link
Author

gtfs-realtime.proto.txt

nyct-subway.proto.txt

File created by running protoc:
gtfs-realtime.php.txt

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