Meson - 如何指定要使用的 wxgtk 版本?
Meson - How to specify which wxgtk version to use?
我正在使用 Arch Linux 并使用我从 pacman
安装的 wxgtk3
开发一个项目,我还从 [=16= 安装了 wxformbuilder
] 将 wxgtk2
作为依赖引入。当我尝试构建我的程序时,它构建得很好,但是当我尝试 运行 它时,它会抛出一条巨大的错误消息,
.
.
./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
这只是错误的一小部分..
但是如果我卸载 wxgtk2
并再次尝试 运行 我的程序,它 运行 没问题。有没有办法在 meson
中指定始终使用 wxgtk3
,这样我就不必一次又一次地卸载 wxgtk2
,因为我需要在我的系统上安装 wxformbuilder
.
编辑:
这是我的 meson.build
文件,
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)
构建项目我运行,
meson build
ninja -C build
这是存储库的 link - SampleHive
您可以将依赖项的版本指定为:
some_dep = dependency('some_dep', version : '>=1.2.3')
对于您的情况,请使用:
wx = dependency('wxwidgets', modules : ['media', 'std'], version: '>=3.0.0')
@apporv,
要构建您的项目,请执行以下操作:
cd <my_project_dir>
g++ -o <my_project_binary_name> *.cpp `/path/to/wx-config/wx-config --cxxflags --libs`
然后就这样做:
./my_project_binary
非常简单明了。
确保在 wx-config 命令周围使用背包。
刚刚检查过,AUR
中有一个 wxformbuilder-git
包将 wxgtk3
而不是 wxgtk2
作为依赖项,这样应该可以解决我的问题。
我正在使用 Arch Linux 并使用我从 pacman
安装的 wxgtk3
开发一个项目,我还从 [=16= 安装了 wxformbuilder
] 将 wxgtk2
作为依赖引入。当我尝试构建我的程序时,它构建得很好,但是当我尝试 运行 它时,它会抛出一条巨大的错误消息,
.
.
./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
这只是错误的一小部分..
但是如果我卸载 wxgtk2
并再次尝试 运行 我的程序,它 运行 没问题。有没有办法在 meson
中指定始终使用 wxgtk3
,这样我就不必一次又一次地卸载 wxgtk2
,因为我需要在我的系统上安装 wxformbuilder
.
编辑:
这是我的 meson.build
文件,
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)
构建项目我运行,
meson build
ninja -C build
这是存储库的 link - SampleHive
您可以将依赖项的版本指定为:
some_dep = dependency('some_dep', version : '>=1.2.3')
对于您的情况,请使用:
wx = dependency('wxwidgets', modules : ['media', 'std'], version: '>=3.0.0')
@apporv,
要构建您的项目,请执行以下操作:
cd <my_project_dir>
g++ -o <my_project_binary_name> *.cpp `/path/to/wx-config/wx-config --cxxflags --libs`
然后就这样做:
./my_project_binary
非常简单明了。
确保在 wx-config 命令周围使用背包。
刚刚检查过,AUR
中有一个 wxformbuilder-git
包将 wxgtk3
而不是 wxgtk2
作为依赖项,这样应该可以解决我的问题。