aquarat / goncurses

Automatically exported from code.google.com/p/goncurses
Other
0 stars 0 forks source link

Installation fails on OS X 10.9.3 with Go 1.3 #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  sudo port install ncurses    (ncurses @5.9_2)
2.  go get code.google.com/p/goncurses

What is the expected output? What do you see instead?
The expectation is installation.  Instead I get the following panic:

# code.google.com/p/goncurses
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]

goroutine 16 [running]:
runtime.panic(0x1dae60, 0x31b9e4)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084dbf20, 0xb3c4, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1288 +0x1632
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084dbe30, 0xb3c4, 0x4)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1e60, 0xb3c4, 0x6, 0x0, 0x0, 0x8)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1e60, 0xb3c4, 
0x2084ddac0)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084da690, 0xb3c4, 0x26d401)
    /usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084da390, 0xb3c4, 0x4)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1c80, 0xb3c4, 0x6, 0x0, 0x0, 0x4)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1c80, 0xb3c4, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084fd980, 0xb3c4, 0x0)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1b00, 0xb3c4, 0x6, 0x0, 0x0, 0x8)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1b00, 0xb3c4, 
0x2084dd840)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084fce70, 0xb3c4, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084fce10, 0xb3c4, 0x4)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).FuncArg(0x208466420, 0x2208384908, 0x2084fce10, 0xb3c4, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1405 +0x59
main.(*typeConv).FuncType(0x208466420, 0x20852ab40, 0xb3c4, 0x20852ab40)
    /usr/local/go/src/cmd/cgo/gcc.go:1458 +0x534
main.(*Package).loadDWARF(0x20836f1e0, 0x208439500, 0x208516c00, 0x42, 0x80)
    /usr/local/go/src/cmd/cgo/gcc.go:539 +0x1462
main.(*Package).Translate(0x20836f1e0, 0x208439500)
    /usr/local/go/src/cmd/cgo/gcc.go:182 +0x150
main.main()
    /usr/local/go/src/cmd/cgo/main.go:259 +0xef1

goroutine 19 [finalizer wait]:
runtime.park(0x4fed0, 0x31feb8, 0x31f269)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x31feb8, 0x31f269)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

What version of the product are you using? On what operating system?

Head version on OS X 10.9.3.

Please provide any additional information below.

ncurses confirmed installed and working correctly with a "Hello World" app.

$ vi ncurses.c
$ gcc -o ncurses ncurses.c -lncurses
$ ./ncurses

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/chris/go:/Users/chris/go/src"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
-fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

$ go version
go version go1.3 darwin/amd64

$ go run hello.go 
Hello, world

On the same machine with the same configuration, this worked in Go 1.2.

Original issue reported on code.google.com by mmo...@gmail.com on 21 Jun 2014 at 1:40

GoogleCodeExporter commented 9 years ago
Looking at the panic, this may be a bug in Go itself...have you tried compiling 
any other programs that require cgo with Go 1.3?

Original comment by rthornto...@gmail.com on 21 Jun 2014 at 2:02

GoogleCodeExporter commented 9 years ago
It looks like cgo works in simple cases.  Test case borrows from cgo's 
introductory documentation:

$ cat rand/rand.go
package rand

/*
#include <stdlib.h>
*/
import "C"

func Random() int {
    return int(C.random())
}

func Seed(i int) {
    C.srandom(C.uint(i))
}

$ go install rand

$ cat rand_print.go
package main

import (
"fmt"
"rand"
)

func main() {
  fmt.Printf("rand %d\n", rand.Random())
}

$ go run rand_print.go
rand 1804289383

Original comment by mmo...@gmail.com on 21 Jun 2014 at 2:54

GoogleCodeExporter commented 9 years ago
I admit, this is a strange error. I don't really have a place to start on 
diagnosing this issue as none of the above errors relate directly to the 
library and I don't have access to a Mac for testing. Posting on mailing list 
to see what I can turn up.

Original comment by rthornto...@gmail.com on 24 Jun 2014 at 1:03

GoogleCodeExporter commented 9 years ago
Could you try to compile a simple cgo example with a declared Go type for a C 
type? Specifically, with a C struct type.

Original comment by rthornto...@gmail.com on 24 Jun 2014 at 1:10

GoogleCodeExporter commented 9 years ago
I get the same behavior on a completely different project. Perhaps this gives 
some clue?
 Same version of OS X 10.9.3

mp:~ gary$ go version
go version go1.3 darwin/amd64
mp:~ gary$ go get -u github.com/andlabs/ui
# github.com/andlabs/ui
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]

goroutine 16 [running]:
runtime.panic(0x1dae60, 0x31b9e4)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
main.(*typeConv).Type(0x20837e2c0, 0x22083853f0, 0x208483f50, 0x29f8, 
0x2084a2e01)
    /usr/local/go/src/cmd/cgo/gcc.go:1288 +0x1632
main.(*typeConv).Type(0x20837e2c0, 0x22083853b8, 0x208483ef0, 0x29f8, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Type(0x20837e2c0, 0x2208385558, 0x20847cc40, 0x29f8, 0x0)
    /usr/local/go/src/cmd/cgo/gcc.go:1075 +0x387f
main.(*typeConv).Struct(0x20837e2c0, 0x208373980, 0x29f8, 0x6, 0x0, 0x0, 0x8)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x20837e2c0, 0x2208385428, 0x208373980, 0x29f8, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x20837e2c0, 0x22083853b8, 0x208483da0, 0x29f8, 0x0)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x20837e2c0, 0x208372c60, 0x29f8, 0x6, 0x0, 0x0, 0x8)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x20837e2c0, 0x2208385428, 0x208372c60, 0x29f8, 0xb2e01)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x20837e2c0, 0x22083853b8, 0x208482b70, 0x29f8, 
0x2084e13f0)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Type(0x20837e2c0, 0x22083853f0, 0x208482a80, 0x29f8, 0x26d420)
    /usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*typeConv).Struct(0x20837e2c0, 0x208372420, 0x29f8, 0x6, 0x0, 0x0, 0x0)
    /usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x20837e2c0, 0x2208385428, 0x208372420, 0x29f8, 
0x2084da001)
    /usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x20837e2c0, 0x22083853b8, 0x208482900, 0x29f8, 
0x2084e13e0)
    /usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Type(0x20837e2c0, 0x22083853f0, 0x208482840, 0x29f8, 0x1)
    /usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*Package).loadDWARF(0x20836e8f0, 0x2083ca080, 0x20837d800, 0x19, 0x20)
    /usr/local/go/src/cmd/cgo/gcc.go:541 +0xfb4
main.(*Package).Translate(0x20836e8f0, 0x2083ca080)
    /usr/local/go/src/cmd/cgo/gcc.go:182 +0x150
main.main()
    /usr/local/go/src/cmd/cgo/main.go:259 +0xef1

goroutine 19 [finalizer wait]:
runtime.park(0x4fed0, 0x31feb8, 0x31f269)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x31feb8, 0x31f269)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

Original comment by sca...@gmail.com on 24 Jun 2014 at 3:02

GoogleCodeExporter commented 9 years ago
It was suggested on the mailling list that this could possibly do to libraries 
not being updated to Go 1.3. You can try go install -a or deleting 
$GOPATH/{bin,pkg} to clear out old libraries.

Thread at https://mail.google.com/mail/u/0/#inbox/146cb6e98e8e056d

Original comment by rthornto...@gmail.com on 24 Jun 2014 at 3:27

GoogleCodeExporter commented 9 years ago
$ cd ~/go
$ rm -rf pkg bin
$ go install code.google.com/p/goncurses
# code.google.com/p/goncurses
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]

$ sudo rm -rf /usr/local/go/pkg /usr/local/go/bin
. . . reinstall Go here . . .
$ go install code.google.com/p/goncurses
# code.google.com/p/goncurses
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]

$ sudo bash
# export GOPATH=~/go
# go install -a code.google.com/p/goncurses
# code.google.com/p/goncurses
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]

Original comment by mmo...@gmail.com on 24 Jun 2014 at 1:28

GoogleCodeExporter commented 9 years ago
Replying to #4 (above) I got enough time to finally finish an example of a 
declared Go type using a C structure and calling native functions.

http://www.mischiefblog.com/2014/06/26/example-cgo-golang-app-that-calls-a-nativ
e-library-with-a-c-structure/

Original comment by mmo...@gmail.com on 26 Jun 2014 at 6:54

GoogleCodeExporter commented 9 years ago
This may be related to Issue 19: 
https://code.google.com/p/goncurses/issues/detail?id=19&can=1

Try updating to Go 1.3.1 and see if it fixes the problem.

Original comment by rthornto...@gmail.com on 20 Aug 2014 at 6:59

GoogleCodeExporter commented 9 years ago
Works under 1.3.1

$ go version
go version go1.3.1 darwin/amd64

Needs export CC=clang.

Original comment by mmo...@gmail.com on 17 Sep 2014 at 5:05

GoogleCodeExporter commented 9 years ago

Original comment by rthornto...@gmail.com on 17 Sep 2014 at 5:13