QtWebEngine doesn't build cleanly with PIE

Description

Currently, QtWebEngine will fail to build when security flags (PIE in particular) are enabled. This is this error you will hit:

 

error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)."
_|  #  error "You must build your code with position independent code if Qt was built with -reduce-relocations. "_
|     ^~~~~

 

If you add -fPIC to the QMake flags (or set linux_fpic=1 in the gyp flags), this error will go away but the build will fail later on with linker errors due to some but not all components being built with -fPIC. I spent a bit of time on this but it will need more time for a real fix.

 

QtWebEngine bundles in many third-party libraries using gyp, and my best guess is that some of the libraries don't see the -fPIC flags, so you get a mismatch between binaries with and without -fPIC.

 

Finally, QtWebEngine currently skips the QA check for text relocations, probably do to this issue. Text relocations are going to cause performance degradation and memory more memory usage, so that's another reason to fix the issue besides security. Once the issue is fixed, we should try re-enabling the QA check, and my best guess is it will succeed.

Environment

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Priority

Created April 24, 2017 at 6:02 PM
Updated January 24, 2019 at 5:42 PM
Resolved January 24, 2019 at 5:42 PM