Tíquete #44917

Qt: -fPIC & -fPIE conflict

: 2022-06-23 21:33 Última Atualização: 2022-07-07 17:41

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
Marcos:
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
2

Details

I looked at the debian freeciv package build failure at x32: https://buildd.debian.org/status/logs.php?pkg=freeciv&ver=2.6.6-1

The problem seems to be that Qt headers there both require pic, and disallow pie. Freeciv m4/qt5.m4 correctly detects the need to add -fPIC. I think -fPIE comes from debian build hardening.

I got the build go through all right by adding logic to qt5.m4 to try to disable pie in cases where it adds pic (but in such a way that there should be no regression for any builds that require pic, but cannot disable pie for some reason)

I'll attach the patch I used in that testing (for S2_6, but likely applies to S3_0 as is - likely not to later branches with qt6 support)

Ticket History (3/9 Histories)

2022-06-23 21:33 Updated by: cazfi
  • New Ticket "Qt: -fPIC & -fPIE conflict" created
2022-06-24 08:01 Updated by: cazfi
  • Dono Update from (Nenhum) to cazfi
  • Resolução Update from Nenhum to Accepted
  • Marco Update from (Nenhum) to 3.0.3 (fechado)
Comentário

Reply To cazfi

I'll attach the patch I used in that testing (for S2_6, but likely applies to S3_0 as is - likely not to later branches with qt6 support)

Actually it applies to all branches just fine - for the Qt5 part. Which is just fine, as I rather wait to see someone to reproduce similar problem with Qt6 before applying such change to Qt6-mode builds.

The benefit of having this inside freeciv bootstrap, instead of user controlling whether PIE is set or not, is granularity. Inside qt5.m4 we apply the change to flags used only for building anything Qt-facing. User would have to disable it from the entire build.

Plan to push to all branches, including even S2_6 from which we don't expect releases any more.

2022-06-25 17:00 Updated by: cazfi
  • Resolução Update from Accepted to Nenhum
Comentário

Clang doesn't like this:

clang: error: argument unused during compilation: '-no-pie' [-Werror,-Wunused-command-line-argument!]

2022-06-25 17:09 Updated by: cazfi
Comentário

Reply To cazfi

Clang doesn't like this:
clang: error: argument unused during compilation: '-no-pie' [-Werror,-Wunused-command-line-argument!]

That configure check runs without "-Werror" even on --enable-debug, while the actual compilation has "-Werror"

2022-06-26 09:26 Updated by: cazfi
  • Resolução Update from Nenhum to Accepted
Comentário

Attached patch that does the configure check with -Werror (but does not add it to resulting flags)

2022-07-03 22:11 Updated by: cazfi
  • Estado Update from Aberto to Fechado
  • Resolução Update from Accepted to Fixed
2022-07-07 17:41 Updated by: cazfi
Comentário

Apparently I had failed to cherry-pick the corrected patch to older branches - only master branch has the -Werror fix.

Once I have an opportunity, I will push the fix immediately. 1) This is causing a build failure for clang users. 2) The change was already reviewed as what was supposed to get pushed in

(Edited, 2022-07-07 17:42 Updated by: cazfi)

Attachment File List

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login