#Unable to use webkit2gtk

18 messages · Page 1 of 1 (latest)

dense shuttle
#

I'm trying to get some fairly basic code to run with webkit2gtk, however I'm having issues linking. I cut my code down to 2 lines just to get the error ```c
#include <webkitgtk-4.0/webkit2/webkit2.h>
int main(void) { g_signal_connect(0,0,0,0); }

When I run this with `cc -lglib-2.0 -lgtk-3 -lwebkit2gtk main.c` I get an error saying ```
/usr/bin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libgtk-3.so: undefined reference to symbol 'g_signal_connect_data'
/usr/bin/ld: /lib64/libgobject-2.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I have no clue why, so if anyone could help me.

candid parrotBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

sand kernel
#

2 potential reasons that come to my mind:

  • You didn't specify the include path
  • You messed up the order (the main.c should go before the -l... commands)
dense shuttle
# sand kernel 2 potential reasons that come to my mind: - You didn't specify the include path ...

I ommited the includes for breivity although I don't see what that has to do with linking ```
-I /usr/include/glib-2.0/ -I /usr/include/webkitgtk-4.0/ -I /usr/lib/glib-2.0/include/ -I /usr/include/gtk-3.0/ -I /usr/include/cairo/ -I /usr/include/pango-1.0/ -I /usr/include/harfbuzz/ -I /usr/include/gdk-pixbuf-2.0/ -I /usr/include/graphene-1.0/ -I
/usr/lib/graphene-1.0/include/ -I /usr/include/libsoup-3.0/ -I /usr/include/atk-1.0/

I also changed the order to have `cc main.c -l...` and it dtill didn't work
jade flicker
formal tulip
#

atleast i would bet that header is for gtk 4

jade flicker
#

actually yeah that's probably why, I didn't notice the fact that gtk3 already linked to gobject

dense shuttle
formal tulip
#

actually, nevermind

#

that does appear correct

#

my pkg-config says its correct

#

but yeah, use pkg-config

#

cc $(pkg-config --cflags --libs webkit2gtk) main.c

#

it really is weird that webkit2gtk-4.0 uses gtk 3 though

candid parrotBOT
#

@dense shuttle Has your question been resolved? If so, type !solved :)

dense shuttle
#

!solved