Open Quuxplusone opened 12 years ago
We have had some resistance in the past to moving to a newer Python than 2.4 (due to some BSDs), but honestly I think that moving to 2.6 is reasonably.
My preferred solution here would be to make our Python tools be hybrid python2/3.
RHEL5 is stuck on Python 2.4 and supported until 2017. It has been the main limitation for projects that I'm involved in. But most installations I have encountered already needed a newer version of Python and have upgraded.
I ran into this error trying to build ROOT (root.cern.ch, they now include a
copy of llvm in their SVN trunk):
https://savannah.cern.ch/bugs/?99139
What's the status on this one?
Any chance of fixing this quickly so that llvm 3.2 can be built with Python 3?
Just for reference, here's the errors you'll get if the python on your PATH is
a Python 3.
Plenty of these ImportErrors, but the build keeps going:
llvm[4]: Constructing LLVMBuild project information.
Traceback (most recent call last):
File "/Users/deil/software/llvm_Python3/llvm/utils/llvm-build/llvm-build", line 3, in <module>
import llvmbuild
File "/Users/deil/software/llvm_Python3/llvm/utils/llvm-build/llvmbuild/__init__.py", line 1, in <module>
from main import main
ImportError: No module named main
llvm[4]: Compiling HexagonMCAsmInfo.cpp for Debug+Asserts build
Then after a few minutes the build fails like this:
llvm[2]: Building Debug+Asserts Archive Library libLLVMCodeGen.a
llvm[1]: Constructing LLVMBuild project information.
Traceback (most recent call last):
File "/Users/deil/software/llvm_Python3/llvm/utils/llvm-build/llvm-build", line 3, in <module>
import llvmbuild
File "/Users/deil/software/llvm_Python3/llvm/utils/llvm-build/llvmbuild/__init__.py", line 1, in <module>
from main import main
ImportError: No module named main
llvm[1]: Building llvm-config BuildVariables.inc file.
llvm[1]: Compiling llvm-config.cpp for Debug+Asserts build
/Users/deil/software/llvm_Python3/llvm/tools/llvm-config/llvm-config.cpp:45:10:
fatal error: 'LibraryDependencies.inc' file not found
#include "LibraryDependencies.inc"
^
1 error generated.
rm: /Users/deil/software/llvm_Python3/build/tools/llvm-
config/Debug+Asserts/llvm-config.d.tmp: No such file or directory
make[1]: *** [/Users/deil/software/llvm_Python3/build/tools/llvm-
config/Debug+Asserts/llvm-config.o] Error 1
make: *** [all] Error 1
This is a major issue when building with MacPorts and Python3. It has been over a year, can we get some movement on this issue?
According to http://www.python.org/dev/peps/pep-0394/ there should be a python2 executable everywhere python2 is installed?
So how about /usr/bin/env python -> /usr/bin/env python2 ?
Note the date on the PEP. Recent distributions should have python2, but older installations (before 2010 or so) usually don't.
At the very least, it would be good if there was a PYTHON environment variable that one could specify.
(In reply to comment #8)
> At the very least, it would be good if there was a PYTHON environment
> variable that one could specify.
Not exactly an environment variable but there is CMake variable:
cmake ../llvm-3.3.src -DPYTHON_EXECUTABLE=/usr/bin/python2.7
(You can substitute /usr/bin/python2.7 by path that's working on your system).
At least quick search shown that FindPythonInterp allows to specified allow
versions (at least in newer CMake) but I haven't used CMake so I don't know how.
The build scripts are written in python2, but "/usr/bin/env python" is python3 on some systems (e.g. Arch Linux). There are at least two solutions
Add a --with-python=/path/to/python configure flag so the user can choose a compatible version. Then invoke the scripts using ${PYTHON} path/to/script.py.
Make the scripts hybrid python2/python3. This should be easy if you can assume python2.6 or later (to support importing print_function from future).