Meson - How to specify which wxgtk version to use?
by apoorv569 from LinuxQuestions.org on (#5FKWT)
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,
Code:.
.
./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 ./SampleHivethis 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, both wxgtk3 and wxgtk2 are same versions, i.e 3.0.5, I want to specify if it should use wx-config-gtk3 which is wxgtk3 or wx-config which is wxgtk2.
Meson wxWidgets
This is my meson.build file,
Code: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,
Code:meson build
ninja -C buildAnd here is the link to the repository - SampleHive


Code:.
.
./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 ./SampleHivethis 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, both wxgtk3 and wxgtk2 are same versions, i.e 3.0.5, I want to specify if it should use wx-config-gtk3 which is wxgtk3 or wx-config which is wxgtk2.
Meson wxWidgets
This is my meson.build file,
Code: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,
Code:meson build
ninja -C buildAnd here is the link to the repository - SampleHive