我有一个说明该文件的
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 GO111MODULE=on go build -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/victoria-metrics-arm64 ./app/victoria-metrics
我已经安装了
之类的aarch64-linux-gnu-gcc二进制文件mkdir aarch64-toolchain
cd aarch64-toolchain/
wget http://releases.linaro.org/components/toolchain/binaries/6.5-2018.12/aarch64-linux-gnu/gcc-linaro-6.5.0-2018.12-x86_64_aarch64-linux-gnu.tar.xz
tar -Jxvf gcc-linaro-6.5.0-2018.12-x86_64_aarch64-linux-gnu.tar.xz
并将其导出到Path变量
uname -a 命令的输出给出
Linux prom 4.14.0-115.2.2.el7a.aarch64 #1 SMP Wed Nov 28 22:05:51 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
现在我得到了错误
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 GO111MODULE=on go build -mod=vendor -ldflags "-X 'github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=-20190716-133242-heads-master-0-gfb14f23'" -o bin/victoria-metrics-arm64 ./app/victoria-metrics
# runtime/cgo
fork/exec /usr/bin/aarch64-linux-gnu-gcc: exec format error
make: *** [victoria-metrics-arm64] Error 2
请帮助我解决问题。很久以来我都被困住了
答案 0 :(得分:0)
尝试为ARM使用纯Go构建。它最近在VictoriaMetrics中实现,并成为ARM的默认设置。它没有cgo deps,因此无需C工具链即可构建。参见https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md#arm-build