![如何在 Ubuntu 22.04 上安装 glibmm-2.68](https://linux22.com/image/954113/%E5%A6%82%E4%BD%95%E5%9C%A8%20Ubuntu%2022.04%20%E4%B8%8A%E5%AE%89%E8%A3%85%20glibmm-2.68.png)
我正在尝试在 Ubuntu 22.04 上为 C++ 安装 GTK4/GTKMM4,但是我卡在第 3 步,也可能是第 2 步。
我遵循以下说明: https://terminalroot.com/how-to-install-gtkmm-4-on-ubuntu-2204/
如果您不想点击该链接,请按照以下步骤操作:
步骤1: sudo apt install build-essential git g++ autotools-dev libgtkmm-3.0-dev \
libgtkmm-3.0-doc mm-common libgtk-4-bin \
libgtk-4-common libgtk-4-dev libgtk-4-doc pkg-config
运行无误
第2步: wget ftp://ftp.acc.umu.se/pub/gnome/sources/libsigc++/3.0/libsigc++-3.0.7.tar.xz
tar Jxvf libsigc++-3.0.7.tar.xz
cd libsigc++-3.0.7/
./autogen.sh --prefix=/usr/local
make
sudo make install
make 运行无错误
这是 sudo make install,安装部分(注意文件名:sigc++-3.0.pc 和 libsigc-3.0.so.2.99.1):
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/sigc++-3.0/include/sigc++config.h
-- Installing: /usr/local/lib/pkgconfig/sigc++-3.0.pc
-- Installing: /usr/local/lib/cmake/sigc++-3/sigc++-3Config.cmake
-- Installing: /usr/local/lib/cmake/sigc++-3/sigc++-3ConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/sigc++-3/sigc++-3Targets.cmake
-- Installing: /usr/local/lib/cmake/sigc++-3/sigc++-3Targets-noconfig.cmake
-- Up-to-date: /usr/local/include/sigc++-3.0/sigc++
-- Installing: /usr/local/include/sigc++-3.0/sigc++/connection.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/limit_reference.h
-- Up-to-date: /usr/local/include/sigc++-3.0/sigc++/functors
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/ptr_fun.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/mem_fun.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/functor_trait.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/slot_base.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/.libs
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/.deps
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/slot.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/functors/functors.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/trackable.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/retype_return.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/.libs
-- Installing: /usr/local/include/sigc++-3.0/sigc++/CMakeFiles
-- Installing: /usr/local/include/sigc++-3.0/sigc++/CMakeFiles/sigc-3.0.dir
-- Installing: /usr/local/include/sigc++-3.0/sigc++/CMakeFiles/sigc-3.0.dir/functors
-- Installing: /usr/local/include/sigc++-3.0/sigc++/bind_return.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/sigc++.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/signal.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/weak_raw_ptr.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/signal_base.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/visit_each.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/.deps
-- Installing: /usr/local/include/sigc++-3.0/sigc++/member_method_trait.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/reference_wrapper.h
-- Up-to-date: /usr/local/include/sigc++-3.0/sigc++/adaptors
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/adaptor_trait.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/retype.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/tuple_visitor_visit_each.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/exception_catch.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/compose.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/adapts.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/adaptor_base.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/retype_return.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/bind_return.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/bound_argument.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/track_obj.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/hide.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/adaptors.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/adaptors/bind.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/type_traits.h
-- Up-to-date: /usr/local/include/sigc++-3.0/sigc++/tuple-utils
-- Installing: /usr/local/include/sigc++-3.0/sigc++/tuple-utils/tuple_end.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/tuple-utils/tuple_transform_each.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/tuple-utils/tuple_for_each.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/tuple-utils/tuple_cdr.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/tuple-utils/tuple_start.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/slot.h
-- Installing: /usr/local/include/sigc++-3.0/sigc++/bind.h
-- Installing: /usr/local/lib/libsigc-3.0.so.2.99.1
-- Installing: /usr/local/lib/libsigc-3.0.so.0
-- Installing: /usr/local/lib/libsigc-3.0.so
步骤3: wget https://download.gnome.org/sources/glibmm/2.68/glibmm-2.68.2.tar.xz
tar Jxvf glibmm-2.68.2.tar.xz
cd glibmm-2.68.2/
./autogen.sh --prefix=/usr
make
sudo make install
运行./autogen.sh --prefix=/usr
,出现错误,提示找不到 sigc++。它建议设置 PKG_CONFIG_PATH。它在某处要求提供 .pc 文件,因此我找到了步骤 2 中的 sigc++-3.0.pc 行并设置:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/sigc++-3.0.pc
然后我又跑了./autogen.sh --prefix=/usr
以下是有趣的部分:
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for sigc++-3.0 >= 3.0.0 glib-2.0 >= 2.63.0 gobject-2.0 >= 2.63.0 gmodule-2.0 >= 2.63.0... no
configure: error: Package requirements (sigc++-3.0 >= 3.0.0 glib-2.0 >= 2.63.0 gobject-2.0 >= 2.63.0 gmodule-2.0 >= 2.63.0) were not met:
Requested 'sigc++-3.0 >= 3.0.0' but version of libsigc++ is 2.99.1
为什么 sigc 要添加 2.99?“-- 安装:/usr/local/lib/libsigc-3.0.so.2.99.1”