Compile your code with -fPIC (-fPIE is not enough).
The compiler flags for gcc >= 5.0 are missing -fPIC which is required by Qt when building with -DCMAKE_POSITION_INDEPENDENT_CODE=ON.
Dicussion and workaround: https://github.com/qgis/QGIS/pull/6093#issuecomment-393518711