python / python/cpython

Build uses wrong flags with gcc: `gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?`

Open
#132,181 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build OS-mac type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Build fails on macOS with gcc when profile option is enabled, since the build uses unsupported flags without checking:

Building with support for profile generation:
/Library/Developer/CommandLineTools/usr/bin/make build_all CFLAGS_NODIST=" -fprofile-instr-generate" LDFLAGS_NODIST=" -fprofile-instr-generate" LIBS="-lintl -ldl  -framework CoreFoundation"
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python313/python313/work/Python-3.13.2'
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Parser/token.o Parser/token.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Parser/pegen.o Parser/pegen.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Parser/pegen_errors.o Parser/pegen_errors.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Parser/action_helpers.o Parser/action_helpers.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -fno-semantic-interposition -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Parser/parser.o Parser/parser.c
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
make[2]: *** [Parser/token.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Parser/pegen_errors.o] Error 1
make[2]: *** [Parser/parser.o] Error 1
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
gcc-mp-14: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
make[2]: *** [Parser/pegen.o] Error 1
make[2]: *** [Parser/action_helpers.o] Error 1
make[2]: *** [Programs/python.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python313/python313/work/Python-3.13.2'
make[1]: *** [profile-gen-stamp] Error 2
CPython versions tested on:

3.13

Operating systems tested on:

macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the build's profile option handling and where -fprofile-instr-generate is added to CFLAGS_NODIST and LDFLAGS_NODIST. Verify the compiler-specific behavior described in the report, then confirm that a profile-enabled GCC build no longer passes the unsupported flag and completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.