You are not logged in.

#1 2025-12-17 07:44:00

tugoese
Member
Registered: 2023-10-15
Posts: 48

[SOLVED] pyenv: python2

Hi, I'm trying to install python2 to solve some legacy ctf challenges with pwntools, I tried https://bbs.archlinux.org/viewtopic.php?id=276946 but somehow it's not working.

$ pyenv install 2.7.18
-> https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
Installing Python-2.7.18...
patching file configure
patching file configure.ac
patching file setup.py
patching file Mac/Tools/pythonw.c
patching file setup.py
patching file Doc/library/ctypes.rst
patching file Lib/test/test_str.py
patching file Lib/test/test_unicode.py
patching file Modules/_ctypes/_ctypes.c
patching file Modules/_ctypes/callproc.c
patching file Modules/_ctypes/ctypes.h
patching file Modules/_ctypes/callproc.c
patching file setup.py
patching file Mac/Modules/qt/setup.py
patching file setup.py

BUILD FAILED (Arch Linux using python-build 2.6.16)

Inspect or clean up the working tree at /tmp/python-build.20251217153757.55339
Results logged to /tmp/python-build.20251217153757.55339.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

Any help would be appreciated

Last edited by tugoese (2025-12-18 12:51:55)

Offline

#2 2025-12-17 09:55:53

mithrial
Member
Registered: 2017-03-05
Posts: 119

Re: [SOLVED] pyenv: python2

These look like warnings and notes but no errors. There should be a longer log file somewhere. Maybe gcc is not compatible anymore?

But I would rather recommend using docker and not have these old libraries and modules pollute your system.

Offline

#3 2025-12-17 10:07:15

tugoese
Member
Registered: 2023-10-15
Posts: 48

Re: [SOLVED] pyenv: python2

Uhh.... I don't think gcc is involved with this also Docker seems too much & I need those libraries for compatibility

Offline

#4 2025-12-17 10:50:04

mithrial
Member
Registered: 2017-03-05
Posts: 119

Re: [SOLVED] pyenv: python2

There is no evidence for or against gcc. These few warnings you showed are from compilation, so maybe gcc?
Docker is not much, it's easily installed and used.

Offline

#5 2025-12-17 13:55:35

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,538

Re: [SOLVED] pyenv: python2

That's not llvm so most likely gcc and not fatal - the fatal error is ahead of that, check /tmp/python-build.20251217153757.55339.log
Also there's still https://aur.archlinux.org/packages/python2

Offline

#6 2025-12-17 15:35:12

tugoese
Member
Registered: 2023-10-15
Posts: 48

Re: [SOLVED] pyenv: python2

mithria wrote:

There is no evidence for or against gcc. These few warnings you showed are from compilation, so maybe gcc?

We'll see

log

seth wrote:

It works but I still need pip2 (It's broken)

Offline

#7 2025-12-17 15:42:18

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,351

Re: [SOLVED] pyenv: python2

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

So yes, it's gcc and it's new(ish) default of c23. You'd need to set that to a previous standard, but I have no idea how to do that in this workflow.

Offline

#8 2025-12-17 19:56:27

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,538

Re: [SOLVED] pyenv: python2

Afaiu using the AUR package has overcome that problem via https://aur.archlinux.org/cgit/aur.git/ … 96dbc1a640 ?

So how is

It works but I still need pip2 (It's broken)

pip2 broken?
https://aur.archlinux.org/packages/python2-pip has an unresolved dependency (funnily enough it's python2-resolvelib)

If you're gonna use pyenv, you can set the CFLAGS environment to "--std=c17", https://brandonrozek.com/blog/pyenvbuildflags/

Offline

#9 2025-12-18 10:43:33

tugoese
Member
Registered: 2023-10-15
Posts: 48

Re: [SOLVED] pyenv: python2

It is gcc & it works by changing the CFLAGS

Last edited by tugoese (2025-12-18 12:51:35)

Offline

Board footer

Powered by FluxBB