Python bundle/dylib error when using ACLiC via ProcessLine

This is a strange error, and I have not been able to find useful posts online, so bear with the vague info.

I have some source files that I can compile with ACLiC without problems:

*  ROOT v6.00/00  *

root [0] .L daqT.C+
root [1] .L JFTrackFit.C+
root [2] .L MydaqT.C+
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/jfcaron/Projects/Proto2BeamTest2/./MydaqT_C.so
root [3] .q

When I try to do the same thing from PyROOT using ROOT.gROOT.ProcessLine, here’s what I get:

Python 2.7.7 (default, Jun 10 2014, 15:08:24) 
Type "copyright", "credits" or "license" for more information.

IPython 2.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [2]: import ROOT

In [3]: ROOT.gROOT.ProcessLine(".L daqT.C+")
Out[3]: 0L

In [4]: ROOT.gROOT.ProcessLine(".L JFTrackFit.C+")
Out[4]: 0L

In [5]: ROOT.gROOT.ProcessLine(".L MydaqT.C+")
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/jfcaron/Projects/Proto2BeamTest2/./MydaqT_C.so
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in <ACLiC>: Compilation failed!
Out[5]: 0L

In [6]: 

here I type Ctrl+D to exit python, but it hangs until I press Ctrl+C, then I get this:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/magics/script.py", line 264, in kill_bg_processes
    time.sleep(0.1)
KeyboardInterrupt
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/magics/script.py", line 264, in kill_bg_processes
    time.sleep(0.1)
KeyboardInterrupt

I think the two problems are related since they both involve Python’s time module. I am using ROOT 6.00.00 compiled myself, and Python 2.7.7 from MacPorts. Both are compiled with the clang++ provided by XCode, while the Fortran part of ROOT is compiled with MacPorts GCC4.8. My code for the files that I am trying to compile with ACLiC can be found at http://bazaar.launchpad.net/~jfcaron/+junk/Proto2BeamTest2/files.

Thanks for any help, let me know if there are any useful commands I can use that will generate more information (otool, nm, etc).

Jean-François

Hi,

I cannot reproduce the issue because of a customisation you apparently added to your root installation:
{code}
t2x.C:43:72: error: no member named ‘kSTEFFEN’ in namespace 'ROOT::Math::Interpolation’
static const M::Interpolation::Type default_type = M::Interpolation::kSTEFFEN;
{code}
The compilation of daqT.C runs just fine in my case, both with root, python and ipython.
Did you try to use python instead of ipython?

Cheeers,
D

Thanks for trying to reproduce. The customization is not essential, if you change kSTEFFEN to kAKIMA, it should work with a default ROOT installation. I forgot to mention the slight customization, but that’s the extent of it, adding an item to an enum. The customization allows me to use a new interpolation method in the trunk of GSL.

I tried using regular python instead of IPython. I get the same error when compiling MydaqT.C+, but it doesn’t do the crash when I try to Ctrl+D to exit.

Jean-François

I should have spotted this earlier:

the first two files daqT.C and t2x.C weren’t being recompiled because the source files hadn’t changed. MydaqT.C had changed, so it was trying to recompile that one and failing. If I touch daqT.C, then I get the error on that file. Indeed this doesn’t seem to be about any specific macro file, even a tiny trivial macro returns a similar error:

jfcaron@jfcaron-MacBook:~/Projects/Proto2BeamTest2/code_test$ cat tuple.C
#ifndef __MAKECINT__
#include <tuple>
#endif
#include <array>
#include <utility>
int foo() {
  int a,b;
  std::tie(a,b)= std::make_pair(5,6);
  return a;
}

trying to compile:

Python 2.7.7 (default, Jun 10 2014, 15:08:24) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.gROOT.ProcessLine(".L tuple.C+")
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/jfcaron/Projects/Proto2BeamTest2/code_test/./tuple_C.so
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline/readline.so' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in <ACLiC>: Compilation failed!
0L

This time the error is in readline.so, not time.so. Oddly enough, if I try to compile the same tuple.C in IPython instead of regular python, the error is in lib-dynload/cStringIO.so. Strange.

I also tried re-compiling my ROOT in case it was linked to an old version of python somehow (though I’ve been with 2.7 for years, 2.7.7 is only a few weeks old), but the problem didn’t change.

Jean-François

Hi,

I tried to reproduce the issue w/o success on mac and linux (on the latter even with ipython).
This is what I get
{code}
XXX-MacBook-Pro-2:~/RootDevel/Root6/build$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
ROOT.>>> ROOT.gInterpreter.ProcessLine(“.L foo.C++”)
Info in TMacOSXSystem::ACLiC: creating shared library /Users/danilopiparo/RootDevel/Root6/build/foo_C.so
0L
{code}
Can you imagine something fishy in your setup?

Cheers,
Danilo