Re: root and cernlib

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri May 29 1998 - 08:41:07 MEST


Thierry Auger wrote:
> 
> Hi all,
> I have created a root interface on Sun for a fortran package which does use
> some cernlib calls( atg,prob,reqn). I produce a shared library to dynamically
> load my application. When I try to run it from the interactive session, it
> doesn't find the cernlib functions and dies saying :
> 
> root [0] gSystem->Load("libkinfit.so")
> root [1] TKinfit t
> root [2] t.Test()
>  DIAGNOSTIC OUTPUT  -  NY,NF,ND = 10, 4, 4
> 0VAR.  PULL   ERROR      CORRELATION MATRIX
>   1    0.00  0.1000E-04   1.00
>   2    0.00  0.4000E-04   0.00  1.00
>   3    0.00  0.4000E-04   0.00  0.00  1.00
> ld.so.1: ./root.exe: fatal: relocation error: symbol not found: prob_:
> referenced in /home/auger/ANALYSE/src/lib/libkinfit.so
> Killed
> 
> I tried Rene's suggestion (roottalk feb 25 98) to compile my own root with
> statements like this: extern "C" Double_t denlan_(Double_t x); for each
> cernlib function I use. But it still crashes so I don't know what I am doing
> wrong. How could I have the cernlib object code included into root?
> 
> Thierry Auger.
> auger@cebaf.gov

Thierry,
Meanwhile, I have written an HOWTO on this subject. See
  http://root.cern.ch/root/HowtoCERNLIB.html

In particular, note the dummy calls to the Fortran routines
in the C++ main program. Some compilers/linkers are smart enough
to not link the routine if no explicit call to it is found.

The only good solution to this problem would be to have CERNLIB
compiled with the option Position Independent Code. If this was the
case, one could easily invoke any CERNLIB routine from a shared library.
Please make pressure to get this option!

In case, you still have problems, please iterate with me directly.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET