Problem compiling Python 3.12 and up

Hello,

I’m new here, and the post formatting is bewildering for me. Dunno if this the right forum to ask this. So sorry if there are errors.

So, anyone has tried to compile Python 3.12 and up, yet?

Requirements:

I have Searched the forum for my issue and found nothing related or helpful
I have checked the Resources category (Resources Index)
I have reviewed the Wiki for relevant information
I have read the the Release Notes and Errata

OpenMandriva Lx version:

OpenMandriva Lx release 25.06 (ROME) Rolling for x86_64

Desktop environment (KDE, LXQT…):

KDE (minimal)

Description of the issue (screenshots if relevant):

When trying to compile Python 3.12.x and 3.13.x with the source downloaded from the Official Python Site, it always fail at compiling/linking curses module.

Prior to compiling, I tried to install the dependencies with this command:

$ sudo dnf install make gcc patch automake findutils lib64bz2-devel lib64ffi-devel lib64gdbm-devel lib64lzma-devel lib64ncurses-devel lib64nsl-devel lib64openssl-devel lib64readline-devel lib64sqlite3-devel lib64tk-devel lib64uuid-devel lib64z-devel lib64zstd-devel

Relevant informations (hardware involved, software version, logs or output…):

This is the line where it fails (excerpt):

$ ./configure
$ make
...
gcc -D_DEFAULT_SOURCE  -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -fPIC -c ./Modules/_cursesmodule.c -o Modules/_cursesmodule.o
gcc -shared      Modules/_cursesmodule.o -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -Oz -Wl,-O2 -Wl,--no-undefined -flto -lncursesw  -o Modules/_curses.cpython-313-x86_64-linux-gnu.so
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: Modules/_cursesmodule.o: in function `PyCursesWindow_set_encoding':
/home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2477:(.text+0x21): undefined reference to `PyUnicode_AsASCIIString'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2480:(.text+0x32): undefined reference to `_PyMem_Strdup'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2486:(.text+0x53): undefined reference to `PyMem_Free'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: Modules/_cursesmodule.o: in function `Py_DECREF':
/home/xeon/Temp/Python-3.13.8/./Include/object.h:949:(.text+0x6c): undefined reference to `_Py_Dealloc'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: Modules/_cursesmodule.o: in function `PyCursesWindow_set_encoding':
/home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2473:(.text+0x7b): undefined reference to `PyExc_TypeError'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2473:(.text+0x8a): undefined reference to `PyErr_SetString'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2483:(.text+0x96): undefined reference to `PyErr_NoMemory'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2467:(.text+0x9f): undefined reference to `PyExc_TypeError'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: /home/xeon/Temp/Python-3.13.8/./Modules/_cursesmodule.c:2467:(.text+0xae): undefined reference to `PyErr_SetString'
/usr/bin/x86_64-openmandriva-linux-gnu-ld.bfd: Modules/_cursesmodule.o: in function `PyCursesWindow_wtimeout':
...

I can post the full ./configure and make logs, but they are big (29.5Kb + 455.5Kb), so I ask first.

No matter the Python version and patch level (3.12x, 3.13x), it always choke at the same point.

Is it currently possible to compile Python v3.12 and up in OMLx, or is it not possible and the cause for the python version in the repo is v3.11.11?

Thanks

I guess there is a pretty good reason for not upgrading to latest available releases. I haven’t tried building python before. So cannot help with that. But if you are willing to experiment, there are two options.

  1. Take a look at OMLx python repo on GitHub. It seems to be updated to 3.13.3. There is a nice article on how to build packages for openmandriva. You may be able to build the package and install. Again remember, there must be a reason for not upgrading!
  2. Use homebrew (probably safer option). I recently discovered it while discussing on another thread. Once you have homebrew installed, install a particular version of python by appending @version. Like so, brew install python@3.13
    Afterwards, you can run the new version of python as python3.13 instead of just python or python3. It seems system installed version still remains default.

Well, the reason I’m compiling python mainly for use with PyEnv, or something similar. I don’t want to disturb the system installed python, and having a separate Python install other than from DNF/Repo install so I can manage it.

Also, I just migrate from Windows. I used Python 3.13.7 there.

In the mean time, I’m using the binaries from Python-Build-Standalone. But sadly, the Tcl/Tk included is v8.6 and compiled without Xft support, thus can only access a very small subset of the system installed font.

This isn’t a problem. I moved it to Development because we do already package python and you want to compile a newer version for yourself.

We are in the process of updating ROME and upgrading python is a topic of discussion for after that takes place. It will probably break a lot of things and we don’t have very many people to test it.

@n1ckla I was able to compile Python 3.14.

Here is what I did:

  • download the ‘python.spec’ file from the link I posted above. That is the OMLx official spec file. It has all the build dependencies.
  • Installed all the required dependencies via dnf builddep python.spec. You probably missed some dependencies.
  • Compiled the 3.14 version and install it.

I did get some error regarding pip installed to /usr/local/bin which is not in $PATH or something like that. But I was able to install 3.14 version and execute commands/scripts successfully.

Hi,

The problem is that you’re building the modules with checks for undefined symbols – _curses.cpython*.so fails because it references symbols defined in libpython without explicitly linking to it.

This is ok (because the module is never used outside of python), but the linker screams because it’s usually a very bad idea to to have unresolvable symbols in a library.

Possible fixes (any one of them should be sufficient):

  1. Link the module to the python library by adding -lpython3.13
  2. Tell the linker that it’s ok by adding -Wl,–allow-shlib-undefined to the compiler flags
  3. Use lld

The reason why we’re currently on 3.11 is simply that updating python to a new major version is just about the most painful thing there is (our package builds currently rely on mock, which is written in python and uses various extra python libraries that already need to be available for the version of python being used – so there’s a bit of a chicken and egg problem, we need to have those extra python modules before we can build a package, but we need to build the packages containing those python modules before we can get them into the build environment). We’re fixing that by getting rid of mock, there’s better ways to do what it does anyway.

We have a 3.14.0 package ready to go (spec file, adapted patches etc. are here), but we’re currently holding off on building it so we don’t delay the update sync any more. It will arrive in cooker shortly.