Skip to content

Mac OS X install difficulties and TestWebView_LoadURI crash #26

@jimrobinson

Description

@jimrobinson

On Mac OS X 10.11.5 I only had access to webkit2gtk-4.0 via homebrew. I had to adjust:

github.com/sqs/gojs/base.go to point to javascriptcoregtk-4.0
github.com/sourcegraph/go-webkit2/webkit2/webview.go to point to webkit2gtk-4.0

I also found that it complained about missing cairo/cairo.h, though I did have that.
I tried adding cairo to the pkg-config, but that didn't help. I ended up adding a
CFLAG to point to the directory holding cairo/cairo.h:

diff --git a/webkit2/webview.go b/webkit2/webview.go
index 8249757..e335ea0 100644
--- a/webkit2/webview.go
+++ b/webkit2/webview.go
@@ -1,12 +1,13 @@
 package webkit2

+// #cgo CFLAGS: -I/usr/local/include
 // #include <stdlib.h>
 // #include <webkit2/webkit2.h>
 // #include <cairo/cairo.h>
 //
 // static WebKitWebView* to_WebKitWebView(GtkWidget* w) { return WEBKIT_WEB_VIEW(w); }
 //
-// #cgo pkg-config: webkit2gtk-3.0
+// #cgo pkg-config: cairo webkit2gtk-4.0
 import "C"

 import (

With this changes I could run "go get github.com/sourcegraph/go-webkit2/webkit2", but I find that if I run the tests it crashes:

$ go test -v
2016-05-22 20:13:08.075 webkit2.test[54277:11293251] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
=== RUN   TestSettings_EnableWriteConsoleMessagesToStdout
--- PASS: TestSettings_EnableWriteConsoleMessagesToStdout (0.18s)
=== RUN   TestSettings_AutoLoadImages
--- PASS: TestSettings_AutoLoadImages (0.00s)
=== RUN   TestSettings_SetUserAgentWithApplicationDetails
--- PASS: TestSettings_SetUserAgentWithApplicationDetails (0.00s)
=== RUN   TestDefaultWebContext
--- PASS: TestDefaultWebContext (0.00s)
=== RUN   TestWebContext_CacheModel
--- PASS: TestWebContext_CacheModel (0.00s)
=== RUN   TestWebContext_ClearCache
--- PASS: TestWebContext_ClearCache (0.00s)
=== RUN   TestNewWebView
--- PASS: TestNewWebView (0.00s)
=== RUN   TestNewWebViewWithContext
--- PASS: TestNewWebViewWithContext (0.00s)
=== RUN   TestWebView_Context
--- PASS: TestWebView_Context (0.00s)
=== RUN   TestWebView_LoadURI
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x10 pc=0x7fff9436caf1]

runtime stack:
runtime.throw(0x496bd40, 0x2a)
    /usr/local/go/src/runtime/panic.go:530 +0x90
runtime.sigpanic()
    /usr/local/go/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 28 [syscall, locked to thread]:
runtime.cgocall(0x44ae4c0, 0xc82003ae80, 0x0)
    /usr/local/go/src/runtime/cgocall.go:123 +0x11b fp=0xc82003ae58 sp=0xc82003ae28
github.com/gotk3/gotk3/gtk._Cfunc_gtk_main()
    ??:0 +0x36 fp=0xc82003ae80 sp=0xc82003ae58
github.com/gotk3/gotk3/gtk.Main()
    /Users/jimr/Library/gocode/src/github.com/gotk3/gotk3/gtk/gtk.go:866 +0x14 fp=0xc82003ae88 sp=0xc82003ae80
github.com/sourcegraph/go-webkit2/webkit2.TestWebView_LoadURI(0xc820094c60)
    /Users/jimr/Library/gocode/src/github.com/sourcegraph/go-webkit2/webkit2/webview_test.go:59 +0x269 fp=0xc82003af68 sp=0xc82003ae88
testing.tRunner(0xc820094c60, 0x4e0c5f8)
    /usr/local/go/src/testing/testing.go:473 +0x98 fp=0xc82003afa0 sp=0xc82003af68
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc82003afa8 sp=0xc82003afa0
created by testing.RunTests
    /usr/local/go/src/testing/testing.go:582 +0x892

goroutine 1 [chan receive, locked to thread]:
testing.RunTests(0x49cd408, 0x4e0c520, 0x13, 0x13, 0xc820000101)
    /usr/local/go/src/testing/testing.go:583 +0x8d2
testing.(*M).Run(0xc820057ef8, 0x8)
    /usr/local/go/src/testing/testing.go:515 +0x81
main.main()
    github.com/sourcegraph/go-webkit2/webkit2/_test/_testmain.go:94 +0x117

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 29 [IO wait]:
net.runtime_pollWait(0xa609a18, 0x72, 0xa600028)
    /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8200f6140, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8200f6140, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8200f60e0, 0x0, 0xa0a7028, 0xc82000a1c0)
    /usr/local/go/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820076128, 0x1, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820076128, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:264 +0x3d
net/http.(*Server).Serve(0xc8200b2100, 0xa608a70, 0xc820076128, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:2117 +0x129
net/http/httptest.(*Server).goServe.func1(0xc82008e660)
    /usr/local/go/src/net/http/httptest/server.go:237 +0x75
created by net/http/httptest.(*Server).goServe
    /usr/local/go/src/net/http/httptest/server.go:238 +0x58
exit status 2
FAIL    github.com/sourcegraph/go-webkit2/webkit2   0.318s
$ 2016-05-22 20:13:08.324 WebKitWebProcess[54279:11293290] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions