Skip to content

Cannot install any python2 versions at all on fedora 42: "error: cannot use keyword ‘false’ as enumeration constant" #3335

Closed

Description

@j3r1ch0

trace.log

Prerequisites

  • Make sure your problem is not listed in the common build problems.
  • Make sure no duplicated issue has already been reported in the pyenv issues. For build errors, a reported issue typically mentions a key error message. This key error message is often not in the 10 last build log lines reported to the console but is rather earlier in the build log -- typically, it's the first error message encountered in the log.
  • Make sure you are reporting a problem in Pyenv and not seeking consultation with Pyenv usage.
  • Make sure your problem is not derived from packaging (e.g. Homebrew).
    • Please refer to the package documentation for the installation issues, etc.
  • Make sure your problem is not derived from plugins.
    • This repository is maintaining pyenv and the default python-build plugin only. Please refrain from reporting issues of other plugins here.

Describe the bug

Python2 installs fail with a range of errors such as `BUILD FAILED (Fedora Linux 42 using python-build 2.6.7)

Inspect or clean up the working tree at /tmp/python-build.20250926013054.475715
Results logged to /tmp/python-build.20250926013054.475715.log

Last 10 log lines:
9 | typedef enum {false, true} bool;
| ^~~~~
Include/asdl.h:9:15: note: ‘false’ is a keyword with ‘-std=c23’ onwards
Include/asdl.h:9:28: error: expected ‘;’, identifier or ‘(’ before ‘bool’
9 | typedef enum {false, true} bool;
| ^~~~
Include/asdl.h:9:28: warning: useless type name in empty declaration
make: *** [Makefile:1250: Python/asdl.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:1250: Python/Python-ast.o] Error 1
`
and

`BUILD FAILED (Fedora Linux 42 using python-build 2.6.7)

Inspect or clean up the working tree at /tmp/python-build.20250926012751.464779
Results logged to /tmp/python-build.20250926012751.464779.log

Last 10 log lines:
Python/ast.c:2631:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
2631 | if (!import_alias)
| ^~
Include/asdl.h:42:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
42 | #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
| ^
Python/ast.c:2633:21: note: in expansion of macro ‘asdl_seq_SET’
2633 | asdl_seq_SET(aliases, i / 2, import_alias);
| ^~~~~~~~~~~~
make: *** [Makefile:1382: Python/ast.o] Error 1
`

Reproduction steps

pyenv install 2.7.18 and pyenv install 2.7.6. All python2 versions fail with any number of errors even on a brand new install.

Diagnostic details

  • [Fedora 42 ] Platform information (e.g. Ubuntu Linux 24.04):
  • [amd64 ] OS architecture (e.g. amd64):
  • [2.6.7 ] pyenv version:
  • [ 3.13.7] Python version:
  • [ GCC 15.2.1] C Compiler information (e.g. gcc 7.3):
  • Please attach the debug trace of the failing command as a gist:
    • Run env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.log and attach trace.log. E.g. if you have a problem with installing Python, run env PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log (note the -v option to pyenv install).
  • If you have a problem with installing Python, please also attach config.log from the build directory
    • The build directory is reported after the "BUILD FAILED" message and is usually under /tmp.
  • If the build succeeds but the problem is still with the build process (e.g. the resulting Python is missing a feature), please attach
    • the debug trace from reinstalling the faulty version with env PYENV_DEBUG=1 pyenv install -f -k -v <version> 2>&1 | tee trace.log
    • config.log from the build directory. When using pyenv install with -k as per above, the build directory will be under $PYENV_ROOT/sources.
  • If the problem happens in another Pyenv invocation, turn on debug logging by setting PYENV_DEBUG=1, e.g. env PYENV_DEBUG=1 pyenv local 3.6.4, and attach the resulting trace as a gist
  • If the problem happens outside of a Pyenv invocation, get the debug trace like this:
    export PYENV_DEBUG=1
    # for Bash
    export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
    # for Zsh
    export PS4='+(%x:%I): %N(%i): '
    
    set -x
    <reproduce the problem>
    set +x
    

Activity

  1. native-api commented on Sep 27, 2025

    @native-api
    Member

    pass PYTHON_CFLAGS=-std=c99

  2. zeroSteiner commented on Oct 2, 2025

    @zeroSteiner

    I've also been running into build errors for Python 2.x on Fedora 42. I tried PYTHON_CFLAGS=-std=c99 and while it gets further, it now fails on the SSL library despite openssl-devel being installed. I have not tried with 2.7 as the OP referenced.

  3. native-api commented on Oct 3, 2025

    @native-api
    Member

    while it gets further, it now fails on the SSL library despite openssl-devel being installed

    2.x needs OpenSSL 1.1 . It might build against 3 but will be non-functional.
    Need diagnostic details as per the issue template to say anything more.

  4. native-api commented on Dec 9, 2025

    @native-api
    Member

    Since we provide an OpenSSL build logic, I guess we can accept a PR adding/changing a check in that line that would also build OpenSSL if the configured one is incompatible.

  5. nuclearpidgeon commented on Apr 2, 2026

    @nuclearpidgeon

    Can confirm:

    • This same kind of error happens on current Arch Linux (Arch rolling using python-build 2.6.26-7-gce491008, gcc 15.2.1):
    Last 10 log lines:
    In file included from Python/asdl.c:2:
    Include/asdl.h:9:15: error: cannot use keyword ‘false’ as enumeration constant
        9 | typedef enum {false, true} bool;
          |               ^~~~~
    Include/asdl.h:9:15: note: ‘false’ is a keyword with ‘-std=c23’ onwards
    Include/asdl.h:9:28: error: expected ‘;’, identifier or ‘(’ before ‘bool’
        9 | typedef enum {false, true} bool;
          |                            ^~~~
    Include/asdl.h:9:28: warning: useless type name in empty declaration
    make: *** [Makefile:1382: Python/asdl.o] Error 1
    
    • Adding PYTHON_CFLAGS=-std=c99 also fixes the issue there
      Thank you @native-api !
  6. changed the title [-]Cannot install any python2 versions at all on fedora 42[/-] [+]Cannot install any python2 versions at all on fedora 42: "error: cannot use keyword ‘false’ as enumeration constant"[/+] on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions