寻求帮助
huihui-wq opened this issue · comments
GOROOT=D:\APP\Go #gosetup
GOPATH=C:\Users\11366\go #gosetup
D:\APP\Go\bin\go.exe build -o D:\杂项\项目\godata\go_build_Golin_master_.exe -gcflags "all=-N -l" . #gosetup
package golin
imports golin/cmd
imports golin/port
imports golin/port/crack
imports github.com/tomatome/grdp/protocol/pdu
imports github.com/tomatome/grdp/protocol/t125/gcc
imports github.com/tomatome/grdp/plugin: build constraints exclude all Go files in C:\Users\11366\go\pkg\mod\github.com\tomatome\grdp@v0.1.0\plugin
编译完成,并显示退出代码 1
编译时出现此报错信息 应如何解决?
看起来像是github.com/tomatome/grdp/plugin下的文件都被构建约束排除了,执行一下:
go env
PS D:\goproject\Golin-master> go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\11366\AppData\Local\go-build
set GOENV=C:\Users\11366\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\goproject\godata\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\goproject\godata
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:/APP/Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=D:\APP\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=D:\goproject\Golin-master\go.mod
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 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\11366\AppData\Local\Temp\go-build1794455072=/tmp/go-build -gno-record-gcc-switches
看起来没什么问题,方便的话,加我一个VX方便定位问题:SelinuxG
执行以下命令,在尝试构建:
set CGO_ENABLED=1
问题已解决,开启cgo并配置gcc环境。