Opened 7 years ago

Closed 9 months ago

#32575 closed defect (wontfix)

llvm-X.Y: fail to build with python3 selected

Reported by: cjones051073 (Chris Jones) Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: python3 haspatch Cc: russel@…, deesto (John S. De Stefano Jr.), larryv (Lawrence Velázquez), robitaille@…, mymacports@…, cooljeanius (Eric Gallager), marc@…, samuelandjw, manuel.deljesuspe@…, bonoba@…, michaelbartz@…, iemejia@…, schmunk@…, udbraumann, rotbart@…, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), Serge3leo (Serguei E. Leontiev)
Port: llvm-3.1 llvm-3.2 llvm-3.3

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 (6)

main.log (728.3 KB) - added by cjones051073 (Chris Jones) 7 years ago.
clang-3.1-build.log (1.1 MB) - added by cjones051073 (Chris Jones) 7 years ago.
llvm.patch (1016 bytes) - added by jeremyhu (Jeremy Huddleston Sequoia) 7 years ago.
llvm Portfile patch
main.2.log (736.1 KB) - added by cjones051073 (Chris Jones) 7 years ago.
main-clang-debug.log (4.3 MB) - added by deesto (John S. De Stefano Jr.) 6 years ago.
Portfile.diff (1.2 KB) - added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) 3 years ago.

Change History (56)

Changed 7 years ago by cjones051073 (Chris Jones)

Attachment: main.log added

comment:1 Changed 7 years ago by mf2k (Frank Schima)

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

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

comment:2 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

: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 7 years ago by cjones051073 (Chris Jones)

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 7 years ago by cjones051073 (Chris Jones)

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 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

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 7 years ago by cjones051073 (Chris Jones)

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

Chris

Changed 7 years ago by cjones051073 (Chris Jones)

Attachment: clang-3.1-build.log added

Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Attachment: llvm.patch added

llvm Portfile patch

comment:7 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Status: newassigned

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

comment:8 Changed 7 years ago by cjones051073 (Chris Jones)

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 7 years ago by cjones051073 (Chris Jones)

Attachment: main.2.log added

comment:9 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

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

comment:10 Changed 7 years ago by cjones051073 (Chris Jones)

Any progress on fixing this ?

comment:11 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

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 7 years ago by cjones051073 (Chris Jones)

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 7 years ago by jmroot (Joshua Root)

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 years ago by russel@…

Cc: russel@… added

Cc Me!

comment:15 Changed 6 years 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 Changed 6 years 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 6 years ago by cjones051073 (Chris Jones)

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.

comment:21 Changed 6 years ago by larryv (Lawrence Velázquez)

Cc: deesto@… added
Port: llvm-3.3 added
Summary: python3: llvm-3.1 fails to build with python3 selectedllvm-3.1, llvm-3.3: fails to build with python3 selected

Has duplicate #39700 against llvm-3.3.

comment:22 Changed 6 years ago by larryv (Lawrence Velázquez)

Cc: larryv@… added

Cc Me!

comment:23 Changed 6 years ago by deesto (John S. De Stefano Jr.)

Confirmed that switching the port Python version to 2.7 gets around this, even in {llvm|clang}-3.3, but it's kind of a messy hack.

comment:24 Changed 6 years ago by larryv (Lawrence Velázquez)

Cc: robitaille@… added
Port: llvm-3.2 added
Summary: llvm-3.1, llvm-3.3: fails to build with python3 selectedllvm-3.{1,2,3}: fail to build with python3 selected

Has duplicate #38800 against llvm-3.2. I can’t reproduce with llvm-3.0, though.

Changed 6 years ago by deesto (John S. De Stefano Jr.)

Attachment: main-clang-debug.log added

comment:25 Changed 6 years ago by deesto (John S. De Stefano Jr.)

Unfortunately a port select switch to python 2.7 does not completely work after all in my case; after a python 2.7 port switch, and port clean, clang-3.3 fails to upgrade:

In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>
         ^
1 error generated.
make[4]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/tools/clang/runtime/compiler-rt/clang_darwin/profile_osx/i386/SubDir.lib__profile/GCDAProfiling.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>

See attached debug log. I can file a separate ticket if warranted.

comment:26 Changed 6 years ago by jeremyhu (Jeremy Huddleston Sequoia)

You are missing your system headers.

comment:27 in reply to:  26 Changed 6 years ago by deesto (John S. De Stefano Jr.)

Replying to jeremyhu@…:

You are missing your system headers.

Thanks Jeremy. How've I been running ports for >5 years without them? :/

comment:28 in reply to:  25 ; Changed 6 years ago by larryv (Lawrence Velázquez)

Replying to deesto@…:

Unfortunately a port select switch to python 2.7 does not completely work after all in my case; after a python 2.7 port switch, and port clean, clang-3.3 fails to upgrade:

In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>
         ^
1 error generated.
make[4]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/tools/clang/runtime/compiler-rt/clang_darwin/profile_osx/i386/SubDir.lib__profile/GCDAProfiling.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>

See attached debug log. I can file a separate ticket if warranted.

This is #39605.

comment:29 Changed 5 years ago by mymacports@…

Cc: mymacports@… added

Cc Me!

comment:30 in reply to:  28 ; Changed 5 years ago by mymacports@…

same problem here.

clang-3.3 fails to upgrade.

OS X 10.8.4

Availability.h is in /usr/include

yes, this is 39605.

unfortunately 39605 was (prematurely, imo) marked as 'invalid' ..

Replying to larryv@…:

Replying to deesto@…:

Unfortunately a port select switch to python 2.7 does not completely work after all in my case; after a python 2.7 port switch, and port clean, clang-3.3 fails to upgrade:

In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>
         ^
1 error generated.
make[4]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/tools/clang/runtime/compiler-rt/clang_darwin/profile_osx/i386/SubDir.lib__profile/GCDAProfiling.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_lang_llvm-3.3/clang-3.3/work/llvm-3.3.src/projects/compiler-rt/lib/profile/GCDAProfiling.c:26:
/opt/local/include/sys/stat.h:75:10: fatal error: 'Availability.h' file not found
#include <Availability.h>

See attached debug log. I can file a separate ticket if warranted.

This is #39605.

comment:31 in reply to:  30 Changed 5 years ago by larryv (Lawrence Velázquez)

Replying to mymacports@…:

yes, this is 39605.

unfortunately 39605 was (prematurely, imo) marked as 'invalid'

Irrelevant. Keep your comments on that ticket if your issue is with Availability.h.

comment:32 Changed 5 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:33 Changed 5 years ago by larryv (Lawrence Velázquez)

Cc: marc@… added

Has duplicate #40115.

comment:34 Changed 5 years ago by samuelandjw

Cc: samuelandjw@… added

Cc Me!

comment:35 Changed 5 years ago by larryv (Lawrence Velázquez)

Cc: manuel.deljesuspe@… bonoba@… added

Has duplicate #40850.

comment:36 Changed 5 years ago by michaelbartz@…

Cc: michaelbartz@… added

Cc Me!

comment:37 Changed 5 years ago by ryandesign (Ryan Schmidt)

Cc: iemejia@… added

Has duplicate #40966.

comment:38 Changed 5 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Port: llvm-3.3 removed
Summary: llvm-3.{1,2,3}: fail to build with python3 selectedllvm-3.{1,2}: fail to build with python3 selected

3.3 and 3.4 fixed with r113409

comment:39 Changed 4 years ago by schmunk@…

Cc: schmunk@… added

Cc Me!

comment:40 Changed 4 years ago by schmunk@…

Same here with python34 and llvm-3.3. I had to switch back to python27.

comment:41 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: llvm-3.{1,2}: fail to build with python3 selectedllvm-X.Y: fail to build with python3 selected

comment:42 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Owner: changed from jeremyhu@… to larryv@…
Status: assignednew

comment:43 Changed 4 years ago by jeremyhu (Jeremy Huddleston Sequoia)

We don't want to add extra build dependencies to llvm where we can avoid it as it is too low-level in the toolchain. We should just force using the system python instead if needed.

comment:44 in reply to:  38 ; Changed 4 years ago by ryandesign (Ryan Schmidt)

Replying to jeremyhu@…:

3.3 and 3.4 fixed with r113409

This only changed the pythonXY variants in the clang-X.Y subports. Those pythonXY variants have since been deleted and the clang-X.Y subports now always use python27. But the bug report was about the llvm-X.Y ports, not clang-X.Y. With python 3.4.2 selected, I had no problem just now building llvm-3.7 @3.7-r235803 or llvm-3.5 @3.5.2 or llvm-3.4 @3.4.2. But llvm-3.3 @3.3 still has the problem. So I guess in llvm-3.4 they fixed the incompatibility with python 3.

comment:45 Changed 4 years ago by larryv (Lawrence Velázquez)

Cc: braumann@… added
Port: llvm-3.3 added

Has duplicate #48167.

comment:46 Changed 4 years ago by ryandesign (Ryan Schmidt)

Cc: rotbart@… added

Has duplicates #48256, #48257.

comment:47 Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Keywords: haspatch added

I just ran into this.
Attached is a proposed solution.

comment:48 Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: mcalhoun@… added

Cc Me!

Changed 3 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Attachment: Portfile.diff added

comment:49 Changed 18 months ago by Serge3leo (Serguei E. Leontiev)

Cc: Serge3leo added

comment:50 in reply to:  44 Changed 9 months ago by cjones051073 (Chris Jones)

Replying to ryandesign:

Replying to jeremyhu@…:

3.3 and 3.4 fixed with r113409

This only changed the pythonXY variants in the clang-X.Y subports. Those pythonXY variants have since been deleted and the clang-X.Y subports now always use python27. But the bug report was about the llvm-X.Y ports, not clang-X.Y. With python 3.4.2 selected, I had no problem just now building llvm-3.7 @3.7-r235803 or llvm-3.5 @3.5.2 or llvm-3.4 @3.4.2. But llvm-3.3 @3.3 still has the problem. So I guess in llvm-3.4 they fixed the incompatibility with python 3.

So...., if this issue is fixed in llvm-3.4 and newer, can we now close this ticket as we probably no longer really care about the older versions ?

Last edited 9 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:51 Changed 9 months ago by pmetzger (Perry E. Metzger)

cjones051073: you opened the ticket. If you feel it should be closed, I'll close it.

comment:52 Changed 9 months ago by cjones051073 (Chris Jones)

be gone !!

comment:53 Changed 9 months ago by cjones051073 (Chris Jones)

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.