pyRoot on macosx 10.6

Hello,
I’m having problem in using pyroot on my mac (10.6.8 ). I’ve followed the instructions and installed latest version of root by source, with this command:
./configure macosx --enable-python --with-python-incdir=/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/ --with-python-libdir=/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/

These are the versions:
uname -a: Darwin 10.8.0 Darwin Kernel Version 10.8.0 root:xnu-1504.15.3~1/RELEASE_I386 i386
root version: root_v5.32.00
python version:Python 2.6.1
gcc: GCC 4.2.1

Configuration variables:

ROOT

export ROOTSYS=/Applications/root/root_v5.32.00
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib/:$LD_LIBRARY_PATH

#PYTHON
export PYTHONDIR=/System/Library/Frameworks/Python.framework/Versions/2.6/
export LD_LIBRARY_PATH=$PYTHONDIR/lib:$LD_LIBRARY_PATH
export PATH=$PYTHONDIR/bin:$PATH
export DYNLOADFILE=“dynload_shlib.o” #don’t know if useful

Both root and python are compiled for i386:

lipo -info which root: Non-fat file: /Applications/root/root_v5.32.00/bin/root is architecture: i386
lipo -info /Applications/root/root_v5.32.00/lib/libPyROOT.so : Non-fat file: /Applications/root/root_v5.32.00/lib/libPyROOT.so is architecture: i386
lipo -info which python: Architectures in the fat file: /System/Library/Frameworks/Python.framework/Versions/2.6//bin/python are: x86_64 i386 ppc7400

When using python to import ROOT, I obtain:

python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in
File “lib/ROOT.py”, line 85, in
import libPyROOT as _root
ImportError: dlopen(/Applications/root/root_v5.32.00/lib/libPyROOT.so, 2): no suitable image found. Did find:
/Applications/root/root_v5.32.00/lib/libPyROOT.so: mach-o, but wrong architecture

I’ve also found an old thread in this list, dated 2010,


in which the problem was not solved completely. My question is then, if you have some recipes to make it working or it is an unsolved issue.
Thanks a lot, francesca

Francesca,

if you don’t use “macosx” as an option to the configure script, it will most likely configure for x86_64. The python executable that you have, seems to have both and by default probably starts up as x86_64 rather than i386, so it can’t do anything with the i386 only libPyROOT.so.

Either run arch i386 python or rebuild all for x86_64 should do the trick, I think.

Cheers,
Wim

Hi Jim,

I tried both, with different results and errors:

  1. try to compile root for x86_64:

./configure macosx64 --enable-python --with-python-incdir=/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/ --with-python-libdir=/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/
make clean
make


++ -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name @rpath/libASImage.so -O2 -m64 -mmacosx-version-min=10.6 -o lib/libASImage.so graf2d/asimage/src/TASImage.o graf2d/asimage/src/TASPluginGS.o graf2d/asimage/src/G__ASImage.o -ldl -Llib -lGraf -lMathCore lib/libAfterImage.a -L/usr/X11/lib -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -lfreetype -lz -L/usr/X11/lib -lpng -lz -L/usr/X11R6/lib -lXpm -L/usr/X11R6/lib -lXext -lX11 -Llib -lCore -lCint
ld: warning: in lib/libAfterImage.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_blend_scanlines_name2func", referenced from:
TASImage::CreateThumbnail() in TASImage.o
TASImage::Merge(TImage const*, char const*, int, int)in TASImage.o


_prepare_scanline", referenced from:
TASImage::Gray(bool) in TASImage.o
"_scale_asimage", referenced from:
TASImage::CreateThumbnail() in TASImage.o

  1. use python for i386:

arch -arch i386 python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT

*** Break *** bus error

Thread 1 (process 13103):
#0 0x0000000000000000 in ?? ()

Again, any suggestion?
Cheers, francesca

Francesca,

for the first, using the --enable-builtin-afterimage with ./configure may do the trick. For the second, I’m surprised that the bus error shows a 64b address, even as it is to be a 32b executable that is being run?

Cheers,
Wim