Voronoi_Image_Manipulation
Voronoi_Image_Manipulation copied to clipboard
Unable to build on OS X Mojave 10.14.4
This might just be me being unexperienced with Go, but I'm having trouble building this on an almost clean machine.
- Installed Go from the official source: https://golang.org/doc/install?download=go1.12.5.darwin-amd64.pkg
- Cloned the repo:
git clone https://github.com/MauriceGit/Voronoi_Image_Manipulation
(into/tmp/Voronoi_Image_Manipulation
) - Got dependencies (
go get ./...
but got an error: go get: no install location for directory /tmp/Voronoi_Image_Manipulation outside GOPATH) - Tried building anyway. Got a bunch of warnings:
ld: warning: object file (/var/folders/96/r2y8ffxs7zz8k9lynb5v_fbh0000gn/T/go-link-704353261/000057.o) was built for newer OSX version (10.14) than being linked (10.8)
- Running gives a segfault:
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]
runtime stack:
runtime.throw(0x41f4b58, 0x2a)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:374 +0x4a9
runtime.asmcgocall(0x454f6d0, 0x7ffeefbffa68)
/usr/local/go/src/runtime/asm_amd64.s:639 +0x70
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x41278c0, 0xc000052d40, 0x2600043562c0)
/usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000052d10 sp=0xc000052cd8 pc=0x4004d3b
github.com/go-gl/gl/v3.3-core/gl._Cfunc_glowTexStorage2DMultisample(0x0, 0x1000009100, 0x3e800008058, 0x3e8)
_cgo_gotypes.go:18929 +0x45 fp=0xc000052d40 sp=0xc000052d10 pc=0x40cca95
github.com/go-gl/gl/v3.3-core/gl.TexStorage2DMultisample(0x1000009100, 0x3e800008058, 0x3e8)
/Users/jstsch/go/src/github.com/go-gl/gl/v3.3-core/gl/package.go:12108 +0x5f fp=0xc000052d70 sp=0xc000052d40 pc=0x40cde7f
github.com/MauriceGit/mtOpenGL.CreateTexture(0x3e8000003e8, 0x190800008058, 0x100001401, 0x100000010, 0x0)
/Users/jstsch/go/src/github.com/MauriceGit/mtOpenGL/mtOpenGL.go:204 +0x168 fp=0xc000052da8 sp=0xc000052d70 pc=0x40f6f08
github.com/MauriceGit/mtOpenGL.CreateFbo(0x43715dc, 0x43715e0, 0x3e8000003e8, 0x1000000001, 0x1450af000, 0xa00000000)
/Users/jstsch/go/src/github.com/MauriceGit/mtOpenGL/mtOpenGL.go:291 +0x12a fp=0xc000052de0 sp=0xc000052da8 pc=0x40f770a
main.prepareGLForNewTexture(0x41ea6f4, 0x12)
/tmp/Voronoi_Image_Manipulation/glView.go:596 +0x24d fp=0xc000052e90 sp=0xc000052de0 pc=0x411733d
main.InitializeRender(0xc0000d2000, 0xc00001e0e0, 0xc0, 0x41ea6f4, 0x12)
/tmp/Voronoi_Image_Manipulation/glView.go:844 +0x41d fp=0xc000052f30 sp=0xc000052e90 pc=0x411878d
main.main()
/tmp/Voronoi_Image_Manipulation/controls.go:438 +0x12b fp=0xc000052f98 sp=0xc000052f30 pc=0x41131ab
runtime.main()
/usr/local/go/src/runtime/proc.go:200 +0x20c fp=0xc000052fe0 sp=0xc000052f98 pc=0x402cb6c
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x4056631
goroutine 4 [chan receive]:
main.main.func1(0xc00001e0e0)
/tmp/Voronoi_Image_Manipulation/controls.go:432 +0x34
created by main.main
/tmp/Voronoi_Image_Manipulation/controls.go:431 +0xab
goroutine 5 [chan send]:
main.setDefaultRenderValues(0xc0000d2000)
/tmp/Voronoi_Image_Manipulation/controls.go:378 +0x41
main.createGUI(0xc000018080, 0xc0000d2000, 0xc0, 0x41ea6f4, 0x12)
/tmp/Voronoi_Image_Manipulation/controls.go:407 +0x81
created by main.main
/tmp/Voronoi_Image_Manipulation/controls.go:436 +0xf5
Any help would be appreciated. Apologies if I'm overseeing something totally obvious 😄
Hey,
I think this might (hopefully) be an easy fix. Did you setup the system GOPATH variable?
If not: Traditionally (until a very recent go version) all go-projects were located inside a unified location (wherever the $GOPATH points). So try:
mkdir $HOME/go
(or somewhere else)
export GOPATH=$HOME/go
Then copy/move the project folder inside $HOME/go and try the go get ./...
again inside the project folder.
If you like, read up on it here: https://golang.org/doc/install and here for GOPATH: https://github.com/golang/go/wiki/SettingGOPATH
Good luck and please report back :)
Hi Maurice, thanks! Unfortunately it's not working. Before, I tried building from ~/go/Voronoi_Image_Manipulation
already, since according to the docs if GOPATH
is unset it defaults to ~/go
:
If the environment variable is unset, GOPATH defaults to a subdirectory named "go" in the user's home directory ($HOME/go on Unix, %USERPROFILE%\go on Windows), unless that directory holds a Go distribution.
Also with manually setting GOPATH
, I'm getting the same errors with the linker and the segfault :(
The issue is with the usage of glTexStorage2DMultisample
. Your mtOpenG
library seems to use OpenGL 3.3 but glTexStorage2DMultisample
is only supported in OpenGL 4.3 or above. But MacOS only support OpenGL 4.1. At least this is what I have found so far. I haven't found a fix yet.
Oh, right, thanks, I must have overlooked that...
I'll have a look, If I can create a branch without the multisampling for OSX users maybe later today.
Disabling multisampling (so not using glTexStorage2DMultisample
) gets you further but it still crashes with:
2019-05-18 14:14:34.111 Voronoi_Image_Manipulation[6429:250462] get 0x0
Points: 125
fatal error: unexpected signal during runtime execution
2019-05-18 14:14:34.113 Voronoi_Image_Manipulation[6429:250462] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1570.16/Foundation/Misc.subproj/NSUndoManager.m:361
2019-05-18 14:14:34.114 Voronoi_Image_Manipulation[6429:250462] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff4bcdbcf9 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff76870a17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4bcf6a16 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff4df88e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 Foundation 0x00007fff4debbe7c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 473
5 AppKit 0x00007fff492a4f89 -[NSApplication run] + 916
6 Voronoi_Image_Manipulation 0x000000000415540b uiMain + 43
7 Voronoi_Image_Manipulation 0x0000000004055d90 runtime.asmcgocall + 112
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]
runtime stack:
runtime.throw(0x41eaeb1, 0x2a)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:374 +0x4a9
runtime.asmcgocall(0x4, 0x85)
/usr/local/go/src/runtime/asm_amd64.s:639 +0x70
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x411d040, 0xc000111c90, 0xe)
/usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000111c60 sp=0xc000111c28 pc=0x400534b
github.com/go-gl/gl/v3.3-core/gl._Cfunc_glowMemoryBarrier(0x0, 0xffffffff)
_cgo_gotypes.go:13038 +0x41 fp=0xc000111c90 sp=0xc000111c60 pc=0x40cb361
github.com/go-gl/gl/v3.3-core/gl.MemoryBarrier(...)
/Users/erik/src/github.com/go-gl/gl/v3.3-core/gl/package.go:10881
main.recalculateDelaunayTriangulation()
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:475 +0x409 fp=0xc000111e60 sp=0xc000111c90 pc=0x410dcf9
main.mainLoop(0xc0000da000)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:765 +0xda fp=0xc000111e90 sp=0xc000111e60 pc=0x411077a
main.InitializeRender(0xc0000d4000, 0xc000068070, 0xc0, 0x41e0d0f, 0x12)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:846 +0x42b fp=0xc000111f30 sp=0xc000111e90 pc=0x4110d6b
main.main()
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:438 +0x12b fp=0xc000111f98 sp=0xc000111f30 pc=0x410b77b
runtime.main()
/usr/local/go/src/runtime/proc.go:200 +0x20c fp=0xc000111fe0 sp=0xc000111f98 pc=0x402cdbc
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000111fe8 sp=0xc000111fe0 pc=0x40565f1
goroutine 4 [chan receive]:
main.main.func1(0xc000068070)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:432 +0x34
created by main.main
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:431 +0xab
goroutine 5 [syscall]:
github.com/andlabs/ui._Cfunc_uiMain()
_cgo_gotypes.go:2508 +0x41 fp=0xc000044738 sp=0xc000044708 pc=0x40a8661
github.com/andlabs/ui.Main(0x41ec790, 0x41ecca0, 0xc000016080)
/Users/erik/src/github.com/andlabs/ui/main.go:41 +0xff fp=0xc000044788 sp=0xc000044738 pc=0x40ac89f
main.createGUI(0xc000016080, 0xc0000d4000, 0xc0, 0x41e0d0f, 0x12)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:409 +0x91 fp=0xc0000447b8 sp=0xc000044788 pc=0x410b5d1
created by main.main
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:436 +0xf5
SIGABRT: abort
PC=0x7fff781d92c6 m=8 sigcode=0
goroutine 0 [idle]:
runtime: unknown pc 0x7fff781d92c6
stack: frame={sp:0x700002eb64d8, fp:0x0} stack=[0x700002e382b0,0x700002eb7eb0)
0000700002eb63d8: 0000000000000000 0000000000000080
0000700002eb63e8: 0000700002eb6810 0000000000000000
0000700002eb63f8: 00000000044d9000 0000700002eb6430
0000700002eb6408: 0000700002eb6440 0000000000000000
0000700002eb6418: 00007fffab0976b8 0000000000000000
0000700002eb6428: 0000000032aaaba2 0000000000000000
0000700002eb6438: 0000700002eb6570 0000000000000000
0000700002eb6448: 0000000032aaaba2 0000000000000000
0000700002eb6458: 0000000000000000 0000000000000000
0000700002eb6468: 0000000000000000 0000000000000000
0000700002eb6478: 0000000000000000 0000000000000000
0000700002eb6488: 0000000000000003 0000000000000000
0000700002eb6498: 0000000000000000 0000000000000000
0000700002eb64a8: 0000000000000000 00007fffab09c328
0000700002eb64b8: 00007fffab0989a8 00007fff78122bb8
0000700002eb64c8: 0000000000000000 0000700002eb6510
0000700002eb64d8: <00007fff7828ebf1 0000700002eb8000
0000700002eb64e8: 0000700002eb6528 0000700002eb6680
0000700002eb64f8: 0000003000000008 00007fff751099c5
0000700002eb6508: 00007fffab0989a0 0000700002eb6540
0000700002eb6518: 00007fff781436a6 0000700002eb6680
0000700002eb6528: 00000030ffffffdf ffffffff751099c5
0000700002eb6538: 0000700002eb6640 0000700002eb6670
0000700002eb6548: 00007fff750fc641 0000003000000018
0000700002eb6558: 0000700002eb6680 0000700002eb6590
0000700002eb6568: 0000000000000000 0000003000000018
0000700002eb6578: 0000700002eb6680 0000700002eb6590
0000700002eb6588: 0000000000000000 0000000000000000
0000700002eb6598: 00007fff75109a20 00007fff4c01af51
0000700002eb65a8: 00007fff7687f266 00007fff4c01af5c
0000700002eb65b8: ffffffffffffffc9 0000000000000000
0000700002eb65c8: 0000000000000000 0000000000000000
runtime: unknown pc 0x7fff781d92c6
stack: frame={sp:0x700002eb64d8, fp:0x0} stack=[0x700002e382b0,0x700002eb7eb0)
0000700002eb63d8: 0000000000000000 0000000000000080
0000700002eb63e8: 0000700002eb6810 0000000000000000
0000700002eb63f8: 00000000044d9000 0000700002eb6430
0000700002eb6408: 0000700002eb6440 0000000000000000
0000700002eb6418: 00007fffab0976b8 0000000000000000
0000700002eb6428: 0000000032aaaba2 0000000000000000
0000700002eb6438: 0000700002eb6570 0000000000000000
0000700002eb6448: 0000000032aaaba2 0000000000000000
0000700002eb6458: 0000000000000000 0000000000000000
0000700002eb6468: 0000000000000000 0000000000000000
0000700002eb6478: 0000000000000000 0000000000000000
0000700002eb6488: 0000000000000003 0000000000000000
0000700002eb6498: 0000000000000000 0000000000000000
0000700002eb64a8: 0000000000000000 00007fffab09c328
0000700002eb64b8: 00007fffab0989a8 00007fff78122bb8
0000700002eb64c8: 0000000000000000 0000700002eb6510
0000700002eb64d8: <00007fff7828ebf1 0000700002eb8000
0000700002eb64e8: 0000700002eb6528 0000700002eb6680
0000700002eb64f8: 0000003000000008 00007fff751099c5
0000700002eb6508: 00007fffab0989a0 0000700002eb6540
0000700002eb6518: 00007fff781436a6 0000700002eb6680
0000700002eb6528: 00000030ffffffdf ffffffff751099c5
0000700002eb6538: 0000700002eb6640 0000700002eb6670
0000700002eb6548: 00007fff750fc641 0000003000000018
0000700002eb6558: 0000700002eb6680 0000700002eb6590
0000700002eb6568: 0000000000000000 0000003000000018
0000700002eb6578: 0000700002eb6680 0000700002eb6590
0000700002eb6588: 0000000000000000 0000000000000000
0000700002eb6598: 00007fff75109a20 00007fff4c01af51
0000700002eb65a8: 00007fff7687f266 00007fff4c01af5c
0000700002eb65b8: ffffffffffffffc9 0000000000000000
0000700002eb65c8: 0000000000000000 0000000000000000
goroutine 5 [syscall]:
runtime.cgocall(0x4116100, 0xc000044738, 0xc0000dc0d8)
/usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000044708 sp=0xc0000446d0 pc=0x400534b
github.com/andlabs/ui._Cfunc_uiMain()
_cgo_gotypes.go:2508 +0x41 fp=0xc000044738 sp=0xc000044708 pc=0x40a8661
github.com/andlabs/ui.Main(0x41ec790, 0x41ecca0, 0xc000016080)
/Users/erik/src/github.com/andlabs/ui/main.go:41 +0xff fp=0xc000044788 sp=0xc000044738 pc=0x40ac89f
main.createGUI(0xc000016080, 0xc0000d4000, 0xc0, 0x41e0d0f, 0x12)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:409 +0x91 fp=0xc0000447b8 sp=0xc000044788 pc=0x410b5d1
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000447c0 sp=0xc0000447b8 pc=0x40565f1
created by main.main
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:436 +0xf5
goroutine 1 [syscall, locked to thread]:
github.com/go-gl/gl/v3.3-core/gl._Cfunc_glowMemoryBarrier(0x0, 0xffffffff)
_cgo_gotypes.go:13038 +0x41 fp=0xc000111c90 sp=0xc000111c60 pc=0x40cb361
github.com/go-gl/gl/v3.3-core/gl.MemoryBarrier(...)
/Users/erik/src/github.com/go-gl/gl/v3.3-core/gl/package.go:10881
main.recalculateDelaunayTriangulation()
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:475 +0x409 fp=0xc000111e60 sp=0xc000111c90 pc=0x410dcf9
main.mainLoop(0xc0000da000)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:765 +0xda fp=0xc000111e90 sp=0xc000111e60 pc=0x411077a
main.InitializeRender(0xc0000d4000, 0xc000068070, 0xc0, 0x41e0d0f, 0x12)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/glView.go:846 +0x42b fp=0xc000111f30 sp=0xc000111e90 pc=0x4110d6b
main.main()
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:438 +0x12b fp=0xc000111f98 sp=0xc000111f30 pc=0x410b77b
goroutine 4 [chan receive]:
main.main.func1(0xc000068070)
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:432 +0x34
created by main.main
/Users/erik/src/github.com/MauriceGit/Voronoi_Image_Manipulation/controls.go:431 +0xab
rax 0x0
rbx 0x700002eb8000
rcx 0x700002eb64d8
rdx 0x0
rdi 0x14e03
rsi 0x6
rbp 0x700002eb6510
rsp 0x700002eb64d8
r8 0x700002eb63a0
r9 0x700002eb6570
r10 0x0
r11 0x206
r12 0x14e03
r13 0x3000000008
r14 0x6
r15 0x2d
rip 0x7fff781d92c6
rflags 0x206
cs 0x7
fs 0x0
gs 0x0
Yes, glMemoryBarrier seems to be OpenGL 4.2 according to the docs.
I guess we don't really need it anyway (was just to be sure and avoid possible weird frames). Just remove line 475 in glView.go and give it another try.
No still the seem issue. Something is going wrong with the ui lib.
It has something to do with not running ui and gl commands on the main thread but instead in a goroutine.
Did the linking work when building? It looks like the the ui crashes when trying to first call the C function over ffi.
The gl commands should run on the main thread here (at least my ones and all GLFW event handlings).
The ui is indeed running inside a go-routine. But was never an issue (at least on Linux and Windows not)
The ui also needs to run in the main thread. When I do this it works by putting createGUI
in the functionChannel
. Of course it then does nothing as it can't process any commands. But at least it starts and shows the UI.
I think to make this work requires quite a rewrite of your main loops.
... That's really annoying. I'm sorry it seems to be that complicated to get it working (Couldn't really test it with OSX).
If you can think about a good design for the both windows (ui + glfw), I am open to suggestions/discussions or pull-requests. Preferably a short discussion before you spend too much work on a pull-request (if you like to help here -- no hard feelings if not).
I'm afraid I don't have the time to work on this.
I'm happy to test any new releases on OS X, but my Go knowledge is nonexistent unfortunately :smile:
Alright, let's keep this open, maybe I'll find some time or have an idea to remodel the main loop and keep both windows in the main thread!