Comments (11)
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 [email protected]
on 21 Jun 2014 at 2:02
from goncurses.
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 [email protected]
on 21 Jun 2014 at 2:54
from goncurses.
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 [email protected]
on 24 Jun 2014 at 1:03
from goncurses.
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 [email protected]
on 24 Jun 2014 at 1:10
from goncurses.
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 [email protected]
on 24 Jun 2014 at 3:02
from goncurses.
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 [email protected]
on 24 Jun 2014 at 3:27
from goncurses.
$ 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 [email protected]
on 24 Jun 2014 at 1:28
from goncurses.
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 [email protected]
on 26 Jun 2014 at 6:54
from goncurses.
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 [email protected]
on 20 Aug 2014 at 6:59
- Added labels: OpSys-OSX
from goncurses.
Works under 1.3.1
$ go version
go version go1.3.1 darwin/amd64
Needs export CC=clang.
Original comment by [email protected]
on 17 Sep 2014 at 5:05
from goncurses.
Original comment by [email protected]
on 17 Sep 2014 at 5:13
- Changed state: Done
from goncurses.
Related Issues (20)
- Is "def_prog_mode()" implemented?
- Esc key and set_escdelay HOT 3
- How to make the libncurse dependency version independent ? HOT 2
- UTF-8 support HOT 3
- Thread safety HOT 2
- Build fails with "invalid flag in pkg-config" HOT 6
- Update wiki about KEY_RESIZE HOT 1
- go build issue HOT 1
- Compilation error when using REQ_LEFT
- pkgconfig problem HOT 8
- invalid flag in pkg-config HOT 1
- Convert project to Go mods
- Resizing without reinitializing?
- UTF-8 support is wrong HOT 4
- LINES and COLS? HOT 2
- About window scrolling HOT 2
- Examples fail to build: int is not MenuDriverReq
- Go get with M1 mac fails HOT 6
- Changing colors within MenuItems HOT 1
- Build fail: `lvalue required as left operand of assignment` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goncurses.