janet-lang / webview

Janet bindings to https://github.com/zserge/webview
MIT License
35 stars 6 forks source link

Test fails on Ubuntu 18.04 #2

Open ryanford opened 4 years ago

ryanford commented 4 years ago
$ jpm test
running test/test.janet ...
error: could not load native build/webview.so: build/webview.so: undefined symbol: gtk_window_get_type
  in native
  in <anonymous> [boot.janet] on line 1942, column 26
  in require [boot.janet] on line 1963, column 16
  in import* [boot.janet] on line 1975, column 15
  in _thunk [test/test.janet] (tailcall) on line 3, column 1
bakpakin commented 4 years ago

You need GTK-2 installed, which is admittedly an older version of GTK. Try installing webkit2gtk

felixr commented 4 years ago

I had the same issue and it seems like the order in which compiler flags are passed to gcc is not right. Try compiling the .so manually via: gcc -shared -o build/webview.so webview.c $(pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0) -fPIC -DWEBVIEW_GTK -I$(jpm show-paths | grep header|cut -d' ' -f2)

You can also check your webkit.so whether it was properly linked. If it was NOT properly linked the output of ldd build/webview.so will be very short; ie.:

        linux-vdso.so.1 (0x00007fffbcbde000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f75f97f4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f75f99f2000)

If you use the correct order like above the .so will be linked to a dozen on GTK libs.