I am trying to generate a shared library for use interactively in Root with rootcint. Apologies if I’ve missed a recent post where this is described, the most recent comprehensive Root Talk discussion on it I could find is from several years ago.
I have getnu.cc and getnu.h, straightforward C code except it uses GMP. I have generated a shared library and linked successfully against it with g++ but haven’t been able to generate a library which Root likes. I load the library with gSystem->Load(“libgetnu.so”) but get the error:
dlopen error: /usr/local/bin/cernroot/rootv5.20/lib/libgetnu.so: cannot open shared object file: No such file or directory
Load Error: Failed to load Dynamic link library /usr/local/bin/cernroot/rootv5.20/lib/libgetnu.so
(int)(-1)
*** Interpreter error recovered ***
*** Interpreter error recovered ***
despite the fact that the library is certainly there. This is what I do in Root v5.20:
nulinkdef.h contains:
#ifdefCINT #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ defined_in getnu.h #endif
Are the file ‘readable’? Are they on a remote file system that may or may not be update ‘fast’ enough? Are you sure you are not mixing 32bit and 64bit builds? Can you provide a tar file containing an example reproducing this problem?
The files are not on a remote system, they are on the internal hard drive. It does seem that Root does not see them. It’s possible I’m mixing 32 and 64 bit builds - but I don’t see how. I’m using the Root binary that came with the 64 bit build of Root downloaded from the Root webpage.
I tried with both ACLiC and rootcint on a very simple set of test files with the same results. In test.cc:
void test(bool x, double y) {
if(x) y+=4.;
}
In test.h:
In ACLiC I get:
root [0] gSystem->AddIncludePath(" -I/home/potter/temp")
root [0] .x test.cc++
Info in <TUnixSystem::ACLiC>: creating shared library /home/potter/temp/./test_cc.so
Warning: link requested for unknown srcfile /home/potter/temp/./test.h file08wFgXlinkdef.h:8:
Error: Function test() is not defined in current scope :0:
Are the file ‘readable’? Are they on a remote file system that may or may not be update ‘fast’ enough? Are you sure you are not mixing 32bit and 64bit builds? Can you provide a tar file containing an example reproducing this problem?