RE: Python and C++ code calling ROOT

From: Marc de Kamps <dekamps_at_comp.leeds.ac.uk>
Date: Fri, 18 Jul 2008 12:16:25 +0100


Dear Rootteam,

If this is what's happening, is it difficult to adapt, i.e. to "mark" libGX11.so so that it is aware that it is dependent on libCore.so?

Thanks,
Marc

#-----Original Message-----
#From: Paul Russo [mailto:russo_at_fnal.gov]
#Sent: 15 July 2008 20:39
#To: Marc de Kamps
#Cc: roottalk_at_lxbuild091.cern.ch
#Subject: Re: [ROOT] Python and C++ code calling ROOT
#
#Marc,
#
#This is happening because libGX11.so is dependent on symbols in libCore.so
#but is not marked that way, so dlopen does not know it should load
#libCore.so when it loads libGX11.so. The ROOT application itself uses
#a plugin architecture with external metadata to determine the
#interdependencies
#between the various shareable libraries that together make up the ROOT
#library set (see the *.rootmap files in $ROOTSYS/lib).
#
#The simplest way around this problem for you is to build a static version
#of the root library from the source code using "make static". This will
#make a libROOT.a file which you can then link with your code, avoiding
#all problems with *.so files.
#
#-- Paul Russo
#
#Marc de Kamps wrote:
#> Hi,
#>
#>
#>
#> As I mentioned last week I have C++ code which calls ROOT. Using SWIG I
#> create a Python module. The idea is that from Python I can call my C++
#> routines, which call ROOT.
#>
#>
#>
#> This turns out to be problematic. I have to link against a library which
#> is linked against the core ROOT libraries (root-config -libs). Python
#> then crashes on importing my SWIG generated libraries.
#>
#>> >> import Dynamic
#>
#> dlopen error: /usr/not-backed-up/root/lib/root/libGX11.so: undefined
#> symbol: _ZNK7TObject7DoErrorEiPKcS1_Pc
#>
#> Load Error: Failed to load Dynamic link library
#> /usr/not-backed-up/root/lib/root/libGX11.so
#>
#> Error in <TCint::AutoLoad>: failure loading library libGX11.so for class
#> TGX11
#>
#> Error in <TPluginHandler::SetupCallEnv>: class TGX11 not found in plugin
#> GX11
#>
#>
#>
#> Followed by a core dump. Apparently autoload is called but fails. Is
#> there anything I can do about this?
#>
#>
#>
#> Repeating the same exercise with root-config -glibs has the same result.
#>
#>
#>
#> If I don't link my libraries against ROOT I get:
#>
#> Python 2.5 (r25:51908, Apr 10 2007, 10:29:13)
#>
#> [GCC 4.1.2 20070403 (Red Hat 4.1.2-8)] on linux2
#>
#> Type "help", "copyright", "credits" or "license" for more information.
#>
#>> >> import Dynamic
#>
#> Traceback (most recent call last):
#>
#> File "<stdin>", line 1, in <module>
#>
#> File "Dynamic.py", line 7, in <module>
#>
#> import _Dynamic
#>
#> ImportError: /tmp/code/build/libs/DynamicLib/libmiinddynamic.so:
#> undefined symbol: _ZN10TCanvasImp11ShowMembersER16TMemberInspectorPc
#>
#>> >>
#>
#> (which seems reasonable)
#>
#>
#>
#> I use root 5.19/02 on FEDORA Linux
#>
#>
#>
#> I have also tried to load libCore.so directly into Python using
#> LoadLibrary. This does not work because it complains about a missing
#> symbol in libCint.so. If I try to load libCInt it complains about a
#> missing symbol in libCore.so ..
#>
#>
#>
#>
#>
#>
#>
#> -
#>
#> Dr. Marc de Kamps
#>
#> Biosystems Group
#>
#> School of Computing
#>
#> University of Leeds
#>
#> LS29JT, Leeds, UK
#>
#>
#>
#> dekamps_at_comp.leeds.ac.uk <mailto:dekamps_at_comp.leeds.ac.uk>
#>
#> http:/www.comp.leeds.ac.uk/dekamps
#>
#>
#>
Received on Fri Jul 18 2008 - 13:17:28 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 18 2008 - 17:50:01 CEST