Link error to wxgtk3 from the official repo, why?

Source Code


cmake_minimum_required(VERSION 3.20)

    VERSION 1.0

find_package(wxWidgets REQUIRED)


add_executable(${PROJECT_NAME} source/main.cpp)

target_link_libraries(${PROJECT_NAME} PRIVATE ${wxWidgets_LIBRARIES})


#include <iostream>
#include <wx/wx.h>

int main()
    wxString wxs(wxT("Hello"));
    const wxScopedCharBuffer buf = wxs.ToUTF8 ();
    std::string s(, buf.length());
    std::cout << s << std::endl;

    return 0;

Build failed when using wxgtk3 from the official repo

$ cmake <folder_path_for_CMakeLists.txt> -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-gtk3 -DCMAKE_BULD_TYPE=Debug
$ cmake --build .
[build] /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib/ undefined reference to `webkit_web_view_go_back'
[build] /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib/ undefined reference to `webkit_web_view_go_forward'

Build succeeded when using wxwidget that is built manually

$ cmake <folder_path_for_CMakeLists.txt> -DwxWidgets_CONFIG_EXECUTABLE=/opt/wxWidgets/bin/wx-config -DCMAKE_BULD_TYPE=Debug
$ cmake --build .

Have you checked the difference between the two generated Makefile/ files?

I have found the reason, after installing webkit2gtk in the official repo, it works.
I think it should be installed along with wxgtk3, right?

@Aragorn Nothing about AUR, why moved to AUR?

I’ve moved it to #support:applications now. But it either way has nothing to do with #support:programming.

1 Like

I don’t know, is it a missing dependency in whatever you’re building? You never did say what it was.

It should be a missing dependency, by default it failed to link for the most basic usage of wxwidgets.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.