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

Work around Qt6 crash involving LTO #880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keithel
Copy link

@keithel keithel commented Aug 2, 2023

If link time optimization is enabled in a Qt 6 build of qapitrace, signals are not properly connected, and a crash occurs.

Somehow an interaction between the image library and Qt, along with the INTERPROCEDURAL_OPTIMIZATION CMake setting causes this behavior.

Simply disabling link time optimization by setting the INTERPROCEDURAL_OPTIMIZATION qapitrace target property to false fixes the issue.

If link time optimization is enabled in a Qt 6 build of qapitrace,
signals are not properly connected, and a crash occurs.

Somehow an interaction between the `image` library and Qt, along with
the `INTERPROCEDURAL_OPTIMIZATION` CMake setting causes this behavior.

Simply disabling link time optimization by setting the
`INTERPROCEDURAL_OPTIMIZATION` qapitrace target property to false fixes
the issue.
@okias
Copy link
Contributor

okias commented Aug 3, 2023

I would wait a bit with merging something like this, since other possible solutions are proposed in https://bugreports.qt.io/browse/QTBUG-115731 .

In worst case it would be nice if it would be guarded by Qt 6 checks.

@keithel
Copy link
Author

keithel commented Aug 3, 2023

Actually -- I get this even with Qt5 builds with the compiler, linker and glibc I use. But yeah, I can see waiting until we know more about the underlying issue. It's likely this will just be closed on the Qt side as a compiler issue.

@keithel
Copy link
Author

keithel commented Aug 3, 2023

@okias could you verify that my proposed fix works for you (avoids the crash, and allows signals to be connected properly, and the UI to be functional) ?

I want to make sure it isn't just a weird environment issue in my case - given that the Qt R&D folks are saying that it is due to a design flaw in the ABI of x86_64, corrected by gcc 12+binutils 2.36..

@okias
Copy link
Contributor

okias commented Aug 4, 2023

I would prefer the workaround to be applied only where necessary, such as detecting or defining broken configurations. If it's not easily possible, then I suppose I would be okay with it as it is.

@keithel
Copy link
Author

keithel commented Aug 4, 2023

It sounds like this may be fixed in Qt by some changes in the cmake rules, as it appears that adding -fPIC to the linker line fixes the problem - according to Alexandru Croitor. I think we just let this PR sit until QTBUG-115731 is fixed or otherwise closed. I'll make narrower changes when it is more clear as to what to do.

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