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

mingw64 win32 compilation issue - does not accept "-O" #4873

Open
jfrench7 opened this issue Mar 10, 2025 · 0 comments
Open

mingw64 win32 compilation issue - does not accept "-O" #4873

jfrench7 opened this issue Mar 10, 2025 · 0 comments
Labels
distutils deprecation issues stemming from #4137 Needs Triage Issues that need to be evaluated for severity and status.

Comments

@jfrench7
Copy link

setuptools version

76.0

Python version

Python 3.12 and 3.13

OS

Windows 11

Additional environment information

This works fine for 64 bit compiling (win_amd64).

Description

When using the compiler=mingw64 option, the option for "-O" optimization is added automatically. When using the 32 bit compiling mode (-m32), the compiler demands -Ox, with x being an integer or alternate characters, and halts abruptly with an errro. This is not a problem with 64 bit compiling, and I was able to add an extra -O2 option by tweaking build_ext.

How to Reproduce

Create a project that calls mingw64 with the option -m32 to generate 32 bit code. Would be easier to just change -O to -O1, which is equivalent.

Other detail

gcc -shared -O -Wall -IC:\progra2\python\python313\include -IC:\progra2\python\python313\Include -c pyrho.c -o build\temp.win32-cpython-313\Release\pyrho.o "-O2 -m32"
cc1.exe: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
error: command 'C:\Program Files\mingw64\bin\gcc.EXE' failed with exit code 1

@jfrench7 jfrench7 added distutils deprecation issues stemming from #4137 Needs Triage Issues that need to be evaluated for severity and status. labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distutils deprecation issues stemming from #4137 Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant