Undefined symbols in PyROOT (MacOSX 10.3)


I just built Root4 with Python enabled in Mac OSX 10.3. The build seems to have been completely successful (no errors or other problems) and I can run root, make plots, etc. All seems normal.

However I cannot successfully import ROOT in a Python script – i.e., “from ROOT import gROOT” fails. The error message shown below seems to indicate that I have not linked against all the needed libraries. What did I miss and how can I correct this?

Incidentally I was just trying to run the trivial example from the root.cern.ch/root/HowtoPyROOT.html page (“Running PyROOT from Python Interpreter”) when this failure occured.

Python 2.3.2 (#2, Oct 26 2003, 16:42:41)
[GCC 3.1 20020420 (prerelease)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in ?
File “/Users/jima/root/lib/ROOT.py”, line 26, in ?
from libPyROOT import *
ImportError: Failure linking new module: : dyld: /Library/Frameworks/Python.framework/Versions/2.3/Resources/Python.app/Contents/MacOS/python Undefined symbols:

This problem will be investigated next week by Wim Lavrijsen


Try tracing down the problem with just one of the unresolved symbols:

nm libCint.so | grep add_compiled
0006e9f1 T G__add_compiledheader

libPyROOT should reference libCint.so, which contains the actual G__add_compiledheader method.

This may be a case of symbol mangling (Something your compiler did) being that there is a trailing underscore before the symbol name in your case. This could also just be how python prints out the symbol.


nm libPyROOT.so | grep add_compiled
U G__add_compiledheader

If you see _G__add_compiledheader and it isn’t the same symbol in libCint.so, symbol mangling is your problem, you could probably fix it by making a dummy _G__add_compiledheader (to satisfy the reference) that calls an extern “C” G__add_compiledheader;

It’s possible the libPyROOT.so didn’t get built to reference libCint:

ldd libPyROOT.so
libCint.so => /home/jason/root/lib/libCint.so (0x408bf000)

Are all of the ROOT libraries in your library path? Can libPyROOT find its shared object dependencies?

-Jason Thomas.