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

runtime/cgo: build fails on linux-arm with "size of array '_check_for_64_bit_pointer_matching_GoInt' is negative" #38693

Closed
alevchuk opened this issue Apr 27, 2020 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@alevchuk
Copy link

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

go version go1.11.6 linux/arm

Does this issue reproduce with the latest release?

Yes. I tired building go1.13.10

bootstrap versions tried go1.11.6 and go-1.7

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

go env Output
$ go env
GOARCH="arm"
GOBIN=""
GOCACHE="/home/monitoring/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/monitoring/gocode"
GOPROXY=""
GORACE=""
GOROOT="/home/monitoring/src/go"
GOTMPDIR=""
GOTOOLDIR="/home/monitoring/src/go/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/monitoring/src/go/src/go.mod"
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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build264984488=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cd go/src
./all.bash

What did you expect to see?

Build success as usual (on Pi 4s this always builds fine).

What did you see instead?

~/src/go/src $ ./all.bash

Building Go cmd/dist using /usr/lib/go-1.7.
Building Go toolchain1 using /usr/lib/go-1.7.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/arm64.
# runtime/cgo
In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:25:14: error: size of array '_check_for_64_bit_pointer_matching_GoInt' is negative
go tool dist: FAILED: /home/monitoring/src/go/pkg/tool/linux_arm64/go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 2
@andybons andybons changed the title build fails with "size of array '_check_for_64_bit_pointer_matching_GoInt' is negative" runtime/cgo: build fails on linux-arm with "size of array '_check_for_64_bit_pointer_matching_GoInt' is negative" Apr 27, 2020
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 27, 2020
@andybons
Copy link
Member

@ianlancetaylor

@andybons andybons added this to the Unplanned milestone Apr 27, 2020
@ianlancetaylor
Copy link
Contributor

The bug title and your go env output suggest that you are building for linux/arm, but the output is for a build of linux/arm64. The error looks like you are cross-compiling, but that you are using a native compiler rather than a cross-compiler.

Why does the all.bash output say Building packages and commands for linux/arm64. ?

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 27, 2020
@alevchuk
Copy link
Author

alevchuk commented Apr 28, 2020

I'm not familiar with go code base, all.bash is part of that.

I tried export GOARCH=arm and got the same error.

Building Go cmd/dist using /usr/lib/go-1.11. (go1.11.6 linux/arm)

says "arm"

while:

Building packages and commands for host, linux/arm64.

says "arm64"

btw, I'm running a 32 bit OS (Rasbian) on 64 bit hardware

@ianlancetaylor
Copy link
Contributor

It sounds like the Go build process is misunderstanding your system. I think you may need to set both GOHOSTARCH=arm and GOARCH=arm when running all.bash.

@chowyu08
Copy link

I have the same question when build arm64
# runtime/cgo In file included from _cgo_export.c:4: cgo-gcc-export-header-prolog:25:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negative

@ALTree
Copy link
Member

ALTree commented Jun 18, 2021

This was probably caused by incorrect env variables and there hasn't been any update for about a year, I think we can close.

@ALTree ALTree closed this as completed Jun 18, 2021
@golang golang locked and limited conversation to collaborators Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants