Closed joeblew99 closed 8 years ago
Unfortunately, the textedit using sigint.ca turned out to run into the dependency conflict problem - my program imports Shiny, then imports sigint.ca, which itself has a vendored Shiny, and their mouse events are incompatible.
The code as it stands now only has a few dependencies, Shiny, go-gtk, gotk3 as of yesterday, and draw2dimg. It is Shiny and the gtk libraries that are transitively dependency heavy.
A bit of searching found this comment: https://github.com/mattn/go-gtk/issues/165
which indicates that
$ brew install cairo pixman fontconfig freetype libpng gtksourceview
$ export PKG_CONFIG_PATH=":/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/local/opt/gtksourceview/lib/pkgconfig:${PKG_CONFIG_PATH}"
$ make all
may help you.
thanks for detailed help.
BTW, i got exactly the same error with sigint.ca/graphics repo and the dependency on the mouse events from Shiny. It was only about 7 lines that did not match. I tried it out 2 weeks ago. I think the author is really eager to get it fixed, but he did not know what was broken. Here is the issue: https://github.com/jnjackins/graphics/issues/2
About GTK
I followed the instructions you had, and it semed to work.
demo compiled with no errors
but then i run demo i got the same error:
x-MacBook-Pro:demo apple$ go build demo.go
x-MacBook-Pro:demo apple$ ls
demo demo.go
x-MacBook-Pro:demo apple$ ./demo
(process:94539): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x6f6d65642f2e pc=0x490ce5d]
runtime stack:
runtime.throw(0x4213b91, 0x2a)
/usr/local/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
/usr/local/go/src/runtime/sigpanic_unix.go:12 +0x2cc
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x418b3c0, 0xc42004dcb8, 0x0)
/usr/local/go/src/runtime/cgocall.go:131 +0x110 fp=0xc42004dc88 sp=0xc42004dc48
github.com/mattn/go-gtk/gtk._Cfunc_gtk_init(0xc4200741d8, 0xc420074210)
??:0 +0x41 fp=0xc42004dcb8 sp=0xc42004dc88
github.com/mattn/go-gtk/gtk.Init(0x43a4470)
/Users/apple/workspace/go/src/github.com/mattn/go-gtk/gtk/gtk.go:230 +0x19e fp=0xc42004dd48 sp=0xc42004dcb8
main.main()
/Users/apple/workspace/go/src/github.com/mattn/go-gtk/example/demo/demo.go:49 +0x42 fp=0xc42004df48 sp=0xc42004dd48
runtime.main()
/usr/local/go/src/runtime/proc.go:183 +0x1f4 fp=0xc42004dfa0 sp=0xc42004df48
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc42004dfa8 sp=0xc42004dfa0
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1
my bad.
Demo does not work, but other do. So i must have a good setup now :)
I will move on and close this..
Sorry, an inadvertent ctrl-enter sent that off before I was finished.
I do not have access to an OS-X box to test on, but if you can get go-gtk installed and happy, then building the examples should be doable, hopefully. I've run into a few git issues, so you may need to go get -u again to be sure you've got the latest build state.
Incidentally, if you find a different graphics toolkit easier to install on OSX and it is also available for Linux, I'm willing to attempt to try it and add it as a backend, though I can't make any promises about timing on that.
I do hope you have success building it.
Btw, I have recorded a video regarding it, as requested fairly early on in the golang-nuts discussion.
thanks for the video. Its quite long so will watch it later..
i got go-gtk installed and happy. at least some of their demos worked for me. But i still had issues running your code. an easy one is /examples/maze/mazegui.go
x-MacBook-Pro:maze apple$ pwd
/Users/apple/workspace/go/src/github.com/TheGrum/renderview/examples/maze
x-MacBook-Pro:maze apple$ ls
maze.go mazegui.go
x-MacBook-Pro:maze apple$ go run mazegui.go
# command-line-arguments
./mazegui.go:40: undefined: NewDepthFirstMaze
./mazegui.go:71: undefined: Maze
./mazegui.go:94: undefined: W_NORTH
./mazegui.go:98: undefined: W_EAST
./mazegui.go:103: undefined: W_SOUTH
./mazegui.go:108: undefined: W_WEST
x-MacBook-Pro:maze apple$
i did not have a ton of time to go into why its not getting the params that the Main func setsup, but it does not respect.
About other GUI frameworks For a few days i have been using https://github.com/andlabs/ui Its pretty nice, and the people involved are very helpful. Have a look, and see what you think. Its 100% native on windows, osx and linux. Some people like that, some dont.
I have a project over here where i am building some best practice stuff around it. https://bitbucket.org/gedw99/md-desktopnative-x Its still early days. But example 02 is a good brute force test harness to show what it can do. i plan to add some other common UX patterns there. Its partly be testing it all out for stability. Also its a VERY easy go get, all you need is gcc. On OSX i needed nothing at all. On Windows, you just 64bit version of gcc.
Be aware, as you will find from the comments that the repo is a bit old. Maybe about 1 to 2 month because the libui repo. They are working on getting tree and table widgets done and then working in the go code. But there is a forked repo over at https://github.com/ProtonMail/ui, where it is being kept up to date, and will be merged back into the stable one.
I really really wanted to use Shiny, but alas, its not ready:)
I've been adding '// +build example' in the examples so some of them may need 'go build -tags 'example'" to build.
For the maze, because it is multiple files and the second file is not in a separate package that is imported, you would have to do go run mazegui.go maze.go or just do go build && ./maze
I'll have a look at andlabs/ui later. I had discounted it initially in favor of Shiny, and missed it when I was looking a second time for an alternative after I hit a wall with Shiny.
thanks now i understand the way your examples work. maze works for me :) Its a pretty cool pattern for quick test harness stuff.
i think i should close this now. Setup now working for me. thanks for your help.
seems to have a fairly strict list of depends
i decided the lsystem demo looks like the easiest to try this out.
go 1.7 on OSX
Any chance you can update either the examples readme or the main reamd for the dependencies a bit ?
This looks pretty cool btw. The text edit using the signit.ca/graphics looks pretty cool too.