Error making shared lib on osx (dictionary issue?)

Hello

I’m trying to compile a package called SpartyJet (pa.msu.edu/~huston/SpartyJet/SpartyJet.html) and while making shared library, I get

Undefined symbols: "operator==(TString const&, char const*)", referenced from: SpartyJet::BranchWrap_array<double, 100>::registerBranch(TTree*) in OutputVarUtils.o SpartyJet::BranchWrap_array2D<double, 100, 5>::registerBranch(TTree*) in OutputVarUtils.o <snip> "_G__double", referenced from: G__JetCoreDict_193_0_22(G__value*, char const*, G__param*, int)in JetCoreDict.o G__JetCoreDict_193_0_22(G__value*, char const*, G__param*, int)in JetCoreDict.o <snip>

which seem to be related to dictionary looking for unknown reference.

I tried compiling on an SLC4 machine and it works (it has another problem further down in the compilation step but this process passes), so I’m guessing there is something specific about osx and dictionary generation. Is there any known issues?

Cheers
Akira

Hi,

It looks like you need to link again libCore (where operator==(TString const&, char const*) is defined).

Cheers,
Philippe.

Thanks for help. Indeed that took care of “==”. Still a question why it works OK on linux but moving on…

Now I have

Undefined symbols: "_G__double", referenced from: G__JetCoreDict_193_0_22(G__value*, char const*, G__param*, int)in JetCoreDict.o G__JetCoreDict_193_0_22(G__value*, char const*, G__param*, int)in JetCoreDict.o G__JetCoreDict_193_0_22(G__value*, char const*, G__param*, int)in JetCoreDict.o G__JetCoreDict_193_0_23(G__value*, char const*, G__param*, int)in JetCoreDict.o G__JetCoreDict_193_0_23(G__value*, char const*, G__param*, int)in JetCoreDict.o

JetCore is the name of subpackage I’m compiling. Could it be that something is missing from dictionary generation?

Cheers
Akira

Hi again,

So I included a bunch of things to get rid of all these things and left with

Undefined symbols: "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [libJetCore.so] Error 1

which now seems a mac thing. Any idea what this is?

[quote]"_G__double"[/quote]You need libCint …

[quote]Thanks for help. Indeed that took care of “==”. Still a question why it works OK on linux but moving on…[/quote]You must be somehow asking (directly or indirectly) for ‘full closure’ of the libraries (where all symbol must be resolved at link time of the library instead of at load time like on linux).

Cheers,
Philippe.

Hi

I’m doing the following g++ command

[quote]g++ -shared -O2 -fpic …/libs/…/libs/CalchepPartonTextInput.o …/libs/…/libs/CommonUtils.o …/libs/…/libs/EConversionTool.o …/libs/…/libs/GetJets.o …/libs/…/libs/HepMCInput.o …/libs/…/libs/JetAlgorithm.o …/libs/…/libs/OutputVarUtils.o …/libs/…/libs/InputMaker.o …/libs/…/libs/InputMaker_Ntuple.o …/libs/…/libs/Jet.o …/libs/…/libs/JetCollection.o …/libs/…/libs/JetMomentMap.o …/libs/…/libs/JetMomentTool.o …/libs/…/libs/JetNegEnergyTool.o …/libs/…/libs/JetSelectorTool.o …/libs/…/libs/JetTool.o …/libs/…/libs/LorentzVector.o …/libs/…/libs/NtupleMaker.o …/libs/…/libs/JetBuilder.o …/libs/…/libs/StdTextInput.o …/libs/…/libs/JetCoreDict.o -o …/libs/libJetCore.so /usr/local/root_versions/root_v5.21.06/lib/libPhysics.so /usr/local/root_versions/root_v5.21.06/lib/libCint.so /usr/local/root_versions/root_v5.21.06/lib/libCore.so /usr/local/root_versions/root_v5.21.06/lib/libRIO.so /usr/local/root_versions/root_v5.21.06/lib/libTree.so /usr/local/root_versions/root_v5.21.06/lib/libMathCore.so
[/quote]

in case this helps…

Cheers
Akira

[quote]Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libJetCore.so] Error 1 [/quote]This means the compiler thinks you are asking for an executable (which also explains its looking for all the symbols).

Cheers,
Philippe

[quote]g++ -shared -O2 -fpic [/quote]Does not work on mac.

Try g++ -O2 -dynamiclib -single_module -undefined dynamic_lookup

Cheers,
Philippe

Hi Philippe

That did the trick, very good to know about this. Thanks a lot!

Akira