为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决 running gcc failed exist status 1 in mac m1?

如何解决 running gcc failed exist status 1 in mac m1?

Go
MMMHUHU 2022-11-28 10:18:08
我已经 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/nodeissue 4212


查看完整回答
反对 回复 2022-11-28
  • 1 回答
  • 0 关注
  • 481 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号