I got this to build. OpenGL support seems iffy, but if you disable that, things seem to work.
Patch: https://esp.iki.fi/qt-4.8.7.diff
Vendor build instructions: https://doc.qt.io/archives/qt-4.8/install-x11.html
Patch: https://esp.iki.fi/qt-4.8.7.diff
Vendor build instructions: https://doc.qt.io/archives/qt-4.8/install-x11.html