This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Using target python while cross-building
Type: compile error Stage:
Components: Cross-Build Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alex.Willmer, fransdb
Priority: normal Keywords:

Created on 2021-09-28 18:20 by fransdb, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg402799 - (view) Author: Frans (fransdb) Date: 2021-09-28 18:20
While trying to cross-compile Python-3.9.7, I came across the next error report:

i586-cross-linux-gcc     -Xlinker -export-dynamic -o python Programs/python.o -L. -lpython3.9 -lcrypt -ldl  -lpthread -lm   -lm  
_PYTHON_PROJECT_BASE=/mnt/lfs/sources-base/Python-3.9.7 _PYTHON_HOST_PLATFORM=linux-i586 PYTHONPATH=./Lib _PYTHON_SYSCONFIGDATA_NAME=_sys
configdata__linux_i386-linux-gnu python -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
       echo "generate-posix-vars failed" ; \
       rm -f ./pybuilddir.txt ; \
       exit 1 ; \
fi
/bin/sh: line 1: python: command not found
generate-posix-vars failed
make: *** [Makefile:619: pybuilddir.txt] Error 1
-----------------------------------------------------------
Strange, because Python configure/Makefile known that we are cross-compiling, but still try to execute a program with the target architecture, which is not the same as the architecture of the build machine. Of course it fails.
msg402838 - (view) Author: Frans (fransdb) Date: 2021-09-29 09:28
Update:

I came to realize that the command 'python' is without './', so it will search using PATH for python. Which - on my system Opensuse TW - does not exist, since there we have 'python3'. So, I made a softlink python->python3. 

Alas, I noticed that when I made the softlink python to python3 before starting configure, configure stops and complains that python3.9 is not found. Sure, TW has python3.8. But why check for previous/current versions, when making a new python binary?

Ok, made the link after configure was done, which ended in:
----------------------------------
i586-cross-linux-gcc     -Xlinker -export-dynamic -o python Programs/python.o -L. -lpython3.9 -lcrypt -ldl  -lpthread -lm   -lm 
_PYTHON_PROJECT_BASE=/mnt/lfs/sources-base/Python-3.9.7 _PYTHON_HOST_PLATFORM=linux-i586 PYTHONPATH=./Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__linux_i386-linux-gnu python -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
        echo "generate-posix-vars failed" ; \
        rm -f ./pybuilddir.txt ; \
        exit 1 ; \
fi
Could not import runpy module
Traceback (most recent call last):
  File "/mnt/lfs/sources-base/Python-3.9.7/./Lib/runpy.py", line 14, in <module>
    import importlib.machinery # importlib first so we can test #15386 via -m
  File "/mnt/lfs/sources-base/Python-3.9.7/./Lib/importlib/__init__.py", line 57, in <module>
    import types
  File "/mnt/lfs/sources-base/Python-3.9.7/./Lib/types.py", line 296, in <module>
    GenericAlias = type(list[int])
TypeError: 'type' object is not subscriptable
generate-posix-vars failed
make: *** [Makefile:619: pybuilddir.txt] Error 1
-------------------------------------

Complete native compile functions as expected.
Maybe the reason that TW is still using 3.8? Shall try that next.
msg402841 - (view) Author: Frans (fransdb) Date: 2021-09-29 09:39
Update 2:

Using the python-3.8.12 source....no problem!
All functions well.

So, 3.9 has some issues i guess ;)
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89477
2021-09-29 09:39:19fransdbsetmessages: + msg402841
2021-09-29 09:28:40fransdbsettype: compile error
messages: + msg402838
2021-09-28 18:20:08fransdbcreate