我下载了最新版本的 libglib2.0 2.76.3 并从源代码安装了它。
但是,当我尝试安装某些程序时,pkg-config 会找到旧版本的 glib。我该怎么办?
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib:/usr/local/include/glib-2.0/:/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig/;
sudo make clean
sudo ldconfig
sudo ./configure PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib:/usr/lib:/usr/local/include/glib-2.0/:/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig/;
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
checking for GLIB - version >= 2.0.3...
*** ''pkg-config --modversion glib-2.0' returned 2.76.3, but GLIB (2.74.6) but GLIB (2.74.6)
*** was found! If pkg-config was correct, then it is best
*** to remove the old version of GLib. You may also be able to fix the error
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is
*** required on your system.
*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH
*** to point to the correct configuration files
~/_PKGS/glib-2.76.3$ sudo ninja -C _build install
(some lines...)
Installing /_PKGS/glib-2.76.3/glib/gdir.h to /usr/local/include/glib-2.0/glib
Installing symlink pointing to libglib-2.0.so.0 to /usr/local/lib/x86_64-linux-gnu/libglib-2.0.so
dpkg -l | grep libglib2.*
ii libglib2.0-0:amd64 2.74.6-2 amd64 GLib library of C routines
ii libglib2.0-0:i386 2.74.6-2 i386 GLib library of C routines
ii libglib2.0-bin 2.74.6-2 amd64 Programs for the GLib library
ii libglib2.0-cil 2.12.45-0xamarin19+ubuntu1804b1 amd64 CLI binding for the GLib utility library 2.12
ii libglib2.0-cil-dev 2.12.45-0xamarin19+ubuntu1804b1 amd64 CLI binding for the GLib utility library 2.12
ii libglib2.0-data 2.74.6-2 all Common files for GLib library
ii libglib2.0-dev:amd64 2.74.6-2 amd64 Development files for the GLib library
ii libglib2.0-dev-bin 2.74.6-2 amd64 Development utilities for the GLib library
ii libglib2.0-doc 2.74.6-2 all Documentation files for the GLib library
ii libglib2.0-tests 2.74.6-2 amd64 GLib library of C routines - installed tests
pkg-config --debug --modversion glib-2.0
libpkgconf/dependency.c:115 [add_or_replace_dependency_node]: added dependency [glib-2.0] to list @0x7fff61922eb8; flags=0
libpkgconf/pkg.c:1562 [pkgconf_pkg_traverse]: virtual:world: level 2000
libpkgconf/pkg.c:1577 [pkgconf_pkg_traverse]: virtual:world: walking requires list
libpkgconf/pkg.c:1343 [pkgconf_pkg_verify_dependency]: trying to verify dependency: glib-2.0
libpkgconf/pkg.c:730 [pkgconf_pkg_find]: looking for: glib-2.0
libpkgconf/cache.c:62 [pkgconf_cache_lookup]: miss: glib-2.0
libpkgconf/pkg.c:568 [pkgconf_pkg_try_specific_path]: trying path: /usr/local/lib/x86_64-linux-gnu/ for glib-2.0
libpkgconf/pkg.c:568 [pkgconf_pkg_try_specific_path]: trying path: /usr/local/lib for glib-2.0
libpkgconf/pkg.c:568 [pkgconf_pkg_try_specific_path]: trying path: /usr/lib for glib-2.0
libpkgconf/pkg.c:568 [pkgconf_pkg_try_specific_path]: trying path: /usr/local/include/glib-2.0/ for glib-2.0
libpkgconf/pkg.c:568 [pkgconf_pkg_try_specific_path]: trying path: /usr/local/lib/x86_64-linux-gnu/pkgconfig for glib-2.0
libpkgconf/pkg.c:582 [pkgconf_pkg_try_specific_path]: found: /usr/local/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: pcfiledir => /usr/local/lib/x86_64-linux-gnu/pkgconfig (parsed? 1)
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: prefix => /usr/local (parsed? 1)
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: includedir => ${prefix}/include (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple prefix
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: libdir => ${prefix}/lib/x86_64-linux-gnu (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple prefix
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: bindir => ${prefix}/bin (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple prefix
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: glib_genmarshal => ${bindir}/glib-genmarshal (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple bindir
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: gobject_query => ${bindir}/gobject-query (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple bindir
libpkgconf/tuple.c:189 [pkgconf_tuple_add]: adding tuple to @0x561c35dcaaa8: glib_mkenums => ${bindir}/glib-mkenums (parsed? 1)
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple bindir
libpkgconf/dependency.c:115 [add_or_replace_dependency_node]: added dependency [libpcre2-8 >= 10.32] to list @0x561c35dcaa60; flags=0
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple libdir
libpkgconf/fragment.c:676 [pkgconf_fragment_parse]: post-subst: [-L${libdir} -lglib-2.0] -> [-L/usr/local/lib/x86_64-linux-gnu -lglib-2.0]
libpkgconf/fragment.c:147 [pkgconf_fragment_add]: added fragment {L, '/usr/local/lib/x86_64-linux-gnu'} to list @0x561c35dca9e8
libpkgconf/fragment.c:147 [pkgconf_fragment_add]: added fragment {l, 'glib-2.0'} to list @0x561c35dca9e8
libpkgconf/fragment.c:676 [pkgconf_fragment_parse]: post-subst: [-lm -pthread] -> [-lm -pthread]
libpkgconf/fragment.c:147 [pkgconf_fragment_add]: added fragment {l, 'm'} to list @0x561c35dcaa00
libpkgconf/fragment.c:196 [pkgconf_fragment_add]: created special fragment {'-pthread'} in list @0x561c35dcaa00
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple includedir
libpkgconf/tuple.c:296 [pkgconf_tuple_parse]: lookup tuple libdir
libpkgconf/fragment.c:676 [pkgconf_fragment_parse]: post-subst: [-I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include] -> [-I/usr/local/include/glib-2.0 -I/usr/local/lib/x86_64-linux-gnu/glib-2.0/include]
libpkgconf/fragment.c:147 [pkgconf_fragment_add]: added fragment {I, '/usr/local/include/glib-2.0'} to list @0x561c35dcaa18
libpkgconf/fragment.c:147 [pkgconf_fragment_add]: added fragment {I, '/usr/local/lib/x86_64-linux-gnu/glib-2.0/include'} to list @0x561c35dcaa18
libpkgconf/dependency.c:115 [add_or_replace_dependency_node]: added dependency [glib-2.0 = 2.76.3] to list @0x561c35dcaa90; flags=0
libpkgconf/pkg.c:531 [pkgconf_pkg_ref]: refcount@0x561c35dca990: 1
libpkgconf/pkg.c:531 [pkgconf_pkg_ref]: refcount@0x561c35dca990: 2
libpkgconf/cache.c:87 [pkgconf_cache_add]: added @0x561c35dca990 to cache
libpkgconf/pkg.c:531 [pkgconf_pkg_ref]: refcount@0x561c35dca990: 3
libpkgconf/pkg.c:1562 [pkgconf_pkg_traverse]: glib-2.0: level 1999
libpkgconf/pkg.c:1577 [pkgconf_pkg_traverse]: glib-2.0: walking requires list
libpkgconf/pkg.c:554 [pkgconf_pkg_unref]: refcount@0x561c35dca990: 2
libpkgconf/pkg.c:554 [pkgconf_pkg_unref]: refcount@0x561c35dca990: 1
libpkgconf/dependency.c:115 [add_or_replace_dependency_node]: added dependency [glib-2.0] to list @0x7fff61922eb8; flags=0
libpkgconf/pkg.c:1562 [pkgconf_pkg_traverse]: virtual:world: level 2000
libpkgconf/pkg.c:1577 [pkgconf_pkg_traverse]: virtual:world: walking requires list
libpkgconf/pkg.c:1343 [pkgconf_pkg_verify_dependency]: trying to verify dependency: glib-2.0
libpkgconf/pkg.c:730 [pkgconf_pkg_find]: looking for: glib-2.0
libpkgconf/cache.c:57 [pkgconf_cache_lookup]: found: glib-2.0 @0x561c35dca990
libpkgconf/pkg.c:531 [pkgconf_pkg_ref]: refcount@0x561c35dca990: 2
libpkgconf/pkg.c:762 [pkgconf_pkg_find]: glib-2.0 is cached
libpkgconf/pkg.c:531 [pkgconf_pkg_ref]: refcount@0x561c35dca990: 3
libpkgconf/pkg.c:1562 [pkgconf_pkg_traverse]: glib-2.0: level 1999
libpkgconf/pkg.c:1577 [pkgconf_pkg_traverse]: glib-2.0: walking requires list
libpkgconf/pkg.c:554 [pkgconf_pkg_unref]: refcount@0x561c35dca990: 2
2.76.3
libpkgconf/pkg.c:554 [pkgconf_pkg_unref]: refcount@0x561c35dca990: 1
libpkgconf/client.c:180 [pkgconf_client_deinit]: deinit @0x561c341b8820
libpkgconf/pkg.c:554 [pkgconf_pkg_unref]: refcount@0x561c35dca990: 0
libpkgconf/cache.c:113 [pkgconf_cache_remove]: removed @0x561c35dca990 from cache
libpkgconf/cache.c:142 [pkgconf_cache_free]: cleared package cache
sudo medit /usr/local/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
prefix=/usr/local
includedir=${prefix}/include
libdir=${prefix}/lib/x86_64-linux-gnu
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.76.3
Requires.private: libpcre2-8 >= 10.32
Libs: -L${libdir} -lglib-2.0
Libs.private: -lm -pthread
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
locate glib-2.0.pc
/usr/lib/pkgconfig/dbus-sharp-glib-2.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
/usr/local/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
sudo medit /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
prefix=/usr
includedir=${prefix}/include
libdir=${prefix}/lib/x86_64-linux-gnu
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.74.6
Requires.private: libpcre2-8 >= 10.32
Libs: -L${libdir} -lglib-2.0
Libs.private: -pthread -lm
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
答案1
我非常感谢 Debian 开发人员帮助我修复系统中的混乱。
发生了什么:使用时apt policy
,发现存在许多不同的 Linux 发行版。我不知道这会产生问题。我有 ubuntu、debian olds 和 debian bookworm。
- 第一步:删除所有我不想要的发行版并在源列表中仅保留一个
/etc/apt/sources.list
。 - 第二步:删除/user/local/下的所有文件夹/文件財產協會 油嘴滑舌
- 第三步:
apt update
apt upgrade
apt disto-upgrade
apt full-upgrade
- 第四步:
apt-get install -f -o Dpkg::Options::="--force-overwrite" PACKAGENAME
如果遇到 dpkg 错误问题,请保留覆盖文件的记录。
感谢 (linux) Debian 开发人员!继续保持开源良好发展!:)