-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobileAndroid, iOS, and x/mobile
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.11.5 linux/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ GOOS=android GOARCH=arm GOARM=7 CC=arm-linux-androideabi-gcc CXX=false go env GOARCH="arm" GOBIN="" GOCACHE="/home/saleem/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="android" GOPATH="/home/saleem/.local/lib/go" GOPROXY="" GORACE="" GOROOT="/usr/lib/go" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" GOARM="7" CC="arm-linux-androideabi-gcc" CXX="false" CGO_ENABLED="0" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -marm -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build669201380=/tmp/go-build -gno-record-gcc-switches"
What did you do?
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, World!")
}
What did you expect to see?
The command should succeed without explicitly setting CGO_ENABLED=1
What did you see instead?
Without explicitly setting CGO_ENABLED
(go env
shows it defaults to CGO_ENABLED=0
)
$ GOOS=android GOARCH=arm GOARM=7 CC=arm-linux-androideabi-gcc CXX=false go build /usr/lib/go/pkg/tool/linux_amd64/link: running arm-linux-androideabi-gcc failed: exit status 1 /tmp/go-link-934544495/go.o:go.go:_cgo_init: error: undefined reference to 'x_cgo_init' /tmp/go-link-934544495/go.o:go.go:_cgo_notify_runtime_init_done: error: undefined reference to 'x_cgo_notify_runtime_init_done' /tmp/go-link-934544495/go.o:go.go:_cgo_thread_start: error: undefined reference to 'x_cgo_thread_start' /tmp/go-link-934544495/go.o:go.go:runtime._cgo_setenv: error: undefined reference to 'x_cgo_setenv' /tmp/go-link-934544495/go.o:go.go:runtime._cgo_unsetenv: error: undefined reference to 'x_cgo_unsetenv' /tmp/go-link-934544495/go.o:go.go:runtime.cgo_yield: error: undefined reference to '_cgo_yield' collect2: error: ld returned 1 exit status
Explicitly setting CGO_ENABLED=1
leads to a successful build
$ GOOS=android GOARCH=arm GOARM=7 CC=arm-linux-androideabi-gcc CXX=false CGO_ENABLED=1 go build $
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobileAndroid, iOS, and x/mobile