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: cc1: error: unrecognized command line option "-m32" during get #25665

Closed
gbitten opened this issue May 31, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@gbitten
Copy link

commented May 31, 2018

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

go version go1.10.2 linux/386

Does this issue reproduce with the latest release?

Version 1.10.2 is the latest stable release, Anyway, It works normally with go version go1.9.6 linux/386.

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

GOARCH="386"
GOBIN=""
GOCACHE="/home/rds/.cache/go-build"
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rds/go"
GORACE=""
GOROOT="/home/rds/gotest/go"
GOTMPDIR=""
GOTOOLDIR="/home/rds/gotest/go/pkg/tool/linux_386"
GCCGO="gccgo"
GO386="sse2"
CC="arm-arago-linux-gnueabi-gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build804659883=/tmp/go-build"

What did you do?

wget https://dl.google.com/go/go1.10.2.linux-386.tar.gz
sudo tar -C /usr/local -xzf go1.10.2.linux-386.tar.gz
echo export PATH=\$PATH:/usr/local/go/bin >> ~/.profile
source ~/.profile
go get github.com/gorilla/mux

What did you expect to see?

No errors

What did you see instead?

# runtime/cgo
cc1: error: unrecognized command line option "-m32"

@agnivade agnivade changed the title cc1: error: unrecognized command line option "-m32" cmd/go: cc1: error: unrecognized command line option "-m32" during get May 31, 2018

@agnivade agnivade added this to the Go1.11 milestone May 31, 2018

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 31, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented May 31, 2018

You are building for 386, but your CC environment variable points to what looks like an ARM compiler. Don't set CC in the environment, or at least set it to an x86 compiler.

@gbitten

This comment has been minimized.

Copy link
Author

commented Jun 1, 2018

This machine is used to cross compile with GCC, I didn't know that could affect Go.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2018

The CC environment variable sets the default C compiler to use with Go code that calls C code, as documented at https://golang.org/cmd/cgo and https://golang.org/cmd/go/#hdr-Environment_variables .

@frakman1

This comment has been minimized.

Copy link

commented Jul 24, 2018

I had the same error. It turns out the shell I was using was previously set up to cross compile (source environ ...) The fix was just to open a new, fresh shell so it didn't have the holdover environment variables from before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.