wxWebView Ubuntu build issue Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
house20101
In need of some credit
In need of some credit
Posts: 2
Joined: Mon Jan 17, 2022 3:52 am

wxWebView Ubuntu build issue

Post by house20101 »

Hello everyone. Cannot figure out how to deal with the issue. I have Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-44-generic x86_64) installed, then I installed these libraries:
sudo apt-get install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
After have built wxWidgets as
../configure --enable-monolithic --disable-tests --disable-shared --disable-sys-libs --with-gtk=3 --disable-optimise --enable-debug
make -j6
After the build completed I've built minimal sample project as
g++ ../samples/minimal/minimal.cpp `./wx-config --cxxflags --libs` -o my_gui_app
./my_gui_app
And it all worked great on Ubuntu and MacOS. Then I've added using wxWebView class to this sample project and successfully run it on MacOS, but cannot build for Ubuntu OS. There is the long list of errors:
/usr/bin/ld: lib/libwx_gtk3u-3.1.a(monolib_webview_webkit2.o): in function `wxGetStringFromJSResult(_WebKitJavascriptResult*, wxString*)': ../src/gtk/webview_webkit2.cpp:37: undefined reference to `webkit_javascript_result_get_global_context'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:38: undefined reference to `webkit_javascript_result_get_value'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:43: undefined reference to `JSValueIsObject'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:44: undefined reference to `JSValueCreateJSONString'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:45: undefined reference to `JSValueToStringCopy'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:52: undefined reference to `JSValueToStringCopy'
/usr/bin/ld: lib/libwx_gtk3u-3.1.a(monolib_webview_webkit2.o): in function `wxgtk_webview_webkit_navigation': ../src/gtk/webview_webkit2.cpp:108: undefined reference to `webkit_navigation_policy_decision_get_type'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:109: undefined reference to `webkit_navigation_policy_decision_get_navigation_action'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:110: undefined reference to `webkit_navigation_action_get_request'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:111: undefined reference to `webkit_uri_request_get_uri'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:112: undefined reference to `webkit_navigation_policy_decision_get_frame_name'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:127: undefined reference to `webkit_policy_decision_ignore'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:144: undefined reference to `webkit_policy_decision_ignore'
/usr/bin/ld: lib/libwx_gtk3u-3.1.a(monolib_webview_webkit2.o): in function `wxgtk_webview_webkit_new_window': ../src/gtk/webview_webkit2.cpp:275: undefined reference to `webkit_navigation_policy_decision_get_type'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:276: undefined reference to `webkit_navigation_policy_decision_get_navigation_action'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:277: undefined reference to `webkit_navigation_action_get_request'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:278: undefined reference to `webkit_uri_request_get_uri'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:280: undefined reference to `webkit_navigation_policy_decision_get_frame_name'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:290: undefined reference to `webkit_policy_decision_ignore'
/usr/bin/ld: lib/libwx_gtk3u-3.1.a(monolib_webview_webkit2.o): in function `wxgtk_webview_webkit_uri_scheme_request_cb': ../src/gtk/webview_webkit2.cpp:380: undefined reference to `webkit_uri_scheme_request_get_scheme'
/usr/bin/ld: ../src/gtk/webview_webkit2.cpp:396: undefined reference to `webkit_uri_scheme_request_get_uri'
It seems like Ubuntu has wrong version of webkit or something like this.
Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView Ubuntu build issue

Post by doublemax »

"wxconfig --libs" only returns the standard libs, webview is not included.

Read the last paragraph from here:
https://wiki.wxwidgets.org/Wx-Config
Use the source, Luke!
house20101
In need of some credit
In need of some credit
Posts: 2
Joined: Mon Jan 17, 2022 3:52 am

Re: wxWebView Ubuntu build issue

Post by house20101 »

doublemax wrote: Mon Jan 17, 2022 7:14 am "wxconfig --libs" only returns the standard libs, webview is not included.

Read the last paragraph from here:
https://wiki.wxwidgets.org/Wx-Config
Thanks a lot! adding
`pkg-config webkit2gtk-4.0 --libs --cflags`
fixed the issue.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView Ubuntu build issue

Post by ONEEYEMAN »

Hi,
Please retain of using pkg-config.
Use wx-config instead.

Also wxWidgets have webview sample as well. No need to plat around with minimal sample.

And finally - in order to build the sample or you do is:

cd <dir_you_ran_configure_from>/samples/minimal
make

There is no need to play wx-config at all.

Thank you.
Post Reply