Issues, reports or feature requests related to the GUI should be opened directly on the GUI repo
- I still think this issue should be opened here
Report
When PIE and LTO are combined, Qt applications crash at startup. See Gentoo bug 954171. You can read all the gorey details about the underlying issue (that also affected Wireshark) here. Basically, the issue is that Qt’s qcompilerdetection.h
prohibits building Qt with PIE because PIE breaks a critical assumption that Qt makes, but when a Qt application is built using LTO, the application’s -fPIE
flag overrides Qt’s -fPIC
flag and causes pieces of Qt to be optimized under the PIE model, which breaks it and causes it to segfault at runtime. The guard in qcompilerdetection.h
is powerless to detect and prevent this because it’s implemented by a preprocessor directive, and the preprocessor is not involved during LTO. To fix this, Bitcoin-Qt has to choose either LTO or PIE but not both. In Gentoo we plan to work around this for now by filtering out -flto
from the user’s flags, but it would be nicer to have an upstream solution.