New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #32575 (assigned defect)

Opened 17 months ago

Last modified 5 weeks ago

python3: llvm-3.1 fails to build with python3 selected

Reported by: jonesc@… Owned by: jeremyhu@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: python3 Cc: russel@…
Port: llvm-3.1

Description

Title says it all ... llvm-3.1 fails to build for me on OSX 10.7 with Xcode 4.2

log file attached.

Chris

Attachments

main.log (728.3 KB) - added by jonesc@… 17 months ago.
clang-3.1-build.log (1.1 MB) - added by jonesc@… 17 months ago.
llvm.patch (1016 bytes) - added by jeremyhu@… 17 months ago.
llvm Portfile patch
main.2.log (736.1 KB) - added by jonesc@… 17 months ago.

Change History

Changed 17 months ago by jonesc@…

comment:1 Changed 17 months ago by macsforever2000@…

  • Owner changed from macports-tickets@… to jeremyhu@…

In the future, please Cc the maintainer(s).

comment:2 Changed 17 months ago by jeremyhu@…

:info:build make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.1/llvm-3.1/work/trunk'
:info:build llvm[0]: Constructing LLVMBuild project information.
:info:build Traceback (most recent call last):
:info:build   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.1/llvm-3.1/work/trunk/utils/llvm-build/llvm-build", line 3, in <module>
:info:build     import llvmbuild
:info:build   File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.1/llvm-3.1/work/trunk/utils/llvm-build/llvmbuild/__init__.py", line 1, in <module>
:info:build     from main import main
:info:build ImportError: No module named main

It builds fine for me here. This looks like python related madness, so /shrug ... =/

comment:3 Changed 17 months ago by jonesc@…

Sorry about the cc - I thought the bug system would automatically cc the maintainers of the port ... Seems odd I have to do it by hand...

Anyway, could it matter which python version I am using. I have macports python32 install and have 'port selected' it .... ?

Chris

comment:4 Changed 17 months ago by jonesc@…

The problem does seem to be related to my use of python32 as my default python version. If I switch back toy either macports python27, or the system python version, the build goes OK.

If llvm-3.1 depends on python during the build phase, wouldn't it be best to explicitly depend on a macports python version (2.7, as that seems to work) and use that, rather than just pickup whatever the user has as their 'python' version via $PATH ?

cheers Chris

comment:5 Changed 17 months ago by jeremyhu@…

Ok, then it seems the llvm ports (and probably clang, can you please test clang-3.1) need some python magic... yick.

comment:6 Changed 17 months ago by jonesc@…

clang-3.1 does indeed suffer from the same problem. log attached, in case its useful ...

Chris

Changed 17 months ago by jonesc@…

Changed 17 months ago by jeremyhu@…

llvm Portfile patch

comment:7 Changed 17 months ago by jeremyhu@…

  • Status changed from new to assigned

Does this patch to the llvm-3.1 Portfile address the problem for you?

comment:8 Changed 17 months ago by jonesc@…

Sorry for the delay in getting back.

I'm afraid it don't work. Same error as before. See attached log.

Note, you can (I hope) reproduce this yourself by just installing python32 and setting it as your default, using

sudo port select python python32

Chris

Changed 17 months ago by jonesc@…

comment:9 Changed 15 months ago by jeremyhu@…

  • Summary changed from llvm-3.1 fails to build on OSX10.7 / Xcode 4.2 to python3: llvm-3.1 fails to build with python3 selected

comment:10 Changed 13 months ago by jonesc@…

Any progress on fixing this ?

comment:11 Changed 13 months ago by jeremyhu@…

  • Keywords python3 added

I don't use python3, and there's an easy workaround, so it's not a priority for me. Patches are welcome.

Try setting the PYTHON_EXECUTABLE environment variable:

$ grep -R PYTHON .
./CMakeLists.txt:if( NOT PYTHONINTERP_FOUND )
./CMakeLists.txt:Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
./CMakeLists.txt:  COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
./test/CMakeLists.txt:set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
./test/CMakeLists.txt:  COMMAND ${PYTHON_EXECUTABLE}
./test/lit.cfg:# Propagate PYTHON_EXECUTABLE into the environment
./test/lit.cfg:config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',
./test/lit.site.cfg.in:config.python_executable = "@PYTHON_EXECUTABLE@"
./test/Makefile:	@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=python=g >> lit.tmp
./test/Scripts/coff-dump.py.bat:%PYTHON_EXECUTABLE% -u %LLVM_SRC_ROOT%\test\Scripts\coff-dump.py %1 %2 %3 %4 %5 %6 %7 %8 %9
./test/Scripts/elf-dump.bat:%PYTHON_EXECUTABLE% -u %LLVM_SRC_ROOT%\test\Scripts\elf-dump %1 %2 %3 %4 %5 %6 %7 %8 %9
./test/Scripts/macho-dumpx.bat:%PYTHON_EXECUTABLE% -u %LLVM_SRC_ROOT%\test\Scripts\macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9
./tools/clang/bindings/python/README.txt:$ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/) \
./tools/clang/test/CMakeLists.txt:if(PYTHONINTERP_FOUND)
./tools/clang/test/CMakeLists.txt:    COMMAND ${PYTHON_EXECUTABLE}
./tools/clang/test/CMakeLists.txt:      COMMAND ${PYTHON_EXECUTABLE}
./tools/clang/test/Makefile:	@ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
./utils/lit/lit/TestingConfig.py:                        'PYTHONUNBUFFERED' : '1',

comment:12 Changed 13 months ago by jonesc@…

Totally fair point ;)

If and when I have time, I'll see if the PYTHON_EXECUTABLE workaround works or not.

cheers Chris

comment:13 Changed 11 months ago by jmr@…

It doesn't look like modifying anything in the environment will work. It executes llvm-build directly, not as an argument to an interpreter, so the #!/usr/bin/env python in the script gets used. Just patching that to /usr/bin/python should be fine.

Upstream should probably add an AM_PATH_PYTHON to configure, and a $(PYTHON) to the invocation in Makefile.rules.

comment:14 Changed 6 months ago by russel@…

  • Cc russel@… added

Cc Me!

comment:15 Changed 6 months ago by russel@…

Just a note that I was also seeing this problem, or a directly related problem, and tweeted about it. @neverpanic replied pointing me here. With my usual python32 as default I cannot install LLVM-3.1, switch to python27 and it works fine.

comment:19 follow-up: ↓ 20 Changed 5 weeks ago by samkass-macports@…

If you have python installed through MacPorts, you can do this to make it work:

sudo port select python python27

comment:20 in reply to: ↑ 19 Changed 5 weeks ago by jonesc@…

Replying to samkass-macports@…:

If you have python installed through MacPorts, you can do this to make it work:

sudo port select python python27

Well yes.... But that is not the point really. llvm should really be insensitive at build time to the version of python a user has opted to use.

Note: See TracTickets for help on using tickets.