Mrs4s / go-cqhttp

cqhttp的golang实现,轻量、原生跨平台.
GNU Affero General Public License v3.0
10.41k stars 1.63k forks source link

编译未能通过:build constraints exclude all Go files #558

Closed hammerfunctor closed 3 years ago

hammerfunctor commented 3 years ago

环境信息:

版本

% go version                                                                     21-01-13 - 2:31:12
go version go1.15.6 linux/arm64

环境变量

% go env                                                                    :( 1 21-01-13 - 2:31:03
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/home/huzf/.cache/go-build"
GOENV="/home/huzf/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/huzf/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/huzf/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/huzf/tools/Go-CQHttp/go-cqhttp.src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build226931164=/tmp/go-build -gno-record-gcc-switches"

问题描述

编译不能通过

% go build -ldflags "-s -w -extldflags '-static'"                           :( 1 21-01-13 - 2:34:14
package github.com/Mrs4s/go-cqhttp
    imports github.com/Mrs4s/go-cqhttp/coolq
    imports github.com/Mrs4s/go-cqhttp/global
    imports github.com/Mrs4s/go-cqhttp/global/codec: build constraints exclude all Go files in /home/huzf/tools/Go-CQHttp/go-cqhttp.src/global/codec

改为% CGO_ENABLED=1 CC=/usr/bin/gcc go build -ldflags "-s -w -extldflags '-static'"仍有相同的结果

复现方式

...不知道要怎么复现,只是把 repo clone下来然后按照执行了doc里的命令

Ink-33 commented 3 years ago

我这边尝试复现下

huanglei001 commented 2 months ago

后来怎么解决的呢?