Help about "dlopen error"

There are several things I don’t understand when I am compiling a macro by using this command:

.L macroName.C+

The problem is that it will give an error like:

dlopen error: /home/dypang/actar/ActarSim/./analysisMacro_C.so: undefined symbol: _ZN11sciGeometry11ShowMembersER16TMemberInspectorPc
Load Error: Failed to load Dynamic link library /home/dypang/actar/ActarSim/./analysisMacro_C.so

Another amazing thing is that: I just copied “analysisMacro.C” to “testMacro.C”. Since in “analysisMacro.C” we include a head file “analysis.h”, I made a copy

cp analysis.h testMacro.h

and changed the corresponding include in file “testMacro.C” from

#include "analysis.h"

to

#include "testMacro.h"

otherwise, file “testMacro.C” is exactly the same as the file “analysisMacro.C”.

But the result of compiling is not exactly the same: for one macro the “dlopen error” seems to relate to a “sciGeometry” class which is defined in the “analysis.h” file (and the “testMacro.h” file since it is just the copy of “analysis.h”) but another one seems to relate to a “amplificationManager” class which is defined in another head file included in both macros.

Why there are these differences in the error information of these two macros? The two macros are the same to me: the only difference in them is that one includes “analysis.h” and another one includes “testMacro.h”. But “analysis.h” and “testMacro.h” are exactly the same (except for their file names…)

Enclosed please find the output of these compilations.

Thank you in advance for your answers!

Pang
compile-output-2.txt (4.28 KB)
compile-output-1.txt (5.58 KB)

Hi,

what happens if you tell ACLiC to rebuild the libraries by running .L file.C++ (i.e. two pluses at the end)? It might be that the library built from file.C is older than its dependencies - though ACLiC should take that into account.

Also, if you include a header file then the class’s code must be available, too - which usually means that you will have to load its library. I.e. for a file A.C containing #include “MyCode.h” you’ll have to load the corresponding libMyCode.so before you can run ACLiC on A.C.

Cheers, Axel.

Thanks for your help.

[quote=“Axel”]Hi,
what happens if you tell ACLiC to rebuild the libraries by running .L file.C++ (i.e. two pluses at the end)? It might be that the library built from file.C is older than its dependencies - though ACLiC should take that into account.
[/quote]

It gives the same information when I put two pluses.

In my “MyCode.h” file all class member methods are defined in it. Do you mean that I should compile this “MyCode.h” and make a library file?

Still, what is the reason why when compiling “analysisMacro.C” and “testMacro.C” it gives different error information? These two files are identical to me. I estimate their error information should be the same…

Hi,

By default ACLiC generate the dictionary for only the symbol defined in the script and any include header with the same name. So when your script is named testMacro, it generates the dictionary for the classes defined in testMacro.C and testMacro.h. When your script is named analysisMacro, it generates the dictionary for the classes defined in analysisMacro.C and analysisMacro.h.

In both case, the error are of the style: " undefined reference to `sciGeometry::ShowMembers(TMemberInspector&, char*)’" which indicates that you have a ClassDef macro for the class sciGeometry (this is a good thing) but you have not (well ACLiC did not) generate the dictionary for the class sciGeometry. To solve the problem once and for all, just add the following lines at the end of your .C file:#ifdef __MAKECINT__ #pragma link C++ class sciGeometry+; #pragma link C++ class amplificationManager+; #endifwhich will insure that ACLiC generates the dictionary for your classes no matter what the name of the script and header files are.

Cheers,
Philippe

Thank you Philippe!

My problem is solved with your suggestion :slight_smile: