[分布式] Linux 下go build报错:cgo: exec gcc: exec: "gcc": executable file not found in

219 阅读1分钟

一、问题描述

~/Project/Distribute/mit2/src/main$ go build -buildmode=plugin ../mrapps/wc.go
# runtime/cgo
cgo: exec gcc: exec: "gcc": executable file not found in $PATH

提示没有 gcc可执行文件
看一眼版本号:

~/Project/Distribute/mit2/src/main$ gcc -v
Command 'gcc' not found, but can be installed with:
sudo apt install gcc

二、在Ubuntu上安装GCC

sudo apt update
sudo apt install build-essential

build-essential包含了 GNU 编辑器集合,GNU 调试器,和其他编译软件所必需的开发库和工具,包括gcc,g++,和make

image.png 显示安装成功

image.png 再次执行go build任务,编译成功