Open vaibhavsagar opened 5 years ago
Current nixpkgs
uses webkit-gtk-2.22
. I wonder if jsaddle-webkit2gtk
is not based on previous version (and API?)
This affects me too. Seems to be caused by the lack of said GlobalContext
in gi-javascriptcore-4.0.16
(it is present in 4.0.15 though!)
I am also experiencing this.
Me too. Using 4.0.15 only changes the error to -
GI/JavaScriptCore/Objects/Exception.hs:120:1: error:
Could not find module ‘GI.GObject.Objects.Object’
This builds (and so do lots of transitive dependent packages), but I haven't tested it: https://github.com/ryantrinkle/jsaddle/tree/no-global-context
Thank your for looking into it, @ryantrinkle. I've built a "hello world" reflex app (built with Stack though, not Nix) using jsaddle from above branch; it shows empty window then segfaults in libjavascriptcoregtk
:
$ coredumpctl gdb
PID: 27757 (reflex-stack-ex)
UID: 1000 (develop7)
GID: 100 (users)
Signal: 11 (SEGV)
Timestamp: Mon 2019-04-29 22:52:36 +03 (19min ago)
Command Line: /home/develop7/projects/reflex-stack/.stack-work/install/x86_64-linux-tinfo6/lts-12.26/8.4.4/bin/reflex-stack-exe
Executable: /home/develop7/projects/reflex-stack/.stack-work/install/x86_64-linux-tinfo6/lts-12.26/8.4.4/bin/reflex-stack-exe
Control Group: /user.slice/user-1000.slice/session-2.scope
Unit: session-2.scope
Slice: user-1000.slice
Session: 2
Owner UID: 1000 (develop7)
Boot ID: 34ad9b77fbf44d83a582ae08838287e4
Machine ID: f7d12f47fb5c49979f8d99a60666bab2
Hostname: t-rex
Storage: /var/lib/systemd/coredump/core.reflex-stack-ex.1000.34ad9b77fbf44d83a582ae08838287e4.27757.1556567556000000.lz4
Message: Process 27757 (reflex-stack-ex) of user 1000 dumped core.
Stack trace of thread 27757:
#0 0x00007fae3b35b763 _ZN3JSC12JSLockHolderC2ERNS_2VME (libjavascriptcoregtk-4.0.so.18)
#1 0x00007fae3a9e7bad JSValueToStringCopy (libjavascriptcoregtk-4.0.so.18)
#2 0x00000000004a9de6 n/a (/home/develop7/projects/reflex-stack/.stack-work/install/x86_64-linux-tinfo6/lts-12.26/8.4.4/bin/reflex-stack-exe)
…skip…
Program terminated with signal SIGSEGV, Segmentation fault.
#0 std::__atomic_base<unsigned int>::operator++ () at /usr/include/c++/8/bits/atomic_base.h:296
296 { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); }
[Current thread is 1 (Thread 0x7fae3a3bdb00 (LWP 27757))]
(gdb) bt
#0 0x00007fae3b35b763 in std::__atomic_base<unsigned int>::operator++() () at /usr/include/c++/8/bits/atomic_base.h:296
#1 0x00007fae3b35b763 in WTF::ThreadSafeRefCountedBase::ref() const () at DerivedSources/ForwardingHeaders/wtf/ThreadSafeRefCounted.h:43
#2 0x00007fae3b35b763 in WTF::refIfNotNull<JSC::VM>(JSC::VM*) () at DerivedSources/ForwardingHeaders/wtf/RefPtr.h:38
#3 0x00007fae3b35b763 in WTF::RefPtr<JSC::VM, WTF::DumbPtrTraits<JSC::VM> >::RefPtr(JSC::VM*) () at DerivedSources/ForwardingHeaders/wtf/RefPtr.h:57
#4 0x00007fae3b35b763 in JSC::JSLockHolder::JSLockHolder(JSC::VM&) () at ../Source/JavaScriptCore/runtime/JSLock.cpp:64
#5 0x00007fae3a9e7bad in JSValueToStringCopy() () at ../Source/JavaScriptCore/API/JSValueRef.cpp:432
#6 0x00000000004a9de6 in ()
#7 0x0000000004b17d68 in ()
#8 0x0000000001e93ed8 in ()
#9 0x0000000000000000 in ()
Hope that helps making further progress.
@develop7 Ah, looks like I guessed wrong about GlobalContext and Context being sufficiently interchangeable. Maybe @hamishmack has an idea?
I think the first step is to create a Haskell library to wrap the new jsc-glib library that is now in webkitgtk. This new haskell library would take the place of the webkit2-javascriptcore that jsaddle-webkit2gtk
currently uses.
Unfortunately I don't think jsc-glib has gobject introspection (though I would love to be proved wrong on that). Hopefully once we have that we can replace the code that currently calls C functions like JSValueToStringCopy
with code that calls the new C functions like jsc-value-to-string-as-bytes.
I think we should avoid any dependency on gtk2hs-buildtools
and instead use a more standard tool like hsc2hs
. The gi-cairo-render package might be a useful place to look for ideas and @cohomology might have some good tips on how to create a haskell bindings for a C library with good haskell-gi interop.
Another option is to add FFI imports for just the jsc-glib functions we need in line in the jsaddle-webkit2gtk code (that might be less work, but it would suck a little).
I think #96 fixes this by avoiding global context entirely. I was able to build and run reflex-todomvc with that patch.
This is so exciting! Maybe we can finally get servant-client-jsaddle
over the finish line :smile:.
I think #96 fixes this by avoiding global context entirely. I was able to build and run reflex-todomvc with that patch.
yup, that does it — just got reflex "hello world" running in webkitgtk. Thanks, man!
It looks like
GI.JavaScriptCore
andGI.WebKit2
have changed in incompatible ways:To reproduce, use this
default.nix
: