WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Lost while trying to compile Python 3.11.1  (Read 3050 times)

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Lost while trying to compile Python 3.11.1
« on: January 20, 2023, 02:10:03 PM »
Hello,

I've been using for months TCL, it is really nice. I am trying to upgrade the Python version from 3.10 to 3.11.1 (current with speed improvements)

I am following a guide for an older version but I am kinda lost. (http://tinycorelinux.net/11.x/x86_64/tcz/src/python3.6/compile_python3.6)

I always get curses missing while compiling even thought it is installed.








Not sure what to do with CPPFLAGS line and I am not sure it applies to PiCore ARMV7 instructions.


Any help appreciated!

Thanks!!!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #1 on: January 20, 2023, 09:24:26 PM »
The CPPFLAGS are correct and work with python3.6 and python3.9, so I'm not sure why the build failed for the curses module. Are both ncurses and ncurses-dev loaded?

For piCore you should replace "-mtune=generic" by "-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 679
Re: Lost while trying to compile Python 3.11.1
« Reply #2 on: January 21, 2023, 01:16:57 AM »
Hello

Sorry for hijacking this thread, but something comes into mind.

What i have learned that there two versions of ncurses and ncursesw.
And then i used picore before i have to compile and get the older version of ncurses without "w".
I think the "w" stands for support for unicode wide charset.
Uses more than one byte to represent the glyph.


Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #3 on: January 21, 2023, 03:36:40 AM »
ncurses is non-unicode only
ncursesw is both non-unicode and unicode

In prior versions of x86 tinycore both extensions existed, which tended to cause confusion and many users needed to load both.

As said, prior versions of python built against ncursesw without problems.

As it says "following modules built successfully, but could not be imported..", I wonder if the problem is not elsewhere - perhaps readline is not built against ncursesw or perhaps setuptools or pip is required?

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #4 on: January 21, 2023, 04:51:34 AM »
The CPPFLAGS are correct and work with python3.6 and python3.9, so I'm not sure why the build failed for the curses module. Are both ncurses and ncurses-dev loaded?

For piCore you should replace "-mtune=generic" by "-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"
I know it will sound like a newbie but where do you put this flag? On the ./configure line?

Should -march be armv7 (I am on that) instead armv6zk?


Quote
Are both ncurses and ncurses-dev loaded?




Python build does work without ncurses not sure what will be the limitation without that.


Thanks for the replies everyone!
« Last Edit: January 21, 2023, 05:21:48 AM by elcouz »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #5 on: January 21, 2023, 05:21:17 AM »
The CPPFLAGS, CC and CXX all go on the ./configure line before ./configure.

The flags given ensure that your build will work on armv6, armv7 and armv7l - you can change them if you wish to build for a specific RPi.

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #6 on: January 21, 2023, 05:23:38 AM »
ok perfect ,,, will try right away and report back!

Thanks!

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #7 on: January 21, 2023, 06:33:38 AM »
The CPPFLAGS, CC and CXX all go on the ./configure line before ./configure.

The flags given ensure that your build will work on armv6, armv7 and armv7l - you can change them if you wish to build for a specific RPi.

CPPFLAGS="-I/usr/local/include/ncursesw" CC="gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -march=armv7 -mtu
ne=arm1176jzf-s -mfpu=vfp
-Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --localstatedir=/var --enable-shared --with-system-expat --with-system-ffi --with-ensurepip=yes --with-tcltk-i
ncludes='-I/usr/local/include' --with-tcltk-libs='-L/usr/local/lib -ltk8.6 -ltcl8.6'
configure: WARNING: unrecognized options: --with-tcltk-includes, --with-tcltk-libs
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking for Python interpreter freezing... ./_bootstrap_python
checking for python3.11... no
checking for python3.10... no
checking for python3.9... no
checking for python3.8... python3.8
checking Python for regen version... Python 3.8.7
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe accepts -g... yes
checking for gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -E
checking for grep that handles long lines and -e... /usr/local/bin/grep
checking for a sed that does not truncate output... /usr/local/bin/sed
checking for egrep... /usr/local/bin/grep -E
checking for CC compiler name... gcc
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for --with-cxx-main=<compiler>... no
checking for the platform triplet based on compiler characteristics... arm-linux-gnueabihf
checking for multiarch...
checking for PEP 11 support tier... armv7l-unknown-linux-gnueabihf/gcc has tier 3 (partially supported)
checking for -Wl,--no-as-needed... yes
checking for the Android API level... not Android
checking for --with-emscripten-target...
checking for --enable-wasm-dynamic-linking... missing
checking for --enable-wasm-pthreads... missing
checking for --with-suffix...
checking for case-insensitive build directory... no
checking LIBRARY... libpython$(VERSION)$(ABIFLAGS).a
checking LINKCC... $(PURIFY) $(MAINCC)
checking EXPORTSYMS...
checking for GNU ld... yes
checking for --enable-shared... yes
checking for --with-static-libpython... yes
checking for --enable-profiling... no
checking LDLIBRARY... checking HOSTRUNNER...
libpython$(LDVERSION).so
checking for ar... ar
checking for readelf... readelf
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for --with-pydebug... no
checking for --with-trace-refs... no
checking for --enable-pystats... no
checking for --with-assertions... no
checking for --enable-optimizations... no
checking PROFILE_TASK... -m test --pgo --timeout=$(TESTTIMEOUT)
checking for --with-lto... no
checking for llvm-profdata... no
checking if gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe supports -Og optimization level... yes
checking if we can add -Wextra... yes
checking whether gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -fno-strict-aliasing accepts and needs -fno-strict-aliasing... no
checking if we can disable gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe unused-parameter warning... yes
checking if we can disable gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe missing-field-initializers warning... yes
checking if we can enable gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe sign-compare warning... yes
checking if we can enable gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe unreachable-code warning... yes
checking if we can enable gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe strict-prototypes warning... no
checking if we can make implicit function declaration an error in gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -Werror=implicit-function-declaration... yes
checking if we can use visibility in gcc -flto -fuse-linker-plugin -march=armv7 -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -fvisibility=hidden... yes
checking whether pthreads are available without options... no

TRUNCATED

checking for gethostbyname_r... yes
checking gethostbyname_r with 6 args... yes
checking for __fpu_control... yes
checking for --with-libm=STRING... default LIBM="-lm"
checking for --with-libc=STRING... default LIBC=""
checking for x64 gcc inline assembler... no
checking whether float word ordering is bigendian... unknown
configure: error:

Unknown float word ordering. You need to manually preset
ax_cv_c_float_words_bigendian=no (or yes) according to your system.



I'll try with armv6zk arch


EDIT: It is the same for armv6zk unfortunately
 
When I follow this guide it does compile and work but with the curses missing

This specific part with tce-load -i all required tcz:



https://www.scivision.dev/compile-install-python-beta-raspberry-pi/
« Last Edit: January 21, 2023, 06:53:49 AM by elcouz »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #8 on: January 21, 2023, 06:56:54 AM »
You could try again adding:
ax_cv_c_float_words_bigendian=no
or
ax_cv_c_float_words_bigendian=yes

..after the end of the ./configure switches.

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #9 on: January 21, 2023, 07:40:18 AM »
You could try again adding:
ax_cv_c_float_words_bigendian=no
or
ax_cv_c_float_words_bigendian=yes

..after the end of the ./configure switches.



I wonder if it is because we specify the architecture manually in the configure flags?

I found this ... but man it is getting quite complex

https://github.com/python/cpython/issues/86524
« Last Edit: January 21, 2023, 07:43:02 AM by elcouz »

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #10 on: January 21, 2023, 08:10:14 AM »
I opened an issue on GitHub about this.

Is there a way to see who compiled Python3.10.tcz for PiCore ? Would be have his opinions about the build process ,,, maybe there is something different from 3.9 and up.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #11 on: January 21, 2023, 08:12:56 AM »
Don’t put “-“ or “—“ before ax_blah_blah..

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14587
Re: Lost while trying to compile Python 3.11.1
« Reply #12 on: January 21, 2023, 08:26:46 AM »
You can check the info file to see who compiled the python3.10 extension.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: Lost while trying to compile Python 3.11.1
« Reply #13 on: January 21, 2023, 08:29:59 AM »
Hi elcouz
... Is there a way to see who compiled Python3.10.tcz for PiCore ? ...
Sure:
http://tinycorelinux.net/13.x/armv6/tcz/python3.10.tcz.info

Python3.10 was likely built with the same settings shown in the Python3.8 and
Python3.9 build scripts found here:
http://tinycorelinux.net/13.x/armv6/tcz/src/

Offline elcouz

  • Newbie
  • *
  • Posts: 23
Re: Lost while trying to compile Python 3.11.1
« Reply #14 on: January 21, 2023, 08:44:39 AM »
Hi elcouz
... Is there a way to see who compiled Python3.10.tcz for PiCore ? ...
Sure:
http://tinycorelinux.net/13.x/armv6/tcz/python3.10.tcz.info

Python3.10 was likely built with the same settings shown in the Python3.8 and
Python3.9 build scripts found here:
http://tinycorelinux.net/13.x/armv6/tcz/src/

I will try to use this build script


Thank you guys,,, the force option ax_cv_c_float_words_bigendian=no seems to work (I read that PIs use little endian)
« Last Edit: January 21, 2023, 08:47:56 AM by elcouz »