Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ditch not recommended -Wp prefixes preventing default gcc flag overwrite #3119

Conversation

kamiccolo
Copy link
Contributor

While building for Ubuntu >=24.04, noticed loads of the following:

<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition

Which can also be seen on GitHub action runs, for example here:
https://github.com/Exiv2/exiv2/actions/runs/12740529422/job/35505851531#step:5:122

Apparently, Ubuntu switched to adding _FORTIFY_SOURCE=3 by default, and extra -Wp prefix on Exiv2 code-base was preventing those defaults being overwritten.

Running on Ubuntu 24.04:

$ gcc -dM -E -O3 - < /dev/null | grep FORTIFY
#define _FORTIFY_SOURCE 3

Also, according to GCC docs, -Wp prefix is not recommended:

-Wp,option

You can use -Wp,option to bypass the compiler driver and pass option directly through to the preprocessor.
If option contains commas, it is split into multiple options at the commas. However, many options are
modified, translated or interpreted by the compiler driver before being passed to the preprocessor,
and -Wp forcibly bypasses this phase. The preprocessor’s direct interface is undocumented and
subject to change, so whenever possible you should avoid using -Wp and let the driver handle
the options instead.

https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-Wp

TL;DR: removing directive which supposed to be avoided for easier integration and cleaner build on Ubuntu >=24.04 machines (or whatever going to be crazy enough to add defaults of _FORTIFY_SOURCE=3 on distro level.

@neheb neheb merged commit a1b65bb into Exiv2:main Jan 13, 2025
58 of 59 checks passed
@kmilos
Copy link
Collaborator

kmilos commented Jan 14, 2025

Backport to 0.28x?

@kamiccolo
Copy link
Contributor Author

Backport to 0.28x?

that... probably would be nice. Still got bunch of CMake cleanups in the works waiting for the better times.... But this one was bugging me daily.

@kmilos
Copy link
Collaborator

kmilos commented Jan 14, 2025

@mergify backport 0.28.x

Copy link
Contributor

mergify bot commented Jan 14, 2025

backport 0.28.x

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake Configuration issues related with CMake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants