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: crash when cross compiled for raspberry pi #30078

Closed
nandra opened this issue Feb 4, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@nandra
Copy link

commented Feb 4, 2019

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

$ go version
1.11.2

Does this issue reproduce with the latest release?

Yes

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

x86_64 cross compiled for arm

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build099564701=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cross compile mender client for raspberrypi
by using:

env CGO_ENABLED=1 \
    CC=arm-linux-gnueabihf-gcc \
    GOOS=linux \
    GOARM=6 \
    GOARCH=arm make build

when run image on rpi0w we get this (in gdb):

Program received signal SIGSEGV, Segmentation fault.
0x00062540 in runtime.typesEqual (
   seen=map[runtime._typePair]struct {}<error reading variable: Cannot access memory at address 0x3ed>, t=0x3e8, v=0xd, ~r3=<optimized out>)
   at /usr/local/go/src/runtime/type.go:623
623                     for i := 0; i < len(tout); i++ {

What did you expect to see?

mender to run raspberrypi

What did you see instead?

Segmentation fault

@ianlancetaylor ianlancetaylor changed the title Crash when cross compile for raspberrypi runtime: crash when cross compiled for raspberry pi Feb 4, 2019

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2019

There is no Go version 1.12.1 yet, I assume you mean 1.11.1.

Is this crash reproducible? How often does it happen?

Can you share a program that reproduces the problem?

The error looks like memory corruption. The description of your build suggests that your program includes C code. How sure are you that that is not introducing memory corruption somewhere?

@nandra

This comment has been minimized.

Copy link
Author

commented Feb 4, 2019

Sorry go version is 1.11.2 (updated original comment). Issue happens every time I run binary.

Program source is mender client:
https://github.com/mendersoftware/mender

Mender build for x86 or other arm board like orangepi works perfectly fine.

@nandra

This comment has been minimized.

Copy link
Author

commented Feb 5, 2019

Turns out that wrong toolchain was used. Linaro tpplchains support armv7+ but raspberrypi0w is armv6 architecture. When used toochain from raspberrypi everything works. Sorry for noise. Closing.

@nandra nandra closed this Feb 5, 2019

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2019

Thanks for following up.

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.