bytedance / sonic

A blazingly fast JSON serializing & deserializing library
Apache License 2.0
6.59k stars 327 forks source link

使用go的docker镜像编译时cgo报错 #610

Closed chuxin0816 closed 4 months ago

chuxin0816 commented 4 months ago

本地可以编译,容器就不行了,容器gcc版本也是最新的 => ERROR [api builder 7/7] RUN go build -o api api/main.go 13.6s

[api builder 7/7] RUN go build -o api api/main.go: 1.412 # runtime/cgo 1.412 gcc: error: unrecognized command-line option '-m64'

failed to solve: process "/bin/sh -c go build -o api api/main.go" did not complete successfully: exit code: 1

sonic v1.11.3 FROM golang:1.22.1-bookworm AS builder

RUN apt-get update && apt-get install -y gcc

ENV GO111MODULE=on \ CGO_ENABLED=1 \ GOOS=linux \ GOARCH=amd64 \ GOPROXY=https://goproxy.cn,direct

chuxin0816 commented 4 months ago

找到问题了,生成的可执行文件名字和已有目录冲突了