collective / buildout.python

Buildout all the Pythons
109 stars 47 forks source link

Python 2.5 build failure on OSX Lion #9

Closed miohtama closed 10 years ago

miohtama commented 12 years ago

Not yet sure what's causing this - I upgraded from Snow Leopard to Lion:

    gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -DSVNVERSION=\"`LC_ALL=C svnversion .`\" -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
    i686-apple-darwin11-llvm-gcc-4.2: directory": No such file or directory
    <command-line>: warning: missing terminating " character
    ./Modules/getbuildinfo.c: In function ‘_Py_svnversion’:
    ./Modules/getbuildinfo.c:48: error: missing terminating " character
    ./Modules/getbuildinfo.c:48: error: expected expression before ‘;’ token
    make: *** [Modules/getbuildinfo.o] Error 1
    python-2.5-build: cmmi failed: /var/folders/qm/hv_hmt7d6pz_vdgpl20q9j200000gn/T/tmpS3xmT3buildout-python-2.5-build
    While:
      Installing python-2.5-build.

c.b.python worked on another computer with similar set-up two weeks ago. Digging...

miohtama commented 12 years ago

My guess is that svnversion command somehow fails.

I have it installed though:

    [~/code/python]% svnversion
    Unversioned directory
miohtama commented 12 years ago

Well, it must fail if it related to c.p.buildout you are using Github checkout? :)

hannosch commented 12 years ago

This might be the same SVN 1.7 issue that's patched for Python 2.6 in https://github.com/collective/buildout.python/blob/master/src/python26.cfg#L63. Maybe that can be adjusted for Python 2.5 as well. I guess nobody else is using 2.5 anymore, so nobody noticed.

mauritsvanrees commented 12 years ago

Workaround would be to temporarily switch back to svn 1.6 during this buildout run. IIRC that was how I 'fixed' it for Python2.6 before the fix in python26.cfg was available.

Python2.5 still works here for me, but I am still on Snow Leopard. Ah, no, it does not work here either, so I guess I will use that workaround or see if 2.6 fix can be applied here.

fschulze commented 11 years ago

So was this only a problem with the svn checkout? If so cloning the git repository instead should fix it.

mauritsvanrees commented 11 years ago

No, this is still a problem. It has got nothing to do with the underlying versioning system.

When building Python 2.5 the error occurs. The fix that Hanno mentions for Python2.6 (applying the patch from issue-svn17.txt) should help here, but I did not manage to get that working when I tried it a few months ago.

The workaround for me is to run sudo port activate subversion @1.6.17_1, then run the buildout and then activate the latest subversion 1.7 again.

woutervh commented 11 years ago

As far as this is related, I had similar build-failure on opensuse-64bit:

 /tmp/tmpR1H54ybuildout-python-2.5-build/Python-2.5.6 >  make
 gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -  DPy_BUILD_CORE -DSVNVERSION=\"`LC_ALL=C svnversion .`\" -o Modules/getbuildinfo.o   ./Modules/getbuildinfo.c
gcc: error: directory": Bestand of map bestaat niet
make: *** [Modules/getbuildinfo.o] Fout 1

I added this to mypython25.cfg wich made it build succesfully

  [python-2.5-build:linux2-suse-x86_64]
  <= python-2.5-build:default
  patch = ${buildout:python-buildout-root}/issue-svn17.txt
miohtama commented 11 years ago

Hmm looks very nice @WouterVH - we can do this for Ubuntu. OSX and others too?

mauritsvanrees commented 11 years ago

I tried this or something similar last year on OS X and it did not help (though it should). I tried it again just now and it failed again. This is my change:

$ g diff
diff --git a/src/python25.cfg b/src/python25.cfg
index 4b21598..4fc8d9d 100644
--- a/src/python25.cfg
+++ b/src/python25.cfg
@@ -35,7 +35,8 @@ environment =

 [python-2.5-build:darwin-lion]
 <= python-2.5-build:default
-patch = ${buildout:python-buildout-root}/python-2.5-darwin-10.6.patch
+patches = ${buildout:python-buildout-root}/python-2.5-darwin-10.6.patch
+          ${buildout:python-buildout-root}/issue-svn17.txt
 environment =
     CFLAGS=-arch x86_64

Tried with patch instead of patches too. Maybe I am simply changing the wrong lines, but I am on Lion, Mac OSX 10.8.2.

The fix does not seem to have an effect. The error is:


gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -DSVNVERSION=\"`LC_ALL=C svnversion .`\" -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
i686-apple-darwin11-llvm-gcc-4.2: directory": No such file or directory
<command-line>: warning: missing terminating " character
./Modules/getbuildinfo.c: In function ‘_Py_svnversion’:
./Modules/getbuildinfo.c:48: error: missing terminating " character
./Modules/getbuildinfo.c:48: error: expected expression before ‘;’ token
make: *** [Modules/getbuildinfo.o] Error 1
python-2.5-build: cmmi failed: /var/folders/b3/4fkrg4_17ms0pwmwh0xy41_w0000gn/T/tmpAZP2PWbuildout-python-2.5-build
While:
  Installing python-2.5-build.

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.buildout-1.4.4-py2.6.egg/zc/buildout/buildout.py", line 1683, in main
    getattr(buildout, command)(args)
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.buildout-1.4.4-py2.6.egg/zc/buildout/buildout.py", line 555, in install
    installed_files = self[part]._call(recipe.install)
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.buildout-1.4.4-py2.6.egg/zc/buildout/buildout.py", line 1227, in _call
    return f()
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.recipe.cmmi-1.3.5-py2.6.egg/zc/recipe/cmmi/__init__.py", line 113, in install
    self.build()
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.recipe.cmmi-1.3.5-py2.6.egg/zc/recipe/cmmi/__init__.py", line 196, in build
    self.cmmi(dest)
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/monkeycmmi-0.2-py2.6.egg/monkeycmmi/__init__.py", line 36, in cmmi
    system("make %s" % make_options)
  File "/Users/mauritsvanrees/buildout/python2.5/eggs/zc.recipe.cmmi-1.3.5-py2.6.egg/zc/recipe/cmmi/__init__.py", line 34, in system
    raise SystemError("Failed", c)
SystemError: ('Failed', 'make ')

svn is 1.7.8, svnversion returns this:

$ svnversion
Unversioned directory
$ cd <some subversion checkout>
$ svnversion 
49189:49190
$ svn up
Updating '.':
At revision 49219.
$ svnversion 
49219
fschulze commented 10 years ago

Can you test again with latest master? I'm now using collective.recipe.cmmi 0.5 which allows multiple patch files.

mauritsvanrees commented 10 years ago

Ah, now bin/buildout finishes correctly and I can startup python. Progress! Thanks.

But when I try to import something (anything it seems), I get strange errors:

$ python2.5
Python 2.5.6 (r256:88840, Oct 11 2012, 20:14:10) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import itertools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/mauritsvanrees/buildout/python2.5/python-2.5/lib/python2.5/lib-dynload/itertools.so, 2): no suitable image found.  Did find:
    /Users/mauritsvanrees/buildout/python2.5/python-2.5/lib/python2.5/lib-dynload/itertools.so: mach-o, but wrong architecture
>>> from operator import attrgetter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/mauritsvanrees/buildout/python2.5/python-2.5/lib/python2.5/lib-dynload/operator.so, 2): no suitable image found.  Did find:
    /Users/mauritsvanrees/buildout/python2.5/python-2.5/lib/python2.5/lib-dynload/operator.so: mach-o, but wrong architecture

This is after running buildout from scratch (I did rm -rf python-2.5/ parts/ .installed.cfg). OSX 10.8.5.

mauritsvanrees commented 10 years ago

Just checked to be sure: a fresh python2.7 created with this buildout works fine.

Note that I hardly use Python2.5, so for me this issue is not that important.

In case it matters:

$ uname -a
Darwin procyon 12.5.0 Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64
fschulze commented 10 years ago

The biggest difference I see on my machines (lion 10.7.5 and mountain lion 10.8.3) is the gcc version: [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin

Mine use LLVM, yours uses Clang. Not sure whether that could be the cause and how to switch.

fschulze commented 10 years ago

I have upgraded to 10.8.5 and also updated XCode. I now get clang, but it still claims to be LLVM. I have no trouble importing modules.

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.76)] on darwin

mauritsvanrees commented 10 years ago

It works now. At first I used Python 2.6 to run the bootstrap.py and now I use 2.7, maybe that did the trick: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

fschulze commented 10 years ago

Hmm, weird. On OS X one should use the system Python /usr/bin/python. You seem to use one from MacPorts. But nice to hear that it works now. Will close this ticket.