Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go 1.13: gcc-5 not in PATH

I've installed Go 1.13.4 in Debian Linux 10 using brew, package golang (previously I've removed golang-1.11 installed via apt). It follows brew info output.

$ brew info golang
go: stable 1.13.4 (bottled), HEAD
Open source programming language to build simple/reliable/efficient software
https://golang.org
/home/linuxbrew/.linuxbrew/Cellar/go/1.13.4 (9,271 files, 408.1MB) *
  Poured from bottle on 2019-12-07 at 14:31:52
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/go.rb
==> Requirements
Required: macOS is required ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 1,571 (30 days), 8,628 (90 days), 31,650 (365 days)
install-on-request: 784 (30 days), 4,096 (90 days), 13,267 (365 days)
build-error: 0 (30 days)

When I try to execute go build on a package with code calls native OS functions, GO compiler tells that it's unable to find gcc-5 command as presented below.

$ go build
# _/home/giacomo/src/goproc/process
exec: "gcc-5": executable file not found in $PATH

So I've installed latest GCC (9.2.1) from testing (deb http://ftp.us.debian.org/debian testing main contrib non-free) repository and created a symbolic link to /usr/bin/x86_64-linux-gnu-gcc-9.

This solved the problem. But the question is: is this the correct way to fix the problem? Or is there a place to properly configure the GCC used by golang?

Any clarification very appreciated!

like image 269
gsscoder Avatar asked Nov 27 '22 13:11

gsscoder


1 Answers

Since it looks like you have installed go with linuxbrew, you can also install gcc-5:

brew install gcc@5

This solves the problem for me cleanly.

like image 134
hlascelles Avatar answered Dec 05 '22 21:12

hlascelles