Please add 'syntax = "proto3";' to the top of your .proto file. #1

Open
opened 2024-03-12 22:27:50 +01:00 by Benjamin_Loison · 0 comments
php ./vendor/bin/protobuf --include-descriptors -i . -o ./src/ ./addressbook.proto
protoc exited with an error (1) when executed with: 

  'protoc' '--plugin=protoc-gen-php=/home/benjamin/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/home/benjamin/protobuf' '--proto_path=/home/benjamin/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/home/benjamin/protobuf/src' '/home/benjamin/protobuf/addressbook.proto'



[libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: addressbook.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
[libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: php.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
--php_out: Can only generate PHP code for proto3 .proto files.
Please add 'syntax = "proto3";' to the top of your .proto file.

With syntax = "proto3"; at the beginning of addressbook.proto.

protoc exited with an error (1) when executed with: 

  'protoc' '--plugin=protoc-gen-php=/var/www/html/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/var/www/html/protobuf' '--proto_path=/var/www/html/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/var/www/html/protobuf/src' '/var/www/html/protobuf/addressbook.proto'



[libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: php.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
addressbook.proto:18:14: Required fields are not allowed in proto3.
addressbook.proto:19:44: Explicit default values are not allowed in proto3.
addressbook.proto:7:12: Required fields are not allowed in proto3.
addressbook.proto:8:12: Required fields are not allowed in proto3.

With php.proto:

protoc exited with an error (1) when executed with: 

  'protoc' '--plugin=protoc-gen-php=/var/www/html/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/var/www/html/protobuf' '--proto_path=/var/www/html/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/var/www/html/protobuf/src' '/var/www/html/protobuf/addressbook.proto'



[libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: addressbook.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
php.proto:13:55: Explicit default values are not allowed in proto3.
addressbook.proto:2:1: Import "php.proto" was not found or had errors.

I tried all proto2 and proto3 possibilities without success.

```bash php ./vendor/bin/protobuf --include-descriptors -i . -o ./src/ ./addressbook.proto ``` ``` protoc exited with an error (1) when executed with: 'protoc' '--plugin=protoc-gen-php=/home/benjamin/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/home/benjamin/protobuf' '--proto_path=/home/benjamin/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/home/benjamin/protobuf/src' '/home/benjamin/protobuf/addressbook.proto' [libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: addressbook.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) [libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: php.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) --php_out: Can only generate PHP code for proto3 .proto files. Please add 'syntax = "proto3";' to the top of your .proto file. ``` With `syntax = "proto3";` at the beginning of `addressbook.proto`. ``` protoc exited with an error (1) when executed with: 'protoc' '--plugin=protoc-gen-php=/var/www/html/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/var/www/html/protobuf' '--proto_path=/var/www/html/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/var/www/html/protobuf/src' '/var/www/html/protobuf/addressbook.proto' [libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: php.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) addressbook.proto:18:14: Required fields are not allowed in proto3. addressbook.proto:19:44: Explicit default values are not allowed in proto3. addressbook.proto:7:12: Required fields are not allowed in proto3. addressbook.proto:8:12: Required fields are not allowed in proto3. ``` With `php.proto`: ``` protoc exited with an error (1) when executed with: 'protoc' '--plugin=protoc-gen-php=/var/www/html/protobuf/vendor/protobuf-php/protobuf-plugin/bin/protobuf' '--proto_path=/var/www/html/protobuf' '--proto_path=/var/www/html/protobuf/vendor/protobuf-php/google-protobuf-proto/src' '--php_out=/var/www/html/protobuf/src' '/var/www/html/protobuf/addressbook.proto' [libprotobuf WARNING google/protobuf/compiler/parser.cc:648] No syntax specified for the proto file: addressbook.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) php.proto:13:55: Explicit default values are not allowed in proto3. addressbook.proto:2:1: Import "php.proto" was not found or had errors. ``` I tried all `proto2` and `proto3` possibilities without success.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Benjamin_Loison/protobuf-plugin#1
No description provided.