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

Redefinition of _FORTIFY_SOURCE #430

Closed
VorpalBlade opened this issue Apr 28, 2024 · 2 comments
Closed

Redefinition of _FORTIFY_SOURCE #430

VorpalBlade opened this issue Apr 28, 2024 · 2 comments

Comments

@VorpalBlade
Copy link

On recent Arch Linux, packages are by default built with:

CFLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection \
        -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"

This causes the following error when building greaseweazle:

* Building wheel...
running bdist_wheel
running build
running build_py
copying src/greaseweazle/__init__.py -> build/lib.linux-x86_64-cpython-312/greaseweazle
running build_ext
building 'greaseweazle.optimised.optimised' extension
gcc -fno-strict-overflow -DNDEBUG -g -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -flto=auto -fPIC -I/usr/include/python3.12 -c src/greaseweazle/optimised/c64.c -o build/temp.linux-x86_64-cpython-312/src/greaseweazle/optimised/c64.o -Wall -Werror
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1

This is because you use the following in your setup.py:

extra_compile_args = ['-Wall', '-Werror']

I'm not sure what the best way forward is. I'm also not sure where the additional -D_FORTIFY_SOURCE=2 comes from, maybe it is something from setuptools itself? I could of course patch greazeweasle in my Arch Linux package to remove the -Werror but that isn't great either,

@keirf
Copy link
Owner

keirf commented Apr 28, 2024

I think patching the -Werror is okay. It shouldn't affect the generated code after all. Maybe longer term we can work out something neater.

@keirf
Copy link
Owner

keirf commented Apr 29, 2024

Closing this ticket. External patching as part of distro packaging is an appropriate solution here, imo.

@keirf keirf closed this as completed Apr 29, 2024
CoelacanthusHex added a commit to archlinuxcn/repo that referenced this issue May 31, 2024
Upstream prefer vendored patch in downstream.
See keirf/greaseweazle#430

Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants