akirakyle / emacs-webkit

An Emacs Dynamic Module for WebKit, aka a fully fledged browser inside emacs
GNU General Public License v3.0
419 stars 24 forks source link

Crash #2

Closed mina86 closed 3 years ago

mina86 commented 3 years ago
(progn
  (push (expand-file-name "~/code/emacs-webkit") load-path)
  (require 'webkit)
  (webkit "https://gnu.org/"))
$ emacs

(emacs:330215): dbind-WARNING **: 05:45:51.399: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
init webkit-module
emacs: symbol lookup error: /home/mpn/code/emacs-webkit/webkit-module.so: undefined symbol: webkit_web_view_get_type

The first warning is unrelated to emacs-webkit.

In GNU Emacs 28.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
 of 2020-11-22 built on pikus
Repository revision: 6a70a968f1a9de0c26aa483f84062d7e37ebfe1b
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure --prefix=/usr --enable-link-time-optimization --disable-acl
 --without-pop --with-x-toolkit=gtk3 --without-toolkit-scroll-bars
 --without-gpm --without-dbus --without-gsettings --without-selinux
 --without-systemd --with-x 'CFLAGS=-O2 -mtune=native -march=native
 -fstack-protector' 'CPPFLAGS=-O2 -mtune=native -march=native
 -fstack-protector''

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GLIB NOTIFY INOTIFY GNUTLS
LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB GTK3 X11 XDBE XIM MODULES
THREADS LIBSYSTEMD JSON PDUMPER LCMS2

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  form-feed-mode: t
  auto-dim-other-buffers-mode: t
  global-auto-revert-mode: t
  icomplete-mode: t
  global-num3-mode: t
  num3-mode: t
  global-whitespace-mode: t
  show-paren-mode: t
  global-flyspell-mode: t
  remember-notes-mode: t
  delete-selection-mode: t
  auto-compile-on-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Load-path shadows:
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-show hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-show
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-crypto hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-crypto
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-autoloads hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-autoloads
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-print hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-print
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-lib hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-lib
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-draft hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-draft
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-maildir-fcc hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-maildir-fcc
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-tag hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-tag
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-wash hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-wash
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-jump hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-jump
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-pkg hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-pkg
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-message hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-message
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-address hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-address
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-parser hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-parser
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-query hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-query
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-mua hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-mua
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-company hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-company
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/coolj hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/coolj
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-hello hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-hello
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-compat hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-compat
/home/mpn/.emacs.d/elpa/notmuch-20200606.1055/notmuch-tree hides /usr/share/emacs/site-lisp/elpa-src/notmuch-0.31.2/notmuch-tree

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date windmove pp
cl-print help-fns radix-tree descr-text help-mode server flyspell
form-feed hrt-c-style init face-remap auto-dim-other-buffers autorevert
filenotify icomplete num3-mode disp-table whitespace paren ispell
remember advice browse-kill-ring delsel ffap thingatpt auto-compile
packed finder-inf info package easymenu browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
early-init tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads inotify
lcms2 dynamic-setting font-render-setting cairo move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 101712 140880)
 (symbols 48 22680 15)
 (strings 32 48520 17665)
 (string-bytes 1 1286938)
 (vectors 16 18681)
 (vector-slots 8 246722 90232)
 (floats 8 53 203)
 (intervals 56 400 343)
 (buffers 984 12))
akirakyle commented 3 years ago

I think the two other pieces of info that will help me track this down are the webkitgtk version you're on and possibly also the gnu/linux distro you're on.

mina86 commented 3 years ago
bullseye/sid
$ dpkg -l |grep webkit.\*gtk
ii  libwebkit2gtk-4.0-37:amd64            2.30.1-1                        amd64        Web content engine library for GTK
ii  libwebkit2gtk-4.0-dev:amd64           2.30.1-1                        amd64        Web content engine library for GTK - development files
akirakyle commented 3 years ago

As a sanity check, could you also maybe run ldd webkit-module.so if you get the chance? I'm having trouble reproducing this but some others in emacs-devel seem to be encountering a similar issue.

oochen commented 3 years ago

ldd did not show anything. I remove the -O3 option and added -Wl,--no-as-needed, and it seems to work, at least it did not crash. But Error during redisplay: (webkit--adjust-size #<frame Google - GNU Emacs at oo-VM 0x5652e3392bf0>) signaled (webkit-module-no-fixed-widget) [2 times] and it does not show.

akirakyle commented 3 years ago

The Error during redisplay: (webkit--adjust-size #<frame Google - GNU Emacs at oo-VM 0x5652e3392bf0>) signaled (webkit-module-no-fixed-widget) is likely the issue in #12.

Let's see if -Wl,--no-as-needed` fixes the issue @mina86 is seeing as well. TBH linking is still a bit of black magic to me, so thanks @oochen for figuring out that flag!

mina86 commented 3 years ago
$ ldd webkit-module.so
    linux-vdso.so.1 (0x00007ffd65deb000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fae83151000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fae82f8c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fae8319c000)

Yep, the following fixes the crash:

diff --git a/Makefile b/Makefile
index 984bb87..d54d4fb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-parameter -O3 -fpic 
+CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-parameter -Wl,--no-as-needed -fpic
 CFLAGS += `pkg-config --cflags gtk+-3.0 webkit2gtk-4.0 --libs webkit2gtk-4.0`

 all : webkit-module.so

But then I’m getting the error.

akirakyle commented 3 years ago

Great, so now I can focus my effort on seeing what I can do about #12. @oochen I assume you're using --with-x as well and not --with-pgtk?

oochen commented 3 years ago

Yes, I heard it from you.