[Interest] how to link my own GLib build to a Qt 6.4 build?

Dennis Luehring dl.soluz at gmx.net
Thu Nov 10 08:11:06 CET 2022


Am 09.11.2022 um 11:12 schrieb Alexandru Croitor:
> Hi,
>
> Qt find glib2 using this code https://github.com/qt/qtbase/blob/dev/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
> which uses pkg-config underneath.
>
> According to https://askubuntu.com/questions/210210/pkg-config-path-environment-variable
> you can try setting the PKG_CONFIG_PATH env variable to the location of your newly installed glib.
>
> According to https://cmake.org/cmake/help/latest/module/FindPkgConfig.html#variable:PKG_CONFIG_USE_CMAKE_PREFIX_PATH
>
> it should be also possible to add a path to the CMAKE_PREFIX_PATH cache var, which will be treated as an extra pkg-config prefix. You would pass it to configure like ./qtbase/configure -debug -- -DCMAKE_PREFIX_PATH=/some/path
>
> So i would play around with those alternatives.

this works


mkdir ~/qt6_dev

# 1. build Glib with --prefix
cd ~/qt6_dev
git clone https://gitlab.gnome.org/GNOME/glib.git
cd glib
git checkout 2.72.1
cd ..
mkdir glib-build
cd glib-build
meson setup ../glib -Dbuildtype=debug --prefix ~/qt6_dev/glib-install
meson compile
meson install

# 2. build Qt with PKG_CONFIG_PATH set

cd ~/qt6_dev
git clone git://code.qt.io/qt/qt5.git qt6
cd qt6
git checkout v6.4.0
perl init-repository
cd ..
mkdir qt6-build
cd qt6-build
PKG_CONFIG_PATH=~/qt6_dev/glib-install/lib/x86_64-linux-gnu/pkgconfig
../qt6/qtbase/configure -debug -opensource -nomake examples -nomake tests
cmake --build . --parallel 2


thanks for your help


More information about the Interest mailing list