Automake doesn't really know how to deal with python. I have come across
a lot of cross compilation problems.
When cross compiling an app there is currently no way of determining
a) which python headers are suitable for the target platform.
b) what version of python is available on the target
c) where the target's pythondir is
- For example, you are cross compiling from x86_32 to ppc64, you have
python installed on both your target's rootfs as well as your host's
rootfs for compiling python files. Both very standard base systems.
Host
----
prefix = /usr
libdir = /usr/lib
pythondir = /usr/lib/python2.4
Target
-----
prefix = /usr
libdir = /usr/lib64
pythondir = /usr/lib64/python2.5
When you run ./configure with AM_PATH_PYTHON, You get the following
section.. http://pastebin.com/f5facf673
The first section looks for the python command.
=>
for ac_prog in python python2 python2.5 python2.4 python2.3 python2.2
python2.1 python2.0 python1.6 python1.5
<=
Now since the host machine has python installed in it's path for
compiling python programs, it picks up "python"
Then it goes onto finding the python version.
=>
am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
<=
This is calling the host's python interpreter, so therefore it will
return , eg 2.4 Whilst the target actually has 2.5 installed.
Lines 74 and 76
=>
PYTHON_PREFIX='${prefix}'
PYTHON_EXEC_PREFIX='${exec_prefix}'
<=
This is another problem, Automake assumes that PYTHON_PREFIX=$(prefix)
now this may be the case in this example but does not mean it is
portable as a lot of people install python in /opt/python/
Line 85 - Platform test is not cross compatible, as it uses the host's
python interpreter
=>
am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
<=
Line 99-101 - Prefix test, is not cross compatible, as it uses the
host's python interpreter
=>
am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print
sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"
<=
Here the test assumes "lib", when it could easily be "lib64" and is
indeed in this case.
Line 116 - Module dir test, is not cross comptible, as it uses the
host's python interpreter
=>
am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig;
print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')"
2>/dev/null ||
echo
"${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`<=
<=
And so on...
Automake does not allow the user to override these paths with
environment variables, nor with configure parameters.
How do I go about installing my python files into the correct folders?
Vikram