我已經 brew install mingw-w64。當我檢查它的版本時。gcc --版本:gcc (Homebrew GCC 11.2.0_3) 11.2.0.g++——版本:g++ (Homebrew GCC 11.2.0_3) 11.2.0我還運行哪個 gcc:/opt/homebrew/bin/gcc然后我用 image 運行我的 docker-compose golang:latest。還沒有錯誤up to date, audited 370 packages in 10m9 packages are looking for funding run `npm fund` for details6 high severity vulnerabilitiesTo address issues that do not require attention, run: npm audit fixTo address all issues (including breaking changes), run: npm audit fix --forceRun `npm audit` for details.Unlinking stale socket /tmp/supervisor.sock[15:30:39] Using gulpfile /go/src/github.com/projectname/src/api/gulpfile.js[15:30:39] Starting 'default'...[15:30:39] Starting 'watch'...當我保存 .go 文件時,它會下載所有模組,這是錯誤: # github.com/projectname/api /usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1 collect2: fatal error: cannot find 'ld' compilation terminated. [15:46:23] 'build-binary' errored after 1.98 s [15:46:23] Error in plugin "gulp-shell" Message: Command `go build` failed with exit code 2這是我的Dockerfile:FROM golang:1.17.0-alpine3.14 AS builder RUN apk update && apk add gcc make git libc-dev binutils-gold# Install dependenciesRUN apk add --update tzdata \ --no-cache ca-certificates git wget \ nodejs npm \ g++ \ supervisor \ && update-ca-certificates \ && npm install -g gulp gulp-shellRUN npm install -g yarnCOPY ops/api/local/supervisor /etcENV PATH $PATH:/go/binWORKDIR /go/src/github.com/projectname/src/api
1 回答

狐的傳說
TA貢獻1804條經驗 獲得超3個贊
嘗試并檢查是否像在這個 Dockerfile 中一樣,添加binutils-gold
將允許您使用ld
.
RUN apk update && apk add gcc make git libc-dev binutils-gold
(首次出現在nodejs/node
issue 4212)
- 1 回答
- 0 關注
- 436 瀏覽
添加回答
舉報
0/150
提交
取消