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/compile: panic on linux/mips64le during build with Go 1.6.2 in QEMU #15416

Closed
vanloswang opened this issue Apr 23, 2016 · 13 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@vanloswang
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.6.2 linux/mips64le

  2. What operating system and processor architecture are you using (go env)?
    GOARCH="mips64le"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="mips64le"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH=""
    GORACE=""
    GOROOT="/usr/lib/golang"
    GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_mips64le"
    GO15VENDOREXPERIMENT="1"
    CC="gcc"
    GOGCCFLAGS="-fPIC -fmessage-length=0"
    CXX="g++"
    CGO_ENABLED="0"

  3. What did you do?
    Just compile golang on fedora 23 mips64el, which is based on QEMU melta 5KEc.

  4. What did you expect to see?
    Compile success.

  5. What did you see instead?

    rpmbuild --define "golang_arches mips64el" -bb golang-1.6.2.spec

    Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.s5c1s4

  6. umask 022

  7. cd /root/rpmbuild/BUILD

  8. cd /root/rpmbuild/BUILD

  9. rm -rf go

  10. /usr/bin/gzip -dc /root/rpmbuild/SOURCES/go1.6.2.tar.gz

  11. /usr/bin/tar -xof -

  12. STATUS=0

  13. '[' 0 -ne 0 ']'

  14. cd go

  15. /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

  16. exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.LjhtJ8

  17. umask 022

  18. cd /root/rpmbuild/BUILD

  19. cd go

  20. uname -a
    Linux fedora-mips64el 4.4.0-0.rc4.git0.1.mips.fc23.mips64el cmd/cgo: fails with gcc 4.4.1 #1 Fri Dec 18 08:53:44 GMT 2015 mips64 mips64 mips64 GNU/Linux

  21. cat /proc/cpuinfo
    system type : MIPS Malta
    machine : mti,malta
    processor : 0
    cpu model : MIPS 5KE V0.0
    BogoMIPS : 2801.66
    wait instruction : yes
    microsecond timers : yes
    tlb_entries : 32
    extra interrupt vector : yes
    hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8]
    isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2
    ASEs implemented :
    shadow register sets : 1
    kscratch registers : 0
    package : 0
    core : 0
    VCED exceptions : not available
    VCEI exceptions : not available

  • cat /proc/meminfo
    MemTotal: 2015436 kB
    MemFree: 380420 kB
    MemAvailable: 1864000 kB
    Buffers: 91896 kB
    Cached: 1305964 kB
    SwapCached: 0 kB
    Active: 682032 kB
    Inactive: 781152 kB
    Active(anon): 65596 kB
    Inactive(anon): 136 kB
    Active(file): 616436 kB
    Inactive(file): 781016 kB
    Unevictable: 0 kB
    Mlocked: 0 kB
    SwapTotal: 0 kB
    SwapFree: 0 kB
    Dirty: 63112 kB
    Writeback: 0 kB
    AnonPages: 65336 kB
    Mapped: 49764 kB
    Shmem: 412 kB
    Slab: 160164 kB
    SReclaimable: 107032 kB
    SUnreclaim: 53132 kB
    KernelStack: 1248 kB
    PageTables: 1284 kB
    NFS_Unstable: 0 kB
    Bounce: 0 kB
    WritebackTmp: 0 kB
    CommitLimit: 1007716 kB
    Committed_AS: 213152 kB
    VmallocTotal: 1069547512 kB
    VmallocUsed: 0 kB
    VmallocChunk: 0 kB
    AnonHugePages: 18432 kB
    HugePages_Total: 0
    HugePages_Free: 0
    HugePages_Rsvd: 0
    HugePages_Surp: 0
    Hugepagesize: 2048 kB
  • export GOROOT_BOOTSTRAP=/usr/lib/golang
  • GOROOT_BOOTSTRAP=/usr/lib/golang
  • export GOROOT_FINAL=/usr/lib/golang
  • GOROOT_FINAL=/usr/lib/golang
  • export GOHOSTOS=linux
  • GOHOSTOS=linux
  • export GOHOSTARCH=mips64le
  • GOHOSTARCH=mips64le
  • pushd src
    ~/rpmbuild/BUILD/go/src ~/rpmbuild/BUILD/go
  • export 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -march=mips64r2 -mabi=64'
  • CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -march=mips64r2 -mabi=64'
  • export 'LDFLAGS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
  • LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
  • export CC=gcc
  • CC=gcc
  • export CC_FOR_TARGET=gcc
  • CC_FOR_TARGET=gcc
  • export GOOS=linux
  • GOOS=linux
  • export GOARCH=mips64le
  • GOARCH=mips64le
  • export 'GO_LDFLAGS=-linkmode internal'
  • GO_LDFLAGS='-linkmode internal'
  • export CGO_ENABLED=0
  • CGO_ENABLED=0
  • ./make.bash --no-clean
    Building Go bootstrap tool.
    cmd/dist
Building Go toolchain using /usr/lib/golang.

bootstrap/internal/obj
bootstrap/internal/obj/arm
bootstrap/internal/obj/arm64
bootstrap/internal/obj/mips
bootstrap/internal/obj/ppc64
bootstrap/internal/obj/x86
bootstrap/asm/internal/arch
bootstrap/asm/internal/flags
bootstrap/asm/internal/lex
bootstrap/asm/internal/asm
bootstrap/asm
bootstrap/compile/internal/big
bootstrap/internal/gcprog
bootstrap/compile/internal/gc
bootstrap/compile/internal/amd64
bootstrap/compile/internal/arm
bootstrap/compile/internal/arm64
bootstrap/compile/internal/mips64
bootstrap/compile/internal/ppc64
bootstrap/compile/internal/x86
bootstrap/compile
bootstrap/link/internal/ld
bootstrap/link/internal/amd64
bootstrap/link/internal/arm
bootstrap/link/internal/arm64
bootstrap/link/internal/mips64
bootstrap/link/internal/ppc64
bootstrap/link/internal/x86
bootstrap/link

Building go_bootstrap for host, linux/mips64le.

runtime/internal/sys
runtime/internal/atomic
runtime
encoding
errors
internal/race
internal/syscall/windows/sysdll
math
sort
sync/atomic
unicode
unicode/utf16
unicode/utf8
sync
container/heap
internal/singleflight
io
syscall
hash
hash/adler32
strings
bytes
strconv
bufio
path
regexp/syntax
reflect
encoding/base64
crypto
crypto/sha1
internal/syscall/windows/registry
internal/syscall/windows
time
regexp
os
encoding/binary
path/filepath
fmt
os/signal
/ioutil
os/exec
debug/dwarf
go/token
flag
log
text/template/parse
net/url
compress/flate
encoding/json
go/scanner
go/ast
compress/zlib
text/template
debug/elf
debug/macho
go/parser
go/doc
go/build
cmd/go

Building packages and commands for linux/mips64le.

panic: regexp: Compile(((https?|ftp|file|gopher|mailto|news|nntp|telnet|wais|prospero)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?%#~&/\-+=()]+([:.,][a-zA-Z0-9_?%#~&/\-+=()]+)*)|([\pL_][\pL_0-9]*)): error parsing regexp: invalid escape sequence: \-

goroutine 1 [running]:
panic(0x3434c0, 0xc82000e5a0)
/usr/lib/golang/src/runtime/panic.go:481 +0x4b8
regexp.MustCompile(0x4bb7e0, 0xb9, 0x4655e0)
/usr/lib/golang/src/regexp/regexp.go:232 +0x17c
go/doc.init()
/usr/lib/golang/src/go/doc/comment.go:59 +0x108
go/build.init()
/usr/lib/golang/src/go/build/syslist.go:8 +0xc4
main.init()
/usr/lib/golang/src/cmd/go/zdefaultcc.go:6 +0xdc
error: Bad exit status from /var/tmp/rpm-tmp.LjhtJ8 (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.LjhtJ8 (%build)

@vanloswang
Copy link
Author

@minux @eswierk @cherrymui

@vanloswang
Copy link
Author

@eswierk @cherrymui
I tried golang source code from skyportsystem, report the same error.

@cherrymui
Copy link
Member

Can't reproduce it on my machine. Do you see it only on when building rpm?

It seems you have a working go1.6.2 from /usr/lib/golang. If you rebuild it, does it work?

@vanloswang
Copy link
Author

vanloswang commented Apr 29, 2016

@cherrymui test it again the original golang 1.6.2 can compile ok, but with your patch for externel cgo link support, it report such an error on qemu emulated mips64el machine. On my physical machine it nerver report the error and works well. So many thx to you. Could you debug it out?

@vanloswang
Copy link
Author

@cherrymui maybe the new relocation does not adapt to the qemu emulated machine?

@bradfitz bradfitz added this to the Go1.7Maybe milestone May 4, 2016
@rsc
Copy link
Contributor

rsc commented May 17, 2016

It sounds like this is a QEMU problem. Leaving for Go 1.8.

@rsc rsc changed the title golang 1.6.2 panic on linux/mips64le cmd/compile: panic on linux/mips64le during build with Go 1.6.2 in QEMU May 17, 2016
@rsc rsc modified the milestones: Go1.8, Go1.7Maybe May 17, 2016
@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 11, 2016
@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

@vanloswang is this still a problem with newer versions of Go?

@rsc rsc modified the milestones: Go1.8Maybe, Go1.8 Oct 21, 2016
@vanloswang
Copy link
Author

@rsc I will test it with fedora 24 mips64le and golang 1.7.3 during this weekend.

@vanloswang
Copy link
Author

@rsc Go 1.7.3 have the same issue on Fedora mips64le platform. The error msg is as following:

# go env
panic: regexp: Compile(`((https?|ftp|file|gopher|mailto|news|nntp|telnet|wais|prospero)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?%#~&/\-+=()]+([:.,][a-zA-Z0-9_?%#~&/\-+=()]+)*)|([\pL_][\pL_0-9]*)`): error parsing regexp: invalid escape sequence: `\-`

goroutine 1 [running]:
panic(0x4ebe80, 0xc42000e560)
        /root/go-linux-mips64le-bootstrap/src/runtime/panic.go:500 +0x4c4
regexp.MustCompile(0x58b990, 0xb9, 0x57b49e)
        /root/go-linux-mips64le-bootstrap/src/regexp/regexp.go:237 +0x17c
go/doc.init()
        /root/go-linux-mips64le-bootstrap/src/go/doc/comment.go:59 +0x110
go/build.init()
        /root/go-linux-mips64le-bootstrap/src/go/build/zcgo.go:33 +0xcc
main.init()
        /root/go-linux-mips64le-bootstrap/src/cmd/go/zosarch.go:43 +0xdc

@bradfitz
Copy link
Contributor

That regexp compiles and matches file for me in Go 1.4, Go 1.6, Go 1.7, and Go tip.

I'm unable to reproduce.

@vanloswang
Copy link
Author

@bradfitz This issue is on qemu emulated mips64le platform, not real machine. It works well on real machines.

@minux
Copy link
Member

minux commented Nov 1, 2016 via email

@bradfitz
Copy link
Contributor

bradfitz commented Nov 1, 2016

Closing. Reopen if there's a repro on a real machine.

@bradfitz bradfitz closed this as completed Nov 1, 2016
@golang golang locked and limited conversation to collaborators Nov 1, 2017
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.
Projects
None yet
Development

No branches or pull requests

7 participants