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

protoc_gen_hertz returns error: exit status 1 #919

Closed
Sue211213 opened this issue Aug 18, 2023 · 4 comments
Closed

protoc_gen_hertz returns error: exit status 1 #919

Sue211213 opened this issue Aug 18, 2023 · 4 comments
Labels
invalid issue invalid issue (not related to Hertz or described in document or not enough information provided) stale

Comments

@Sue211213
Copy link

According to hertz official example, I imported google/protobuf/descriptor.proto in idl/api.proto file.

When I execute the generate command, it throws an error google/protobuf/descriptor.proto: File not found..

The same code, in a Linux environment is fine. I don't know if this is a bug or if it's a windows issue.

Official example: https://www.cloudwego.io/zh/docs/hertz/tutorials/toolkit/usage-protobuf/

@github-actions github-actions bot added the invalid issue invalid issue (not related to Hertz or described in document or not enough information provided) label Aug 18, 2023
@github-actions
Copy link

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 18, 2023
@Sue211213
Copy link
Author

Describe the Question

这个问题来自于官方示例:hz 使用 (protobuf) | CloudWeGo

按照步骤,在完成 idl 的编写后,执行命令 hz new -I idl -idl idl/hello/hello.proto,发生错误:

hz new -I idl -idl idl/hello/hello.proto
#plugin protoc_gen_hertz returns error: exit status 1, cause:
#google/protobuf/descriptor.proto: File not found.
#api.proto:6:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
#api.proto:10:8: "google.protobuf.FieldOptions" is not defined.
#...

Reproducible Code

我是在 Windows 系统下编写此示例

在 Linux 环境下尝试过可以成功。

Screenshots

image-20230818141146483

Hertz version:

hz --version
#hz version v0.6.6

Environment:

go env
#set GO111MODULE=auto
#set GOARCH=amd64
#set GOBIN=
#set GOCACHE=C:\Users\cc\AppData\Local\go-build
#set GOENV=C:\Users\cc\AppData\Roaming\go\env
#set GOEXE=.exe
#set GOEXPERIMENT=
#set GOFLAGS=
#set GOHOSTARCH=amd64
#set GOHOSTOS=windows
#set GOINSECURE=
#set GOMODCACHE=D:\workspace\golang\pkg\mod
#set GONOPROXY=
#set GONOSUMDB=
#set GOOS=windows
#set GOPATH=D:\workspace\golang
#set GOPRIVATE=
#set GOPROXY=https://goproxy.cn,direct
#set GOROOT=D:\Go
#set GOSUMDB=sum.golang.org
#set GOTMPDIR=
#set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
#set GOVCS=
#set GOVERSION=go1.19.4
#set GCCGO=gccgo
#set GOAMD64=v1
#set AR=ar
#set CC=gcc
#set CXX=g++
#set CGO_ENABLED=1
#set GOMOD=D:\workspace\golang\src\proto_demo\go.mod
#set GOWORK=
#set CGO_CFLAGS=-g -O2
#set CGO_CPPFLAGS=
#set CGO_CXXFLAGS=-g -O2
#set CGO_FFLAGS=-g -O2
#set CGO_LDFLAGS=-g -O2
#set PKG_CONFIG=pkg-config
#set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\cc\AppData\Local\Temp\go-build3905511486=/tmp/go-build -gno-record-gcc-switches 

@rogerogers
Copy link
Contributor

rogerogers commented Aug 18, 2023

下载protoc的时候里面有个include文件夹,使用的时候可以指定到 -I 选项。Linux会从一些默认位置查找这些文件,比如/usr/local/include $HOME/.local/include等位置,Windows应该也有这种文件夹,不过我不太熟悉,Windows可以手动指定下,或者把 include 里面的google文件夹放到idl文件夹

@github-actions github-actions bot removed the stale label Aug 18, 2023
@github-actions
Copy link

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 18, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid issue invalid issue (not related to Hertz or described in document or not enough information provided) stale
Development

No branches or pull requests

2 participants