Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: -compiler=gccgo: fork/exec no such file or directory #19628

Closed
xuqingsz opened this issue Mar 21, 2017 · 5 comments
Closed

cmd/go: -compiler=gccgo: fork/exec no such file or directory #19628

xuqingsz opened this issue Mar 21, 2017 · 5 comments
Milestone

Comments

@xuqingsz
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build038947788=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

A simple helloworld.go program. GC compiler compiled ok.
For some reason, instead, I need to compile with gccgo, but could never get it to compile.
Any insights are appreciated.
I also have a follow up question on whether gccgo would compile the program statically, or dynamically.

% cat helloworld.go 
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}
%  go build -compiler gccgo helloworld.go 
go build command-line-arguments: : fork/exec : no such file or directory
% go build -compiler gccgo -gccgoflags '-static' helloworld.go
go build command-line-arguments: : fork/exec : no such file or directory
% go build -compiler gccgo -gccgoflags '-static-libgo' helloworld.go
go build command-line-arguments: : fork/exec : no such file or directory

With the -x option:

% go build -compiler gccgo -gccgoflags '-static-libgo' -x helloworld.go
WORK=/tmp/go-build148131806
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /root/tmp
"" -I $WORK -c -g -m64 -fgo-relative-import-path=_/root/tmp -o $WORK/command-line-arguments/_obj/_go_.o -static-libgo ./helloworld.go
go build command-line-arguments: : fork/exec : no such file or directory
% gcc --version
gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)

What did you expect to see?

Program compiles and generates an executable.

What did you see instead?

'no such file or directory'

@gopherbot gopherbot added this to the Gccgo milestone Mar 21, 2017
@ianlancetaylor ianlancetaylor changed the title build Go with gccgo - fork/exec no such file or directory cmd/go: -compiler=gccgo: fork/exec no such file or directory Mar 21, 2017
@ianlancetaylor
Copy link
Contributor

Do you actually have gccgo installed on your system?

This looks like a very bad error message, but even if we fix that it still won't work for you.

@cwedgwood
Copy link
Contributor

@xuqingsz I've seen this when gcc[go] isn't in PATH.

What does

gccgo --version

say?

@xuqingsz
Copy link
Author

xuqingsz commented Apr 6, 2017

I did put this issue off for some time. But you are right! This did the fix for me. Thanks.

@xuqingsz xuqingsz closed this as completed Apr 6, 2017
@ianlancetaylor
Copy link
Contributor

Thanks for the update. I'm going to reopen this to get a better error message.

@ianlancetaylor ianlancetaylor reopened this Apr 7, 2017
@gopherbot
Copy link

CL https://golang.org/cl/40250 mentions this issue.

lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
Fixes golang#19628

Change-Id: I19baf694c66aaca8e0d95297c97aacb40db24c47
Reviewed-on: https://go-review.googlesource.com/40250
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Apr 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants