Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support relocatable builds of Qt{5,6} #306

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kevle
Copy link

@kevle kevle commented Sep 16, 2024

This PR resolves a problem that leads to corrupted Qt core library files, by detecting relocatable builds of Qt and only conditionally patching the shared library files.

See #302 (comment)

@kevle kevle force-pushed the qtprefixpath-handling branch from e788c85 to d1edb3d Compare September 16, 2024 15:12
@kevle kevle force-pushed the qtprefixpath-handling branch from d1edb3d to 28498fa Compare September 16, 2024 15:18
@probonopd
Copy link
Owner

Thank you very much @kevle.

Copy link

Build for testing:
artifacts
Use at your own risk.

@probonopd
Copy link
Owner

Would be great if someone could test whether this build fixes the issue. Thank you very much!

@probonopd probonopd mentioned this pull request Sep 16, 2024
qtPrefixPathRequiresPatch = false
// Directory should be in ../Qt${qtVersion}
// TODO: Check if this is true for relocatable binaries in Qt5
qt_prfxpath = filepath.Dir(library) + fmt.Sprintf("/../Qt%d", qtVersion)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this case on Arch Linux.
I have /usr/lib/libQt6Core.so but directory on /usr/lib/qt6. And qt_prfxpath is really empty.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Before applying this patch, it cannot work on Arch Linux either. So it is not a regression.

Copy link
Author

@kevle kevle Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing it, I'll see if I can fix it.

This appears to be the place where the path is configured on Arch:
https://github.com/archlinux/svntogit-packages/blob/5b5e6ab5ccc29af668f41d05ec1fb8e9f8f99595/qt6-base/repos/extra-x86_64/PKGBUILD#L48

@kevle
Copy link
Author

kevle commented Oct 24, 2024

From the looks of it, there is no way around loading libQtCore{5,6}.so and querying its configuration using QLibraryInfo::location ( Qt5 ) and QLibraryInfo::path ( Qt6 ) to properly handle all cases.

This might be possible by using SWIG to generate a wrapper to load libQt{5,6}Core.so.
Sometimes the function qt_core_boilerplate appears to be exported with C-linkage, however this does not appear to be the case on my Fedora install.

I have not been able to find a reliable way to extract this meta information yet ( e.g. from embedded resource files ) any other way. This would be pretty bad news for cross-compilation though, I'm not looking forward to doing qemu shenanigans just to query some paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants