Snow Leopard : --enable-python (no Fink)

Hello,

I am aware that there is already a thread on a similar issue but it is becoming confusing because some people are using fink. I’m having trouble compiling with --enable-python with ROOT 5.25.02. I’m using Snow Leopard out of the box as far as python is concerned:

$ which python /Library/Frameworks/Python.framework/Versions/Current/bin/python

and

python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information.

Here is what I do

$ pwd -P
/Applications/ROOT_versions
$ echo $ROOTSYS
/Applications/ROOT_versions/root_5.25.02
$ tar -xf ~/Downloads/root_v5.25.02.source.tar ; mv root $ROOTSYS
$ cd $ROOTSYS
$ ./configure --enable-python
$ make -j2

After some time I get the following error

In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:57,
                 from bindings/pyroot/src/PyROOT.h:33,
                 from bindings/pyroot/src/Adapters.cxx:2:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyport.h:730:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
a.out

I’m looking for a clue on the web and there are some mention of platform incompatibility but I don’t quite get to the bottom of it.

Cheers
Akira[/code]

Hi again,

I notice that the error indicates that the include file from python 2.5 is being used. Apparently there is some configuration issue. But where?

Akira

Akira,

what does your LD_LIBRARY_PATH look like? The python executable contains very little functionality: the main application is in the shared library. It is therefore possible to start p2.5 from the p2.5 shared library through the p2.6 executable and v.v. (versioning of the shared library itself, rather than the directory in which it resides, would solve that).

Cheers,
WIm

Hi Wim

I have $ echo $LD_LIBRARY_PATH /Applications/ROOT_versions/root_5.25.02/lib:/lib:/Applications/sage/local/lib:

The sage/local/lib does contain some python stuff, so I got rid of it and started from scratch. Same result still…

Cheers
Akira

Akira,

just to be sure … did you re-run configure after changing LD_LIBRARY_PATH?

Another option would be to specify --with-python-incdir= and --with-python-libdir= explicitly to configure.

Cheers,
WIm

Hi Wim,

Yes I had done it and I’d also done make clean and it still did the same thing.

I cleaned up the whole directory and started from untar again. I still have the same problem. I tried to set the paths explicitly and noticed something odd

[code]$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

^D

$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python

$ /Library/Frameworks/Python.framework/Versions/Current/bin/python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

[/code]

Looking further, I see

[code]$ ll /Library/Frameworks/Python.framework/Versions/
total 8
drwxrwxr-x 12 root admin 408B Jan 26 2009 2.5
lrwxr-xr-x 1 root admin 3B Jan 26 2009 Current → 2.5

~$ ll /System/Library/Frameworks/Python.framework/Versions/
total 8
drwxr-xr-x 8 root wheel 272B Sep 28 14:13 2.3
drwxr-xr-x 12 root wheel 408B Sep 30 11:04 2.5
drwxr-xr-x 12 root wheel 408B Sep 30 11:04 2.6
lrwxr-xr-x 1 root wheel 3B Sep 28 14:13 Current → 2.6
[/code]

So when I say which python, system picks the path from /Library… but what it is really running is /System/Library… Wim, do you know what’s happening here?

Anyhow, I did the following:

$ ./configure --enable-python --with-python-incdir=/System/Library/Frameworks/Python.framework/Versions/Current/include/python2.6/ --with-python-libdir=/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/

This time compilation finishes successfully but I see no sign that pyroot is compiled.

>>> from ROOT import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named ROOT
>>> 

Cheers
Akira
[/quote]

So my attempt continues. Moved the apparently irrelevant python directory

out to somewhere invisible. Now configure picks up the right library/include paths. And finally I can use pyroot! However, I have two problems. One is that, wherever I use pyroot, a file called ‘-’ (hyphen) gets created. This is an empty file. The other problem is that after I exit python, my input does not show up on my terminal anymore. I can type and execute commands but my commands are not visible on the shell…

I’ll continue to investigate.

Akira

Thew problem with “_” has been fixed about 1 week ago in the SVN trunk.

Rene

Hi,

Thanks Rene. So besides the ‘-’ problem, my shell still won’t show what I’m typing after I use pyroot. But I found that if in the same shell, I start and quit root, then it goes back to normal…

Cheers
Akira

Hi,

actually, both issues (prompt disappearing and “-”) have been fixed in the trunk.

Cheers, Axel.

Thank you all for your help. I confirm that all is fine in the trunk.

Akira

Hi,

Just to make sure, before moving from 5.25.02 to the version on trunk:
I only have the problem of loosing the shell configuration in pyroot and after accessing some variable or class, like

import ROOT ROOT.kBlack
Is this fixed?

Thanks,
Bruno

This I don’t know. The problem with lost prompt is indeed fixed in the trunk. I think my trouble was related to updating from Leopard to SnowLeopard.