This issue appears on jammy because /lib is a symbolic link, and the /lib/x86_64-linux-gnu entry in the loader search path is used to find libQt6Core.
The cmake generated qconfig.cpp contains this line:
#define QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "../../"
So, prefixFromQtCoreLibraryHelper() computes prefixdir as /lib/x86_64-linux-gnu/../../
and returns /.
Note if /usr/lib/x86_64-linux-gnu had been used to find libQt6Core by the loader, then prefixFromQtCoreLibraryHelper() would have computed prefixdir as /usr/lib/x86_64-linux-gnu/../../, and returned /usr, which would have worked.
Instead of messing with the loader search path, or messing with cmake to compute QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH correctly given the loader search path, the attached patch just resolves any symbolic link so libdir becomes /usr/lib/x86_64-linux-gnu instead of /lib/x86_64-linux-gnu and prefixFromQtCoreLibraryHelper() returns /usr.
This issue appears on jammy because /lib is a symbolic link, and the /lib/x86_ 64-linux- gnu entry in the loader search path is used to find libQt6Core. LIBLOCATION_ TO_PREFIX_ PATH "../../" eLibraryHelper( ) computes prefixdir as /lib/x86_ 64-linux- gnu/../ ../ x86_64- linux-gnu had been used to find libQt6Core by the loader, then prefixFromQtCor eLibraryHelper( ) would have computed prefixdir as /usr/lib/ x86_64- linux-gnu/ ../../, and returned /usr, which would have worked.
The cmake generated qconfig.cpp contains this line:
#define QT_CONFIGURE_
So, prefixFromQtCor
and returns /.
Note if /usr/lib/
Instead of messing with the loader search path, or messing with cmake to compute QT_CONFIGURE_ LIBLOCATION_ TO_PREFIX_ PATH correctly given the loader search path, the attached patch just resolves any symbolic link so libdir becomes /usr/lib/ x86_64- linux-gnu instead of /lib/x86_ 64-linux- gnu and prefixFromQtCor eLibraryHelper( ) returns /usr.