Search code examples
wxwidgetsmeson-build

Meson - How to specify which wxgtk version to use?


I'm using Arch Linux and working on a project using wxgtk3 which I installed from pacman, I also installed wxformbuilder from the AUR which pulls in wxgtk2 as a dependency. When I try to build my program, it builds fine, but when I try to run it, it throws a huge error message,

.
.
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxTreebook" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVListBox" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxHVScrolledWindow" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
./src/common/object.cpp(245): assert "classTable->Get(m_className) == NULL" failed in Register(): Class "wxXmlResourceHandler" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?

(SampleHive:26191): Gtk-ERROR **: 05:45:13.924: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
zsh: trace trap  ./SampleHive

this is only a small section of the error..

But if I uninstall wxgtk2 and try to run my program again, it runs fine. Is there a way to specify in meson to always use wxgtk3, so I don't have to uninstall wxgtk2 again and again, as I need wxformbuilder installed on my system.

EDIT:

This is my meson.build file,

project('SampleHive', 'cpp',
  version : '0.1',
  license : 'GPL v3',
  default_options : ['warning_level=1',
                     'cpp_std=c++11'])

src = [

  'src/App.cpp',
  'src/MainFrame.cpp',
  'src/Browser.cpp',
  'src/SettingsDialog.cpp',
  'src/TagEditorDialog.cpp',
  'src/Database.cpp',
  'src/Serialize.cpp',
  'src/TreeItemDialog.cpp',
  'src/Tags.cpp',

  ]

wx = dependency('wxwidgets', modules : ['media', 'std'])
wxsvg = dependency('libwxsvg')
taglib = dependency('taglib')
sqlite3 = dependency('sqlite3')
yaml = dependency('yaml-cpp')

wx_inc = include_directories('/usr/include/wx-3.0')

executable('SampleHive',
           sources : src,
           dependencies : [wx, wxsvg, taglib, sqlite3, yaml],
           include_directories : wx_inc)

to build the project I run,

meson build
ninja -C build

And here is the link to the repository - SampleHive


Solution

  • Just checked, there is a wxformbuilder-git package in the AUR that pulls wxgtk3 instead of wxgtk2 as the dependency so that should fix my problem.