advancetoolchain/advance-toolchain

Change how optimized Python is built for AT 17 (next)

mscastanho opened this issue · 2 comments

More details on the Python issue: Python 3.11 added a helper program (_freeze_module) to create frozen modules during the build process. The Python Makefile is not detecting python_power10 as a cross-compilation (probably because host and target archs are the same), so it builds this file with the same flags used for the rest of the build, which in this case includes -mcpu=power10:

/home/mscastanho/AT/at16-beta1/opt/at-next-17.0-0-alpha/bin/gcc -m64 -c  -DNDEBUG -O3 -mcpu=power10 <lots-of-other-flags> 
/home/mscastanho/AT/at16-beta1/build/at17.0-0-alpha.debian-11_ppc64le_ppc64le/sources/python/Programs/_freeze_module.c

Naturally, when we're not building on a Power10, _freeze_module binary fails with Illegal Instruction when executed.

When cross-compiling it uses a pure-Python version of this same program, which is executed by a "build Python" interpreter (can be specified with --with-build-python). But again, this is not an option since the Makefile is not detecting this as a cross-compilation. This will likely require more investigation and some changes to how Python is built for AT next, so it's better suited for a separate PR.

Originally posted by @mscastanho in #2955 (comment)

Originally posted by @mscastanho in #2955 (comment)

#2955 concerns "AT 16.0-0 Beta 1". Is a fix not needed there, and can wait for AT 17?

@ThinkOpenly That's how I understand it. Python was updated to 3.11 for AT next as part of that PR, but is not strictly necessary for AT 16.0-0 Beta 1 release. So we can just remove that commit and postpone this change for now.