Failed to load Dynamic

Hi,

I am getting an error I do not understand. When I run this program as a standalone C++ app everything works fine but when I run it under root it gives me the following error:


root [0] .L libraries.C
root [1] .x fitlength.C
dlopen error: /afs/fnal.gov/files/code/e875/rhbob/nova/fortran/reco/socal/lib/libRecoEvent.so: undefined symbol: _ZN16LongitudinalBlobC1Ev
Load Error: Failed to load Dynamic link library /afs/fnal.gov/files/code/e875/rhbob/nova/fortran/reco/socal/lib/libRecoEvent.so
*** Interpreter error recovered ***

What is obvious here is that the LongitudinalBlob object is defined in a different directory from RecoEvent above (libRecoEvent.so); it is defined in the NeuralBlob directory.

Now libraries.C containes the NeuralBlobs.so which contains the LongitudinalBlob object:

gSystem->Load(“libPhysics”);
gSystem->Load("$SOCAL_DIR/lib/libEvent.so");
gSystem->Load("$SOCAL_DIR/lib/libMessage.so");
gSystem->Load("$SOCAL_DIR/lib/libReadoutSim.so");
gSystem->Load("$SOCAL_DIR/lib/libConnectionMap.so");
gSystem->Load("$SOCAL_DIR/lib/libDisplay.so");
gSystem->Load("$SOCAL_DIR/lib/libREROOT_Classes.so");
gSystem->Load("$SOCAL_DIR/lib/libGeometry.so");
gSystem->Load("$SOCAL_DIR/lib/libConfig.so");

gSystem->Load("$SOCAL_DIR/lib/libPhotonTransport.so");
gSystem->Load("$SOCAL_DIR/lib/libREROOT_Classes.so");

gSystem->Load("$SOCAL_DIR/lib/libGeometry.so");
gSystem->Load("$SOCAL_DIR/lib/libNeuralBlobs.so");
gSystem->Load("$SOCAL_DIR/lib/libRecoEvent.so");
gSystem->Load("$SOCAL_DIR/lib/libTruthFilter.so");


and I have LongitudinalBlob in the LinkDef.hh:


#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ namespace SoCal;
#pragma link C++ class LongitudinalBlob+;
#pragma link C++ class BlobResult+;
#pragma link C++ class NeuralBlob+;

#endif


Running as a standalone program means I have the following in my .cxx:

#include
#include
#include
#include
#include <TMath.h>
#include “ShowerFcn.h”
#include “Minuit2/FCNBase.h”
#include “Minuit2/MnUserTransformation.h”
#include “Minuit2/MinuitParameter.h”
#include “Minuit2/MnUserParameters.h”
#include “Minuit2/MnMigrad.h”
#include “Minuit2/FunctionMinimum.h”
#include “Minuit2/MnMinos.h”
#include “TRandom3.h”
#include “TH1.h”
#include “TF1.h”
#include “TVirtualFitter.h”
#include “TStyle.h”
#include “TFitterMinuit.h”
#include “TSystem.h”
#include “TTree.h”
#include “TCanvas.h”
#include “TBranch.h”
#include “TBrowser.h”

#include “/afs/fnal.gov/files/code/e875/rhbob/nova/fortran/reco/socal/NeuralBlobs/LongitudinalBlob.h”
#include “/afs/fnal.gov/files/code/e875/rhbob/nova/fortran/reco/socal/NeuralBlobs/BlobResult.h”

using namespace std;
using namespace ROOT::Minuit2;


and the code works perfectly – no problem with LongitudinalBlob. I would guess somehow I am not telling ACLiC or CINT the right thing, but I have no idea what. The fact that if I just run it outside of ROOT everything is OK tells me I am using ROOT incorrectly.

–thanks, Robert Bernstein

Hi,

I assume your LongitudinalBlob is missing a virtual function implementation. How do you assert that the library containing LongitudinalBlob has all the functions it needs when you run outside ROOT? Do you link against libRecoEvent.so and pick up the same library containing LongitudinalBlob as ROOT does?

Axel.

Hi,

Thanks for answering.

First, LongitudinalBlob actually has no methods. I originally defined it as a struct, got this error, and worried structs had been deprecated somehow.

I have also tried .x fitlength and .x fitlength++ and get the same result.

Answering your question, LongitudinalBlob is defined as a class and used in another class called BlobResult. BlobResult is picked up fine – I can use any of the members (all doubles, etc, nothing fancy) except LongitudinalBlob. I needed to define LongitudinalBlob the way I did to avoid writing a bunch of copy constructors.

Here is BlobResult.h :

#include “TTree.h”
#include “TObject.h”
#include “NeuralBlob.h”
#include “TruthFilter/TruthFilter.h”
#include "LongitudinalBlob.h"
using namespace std;

class BlobResult: public TObject{
public:
BlobResult(){}
~BlobResult(){}

void BlobResultFill(NeuralBlob*, Int_t EventNumber, Bool_t passRejectHadrons, Bool_t passRejectLeptons);

public:
Double_t biggestBlobEnergyX;
Double_t biggestBlobEnergyY;
Double_t biggestBlobLengthX;
Double_t biggestBlobLengthY;
Double_t biggestBlobWidthX;
Double_t biggestBlobWidthY;
Double_t biggestBlobBeginningVertexX;
Double_t biggestBlobBeginningVertexY;
Double_t biggestBlobBeginningZVertexX;
Double_t biggestBlobBeginningZVertexY;
Double_t biggestBlobfracWithinMoliereX;
Double_t biggestBlobfracWithinMoliereY;
Bool_t RejectHadrons;
Bool_t RejectLeptons;
Bool_t DontKnow;
Int_t EventNumber;
vector biggestBlobDevelopmentX;
vector biggestBlobDevelopmentY;

ClassDef(BlobResult,1)
};

and here is LongitudinalBlob.h:

#ifndef LONGITUDINALBLOB_H
#define LONGITUDINALBLOB_H
#include
#include
#include <TObject.h>
#include <TROOT.h>
#include <TSystem.h>
#include <TTree.h>
#include <TDirectory.h>
#include <TStyle.h>
#include <TProfile.h>
#include <TObject.h>

using namespace std;

class LongitudinalBlob: public TObject{
public:
LongitudinalBlob();
virtual ~LongitudinalBlob();
Int_t PhysicalPlane;
Double_t PlanePulseHeight;
string PlaneType;
private:
ClassDef(LongitudinalBlob,1)
};
#endif

and the implementation file:

#include "LongitudinalBlob.h"
using namespace std;
ClassImp(LongitudinalBlob)

LongitudinalBlob::LongitudinalBlob(){}
LongitudinalBlob::~LongitudinalBlob(){}

–thanks, bob

Hi Bob,

[quote=“RBernstein”]First, LongitudinalBlob actually has no methods. class LongitudinalBlob: public TObject{ public: LongitudinalBlob(); virtual ~LongitudinalBlob(); ... private: ClassDef(LongitudinalBlob,1) };[/quote]
So it does have methods. And it uses ClassDef, which means you’ll have to create a dictionary for it (using rootcint). Do you?

Can you check with “nm -C $SOCAL_DIR/lib/libNeuralBlobs.so” that LongitudinalBlob’s constructor, destructor, and e.g. the ShowMembers method are all defined in the library?

Axel.

You’re right, it does have the default constructor/destructor.

Here are some excerpts from the nm command. Today I am going to put everything in the same directory and see if I still get the problem.

Thanks for being so helpful! --bob

00057f96 t _GLOBAL__D__ZN10BlobResult14BlobResultFillEP10NeuralBlobibb
0005c380 t _GLOBAL__D__ZN10NeuralBlobC2Ebbbbb
00058f62 t _GLOBAL__D__ZN16LongitudinalBlobC2Ev
00067f9c t _GLOBAL__D__ZN4ROOT20GenerateInitInstanceEPK16LongitudinalBlob

0005d10c T LongitudinalBlob::Class_Name()
0005d14e T LongitudinalBlob::Dictionary()
0005e928 T LongitudinalBlob::ShowMembers(TMemberInspector&, char*)
000683b0 W LongitudinalBlob::DeclFileLine()
000683a6 W LongitudinalBlob::DeclFileName()
0005d132 T LongitudinalBlob::ImplFileLine()
0005d116 T LongitudinalBlob::ImplFileName()
00068036 W LongitudinalBlob::Class_Version()
0006838c W LongitudinalBlob::StreamerNVirtual(TBuffer&)
0005d170 T LongitudinalBlob::Class()
000de794 B LongitudinalBlob::fgIsA
0005e8d0 T LongitudinalBlob::Streamer(TBuffer&)
00058a84 W LongitudinalBlob::operator=(LongitudinalBlob const&)
00058974 W LongitudinalBlob::LongitudinalBlob(LongitudinalBlob const&)
00058d48 T LongitudinalBlob::LongitudinalBlob()
00058cf8 T LongitudinalBlob::LongitudinalBlob()
00058e68 T LongitudinalBlob::~LongitudinalBlob()
00058e00 T LongitudinalBlob::~LongitudinalBlob()
00058d98 T LongitudinalBlob::~LongitudinalBlob()

Hi,

I just talked with Philippe and he told me that since Longitudinal Blob and RecoEvent use each other’s libraries this sets up a circular reference CINT cannot resolve, so my move to the same directory and making one library should work. I am now trying to get that to work right. --thanks, bob