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)

@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!

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.

I have not been able to find a reliable way yet to extract this meta information ( 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