x/playground: exec: «gcc»: executable file not found in $PATH #26307
Comments
Copy link Quote reply
bradfitz commented Jul 10, 2018
I’m getting errors looking for gcc (!?) on the playground:
Copy link Quote reply
ysmolsky commented Jul 10, 2018 •
Reproduced this in local docker image.
«go vet -x» wants to do this:
but it fails on gcc line.
Why does vet compile net package in cgo mode while we have CGO_ENABLED=0 set in Dockerfile?
Copy link Quote reply
ysmolsky commented Jul 10, 2018
Changing from «go vet» to «go tool vet» in vet.go fixes problem in my local machine. Some day I might learn what is the difference between those.
Copy link Quote reply
ysmolsky commented Jul 10, 2018
And another fix would be:
Meaning that «go vet» does not remember CGO_ENABLED variable set during the build of go tools.
Copy link Quote reply
ianlancetaylor commented Jul 10, 2018
If the Go toolchain was built with CGO_ENABLED=0 , then that should be the default for go vet . Can you find out what the generated file go/build/zcgo.go looks like? What is the value of defaultCGO_ENABLED in that file?
Copy link Quote reply
ysmolsky commented Jul 10, 2018
Playground tools are compiled this way:
- CGO_ENABLED=0
- curl -sSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz
- unpacked to /usr/local
- RUN cp -R /usr/local/go $GOROOT_BOOTSTRAP
- cd /usr/local/go/src && GOOS=nacl GOARCH=amd64p32 ./make.bash —no-clean
Is src/go/build/zcgo.go modified during tools rebuild?
Copy link Quote reply
ianlancetaylor commented Jul 10, 2018
The zcgo.go file is created while running make.bash (by mkzcgo in cmd/dist/build.go) and should never be modified afterward. Seeing defaultCGO_ENABLED set to the empty string suggests that CGO_ENABLED was not set (or was set to the empty string) when make.bash was run. I can’t tell from the above: is CGO_ENABLED=0 expected to be set while running make.bash ? If so, I can’t explain what you are seeing.
Copy link Quote reply
Copy link Quote reply
ysmolsky commented Jul 10, 2018
Running vet directly in the docker image:
It was built this way:
Here we cross compile go and toolchain, but I am not sure if the native go is getting recompiled too using CGO_ENABLED=0. It seems it is not, but the it looks like it’s datetime is get updated:
Copy link Quote reply
ianlancetaylor commented Jul 10, 2018
My guess is that because you are running make.bash —no-clean the existing go/build package, which was built without CGO_ENABLED being set, is reused. So although you do get a new go command, it is still one that defaults to CGO_ENABLED unset, and therefore defaults to actually using cgo.
Copy link Quote reply
ianlancetaylor commented Jul 10, 2018
In any case explicitly setting CGO_ENABLED=0 when running go vet seems appropriate. It may also be appropriate to set GOOS and GOARCH .
Copy link Quote reply
gopherbot commented Jul 11, 2018
Change https://golang.org/cl/123136 mentions this issue: playground: disable cgo in the vet tool
Copy link Quote reply
cuonglm commented Jul 11, 2018 •
Changing from «go vet» to «go tool vet» in vet.go fixes problem in my local machine. Some day I might learn what is the difference between those.
From 1.9 to 1.10, go vet compile packages so it know the types, go tool vet does not.
If the Go toolchain was built with CGO_ENABLED=0, then that should be the default for go vet
I build playground image with latest master, run the container and here’s the strace output:
go vet net runs without CGO_ENABLED in its environment.
compile is called with CGO_ENABLED=1 , which tool set it?
Copy link Quote reply
cuonglm commented Jul 11, 2018
Why does vet compile net package in cgo mode while we have CGO_ENABLED=0 set in Dockerfile?
exec: «gcc»: executable file not found in $PATH (Google Cloud Platform) #416
Comments
Copy link Quote reply
zer0xtgs commented May 5, 2017
I’m trying to deploy my web-app to Google Cloud Platform, and I got an error while deploying. I understand that last package (go-sqlite3) needs gcc compiler, and Google Cloud WM has it:
$which gcc
/usr/bin/gcc
but it still doesn’t work
Step 3 : RUN go-wrapper install -tags appenginevm
—> Running in b0f03024342d
+ exec go install -v -tags appenginevm
github.com/mattn/go-colorable
github.com/mattn/go-isatty
github.com/labstack/gommon/color
github.com/valyala/fasttemplate/vendor/github.com/valyala/bytebufferpool
github.com/valyala/fasttemplate
github.com/labstack/gommon/log
golang.org/x/crypto/acme
golang.org/x/crypto/acme/autocert
github.com/labstack/echo
golang.org/x/net/context
github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: «gcc»: executable file not found in $PATH
The command ‘/bin/sh -c go-wrapper install -tags appenginevm’ returned a non-zero code: 2
ERROR
ERROR: build step «gcr.io/cloud-builders/docker@sha256:926dc1a14e6f7eb5b3462b5c1d491aa6c73090291167ac2bf181c026b05f19da» failed: exit status 2
echo $PATH output:
zer0xtgs@todo-hntu:
$ echo $PATH /google/google-cloud-sdk/bin:/usr/local/nvm/versions/node/v6.9.2/bin:/home/zer0xtgs/gopath/bin:/google/gopath/bin:/usr/local/go/bin:/gradle-2.12/bin:/apache-maven-3.3.9/bin:/google/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/google/go_appengine:/google/google_appengine
also, I have added this to Google Cloud Shell profile:
PATH=/usr/bin:$PATH
and tried
go get github.com/mattn/go-sqlite3 and go install github.com/mattn/go-sqlite3
but this doesn’t help, after I’m trying to deploy app, same error.
Is it Google Cloud Platform bug or something with go-sqlite3 ?
exec: «gcc»: executable file not found in $PATH #223
Comments
Copy link Quote reply
jmreicha commented Aug 16, 2016 •
I am building a custom image and getting the following gcc error:
Copy link Quote reply
random0000 commented Aug 16, 2016
Same issue as well
Copy link Quote reply
josegonzalez commented Aug 16, 2016
Can you paste your custom dockerfile here?
Copy link Quote reply
random0000 commented Aug 16, 2016
So I just now did a «git clone https://github.com/gliderlabs/logspout.git» and then ran «docker build .» and received the above error.
Copy link Quote reply
jmreicha commented Aug 16, 2016 •
I should also mention, I am using the build.sh script in the root of the repo. Without it, I am seeing the issue described in #212.
Copy link Quote reply
jmreicha commented Aug 16, 2016
I add added gcc to the list of packages being installed in build.sh
Now I’m getting the following error:
Copy link Quote reply
random0000 commented Aug 16, 2016
I added:
apk add build-base gcc abuild binutils binutils-doc gcc-doc
to the build.sh file and it all seemed to work. I’m sure this is overkill since it added a whole lot of items.
Copy link Quote reply
josegonzalez commented Aug 16, 2016
I was able to see the same issue. I can only assume the underlying image changed?
Copy link Quote reply
jmreicha commented Aug 17, 2016 •
I added build-base as a package and everything built okay but the image size is about 173mb now which is probably not ideal. I still have to test it out but at least it built!
Copy link Quote reply
bn0ir commented Aug 17, 2016 •
@jmreicha, maybe you forgot to add «apk del build-base», I have 15.49 MB image size after image built
Copy link Quote reply
hadri3n commented Aug 17, 2016 •
I have the same issue:
Dockerfile content:
FROM gliderlabs/logspout:latest
Docker version:
Docker version 1.12.0, build 8eab29e
and I run the following command:
docker build —pull -t logspout .
Copy link Quote reply
josegonzalez commented Aug 17, 2016
Alright I can confirm this, please don’t add a 👍 unless you have a fix for the problem.
Copy link Quote reply
jmreicha commented Aug 17, 2016
@bn0ir D’oh you’re right, I forgot to delete build-base. After removing it, my image is down to 26mb, much better.
Copy link Quote reply
josegonzalez commented Aug 17, 2016
Still much larger than the images we publish to docker.
Copy link Quote reply
jmreicha commented Aug 17, 2016
I think the extra size might come from the additional entries I added to the modules.go file for logstash support.
Copy link Quote reply
josegonzalez commented Aug 18, 2016
Official images are around 5mb.
Copy link Quote reply
jmreicha commented Aug 22, 2016 •
@josegonzalez Confirmed that it doesn’t work without build-base , using a basic modules.go, which I think is adding the extra size.
Copy link Quote reply
josegonzalez commented Aug 22, 2016
Yeah seems like gliderlabs/alpine dropped something critical here.
Copy link Quote reply
Bekt commented Aug 25, 2016
#225 should fix this. However, I’m getting the following error with custom builds. Not sure if related or not.
Copy link Quote reply
josegonzalez commented Aug 25, 2016
Unrelated, thats a different issue. You’ll need to copy a build.sh from our repo into the root of your directory.
Copy link Quote reply
Bekt commented Aug 25, 2016
Copy link Quote reply
indianscout commented Aug 29, 2016 •
Hola Amigos, this problem still exists with gliderlabs/logspout:v3.1:
I went through the posts above but there seems to be no solution — or is there. Could anybody who is familiar with this images clarify this issue to make this configuration work again?
Copy link Quote reply
josegonzalez commented Aug 29, 2016
3.1 will always have this issue. You’ll want to build from master/latest.
Copy link Quote reply
indianscout commented Aug 29, 2016
With the master I get this error:
Copy link Quote reply
indianscout commented Aug 29, 2016
BTW I prefer tags with fixed versions to avoid sudden problems when logspout:master gets updated. Probably a tag like v4.0 would be appropriate.
Copy link Quote reply
josegonzalez commented Aug 29, 2016
You’ll need to add the build.sh from this repo to your build directory or your builds will fail. That’s basically what that error is about. I said the same thing to @Bekt above.
Regarding making a release, I’ll look into it sometime this week. I too prefer released software, but life makes people busy with other stuff 🙂
Copy link Quote reply
indianscout commented Aug 29, 2016
I’ll wait with the quickfix on my side until there is a working image/tag. I very much appreciate your efforts 🙂 THX a lot!
Copy link Quote reply
Bekt commented Aug 29, 2016
Some of you are trying to do a custom logspout-logstash build. I have put a working version of the image here: https://hub.docker.com/r/bekt/logspout-logstash/
Copy link Quote reply
digitalnomd commented Sep 27, 2016 •
For anyone who is trying to do a custom build, the fix is to clone from current release and then build in the custom directory. That should come with the necessary build file so you should not have to copy anything.