DTStack / chengying-agent

EasyAgent is an infrastructure component, applied to manage the life-cycle of services on the remote host.
Apache License 2.0
32 stars 7 forks source link

编译报错 #5

Open danny-zhu opened 1 year ago

danny-zhu commented 1 year ago

环境:windows 11,go v1.21.1,IDE goland v2023.2.1 已经参考 https://github.com/DTStack/chengying-agent/issues/4 安装protobuf的软件包 在chengying-agent目录下执行make all报错如下:

Generating protocol codes ...
protoc -I=internal/proto -I=D:\Go_Workspace\chengying-1.1.1\chengying-server\matrix;D:\Go_Workspace\chengying-1.1.1\chengying-server;D:\Go_Workspace\chengying-1.1.1;C:\Users\Administrator\go/src/ -I=D:\Go_Workspace\chengying-1.1.1\chengying-server\matrix;D:\Go_Workspace\chengying-1.1.1\chengying-server;D:\Go_Workspace\chengying-1.1.1;C:\Users\Administrator\go/src/github.com/gogo/protobuf/protobuf/ \
        --gogo_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,plugins=grpc:internal/proto internal/proto/service.proto
D:Go_Workspacechengying-1.1.1chengying-servermatrix: warning: directory does not exist.
Missing input file.
/usr/bin/sh: D:Go_Workspacechengying-1.1.1chengying-server: command not found
/usr/bin/sh: D:Go_Workspacechengying-1.1.1: command not found
/usr/bin/sh: C:UsersAdministratorgo/src/: No such file or directory
/usr/bin/sh: D:Go_Workspacechengying-1.1.1chengying-server: command not found
/usr/bin/sh: D:Go_Workspacechengying-1.1.1: command not found
/usr/bin/sh: line 1: C:UsersAdministratorgo/src/github.com/gogo/protobuf/protobuf/: No such file or directory
make: *** [Makefile:39: proto] Error 127
danny-zhu commented 1 year ago

这是在windows上编译,路径分隔符却是linux的,并且前面的命令/usr/bin/sh也不对,导致前缀的$GOPATH路径不对。我想和这个有关系。那要怎么设置路径分隔符呢?

danny-zhu commented 1 year ago

看了go env中的GOOS是windows的,以下是go env的设置

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Administrator\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Administrator\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build3858679757=/tmp/go-build -gno-record-gcc-switches
danny-zhu commented 1 year ago

另外这个项目的代码是2年前的,新版本的go的编译方式已经更新了,是否和这个也有关系。makefile里面指定的protobuf目录新版本还是这样的吗? image

reaperhero commented 1 year ago

试试在linux上编译