VERITAS-Observatory / EventDisplay_v4

A reconstruction and analysis pipeline for VERITAS.
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Makefile issue with VTargets when compiling libVAnaSum #159

Closed steob92 closed 2 years ago

steob92 commented 2 years ago

Hi,

There appears to be an issue with VTargets when compiling using libVAnasum. I compiled EventDisplay with make anasum ; make slib

I have a minimum piece of code to compile to reproduce the error:

#include "VEffectiveAreaCalculatorMCHistograms.h"

using namespace std;

int main()
{
    cout << "Hello world" << endl;
    return 0;
}

To compile I run the following and get the error:

g++ minimum.cpp -o minimum.o -I$EVNDISPSYS/inc -L$EVNDISPSYS/lib `root-config --cflags --glibs` -lVAnaSum  -lMLP -lTMVA  -lMinuit -lXMLIO -lSpectrum -lgsl -lmkl_rt
/mnt/Storage/Software/anaconda3/envs/VER-Sims/bin/../lib/gcc/x86_64-conda-linux-gnu/9.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /mnt/Storage/AnalysisSoft/EventDisplay_v4_python/lib/libVAnaSum.so: undefined reference to `VTargets::selectTargetbyName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/mnt/Storage/Software/anaconda3/envs/VER-Sims/bin/../lib/gcc/x86_64-conda-linux-gnu/9.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /mnt/Storage/AnalysisSoft/EventDisplay_v4_python/lib/libVAnaSum.so: undefined reference to `VTargets::getTargetRAJ2000()'
/mnt/Storage/Software/anaconda3/envs/VER-Sims/bin/../lib/gcc/x86_64-conda-linux-gnu/9.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /mnt/Storage/AnalysisSoft/EventDisplay_v4_python/lib/libVAnaSum.so: undefined reference to `VTargets::getTargetDecJ2000()'
/mnt/Storage/Software/anaconda3/envs/VER-Sims/bin/../lib/gcc/x86_64-conda-linux-gnu/9.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /mnt/Storage/AnalysisSoft/EventDisplay_v4_python/lib/libVAnaSum.so: undefined reference to `VTargets::VTargets()'
collect2: error: ld returned 1 exit status

Adding $EVNDISPSYS/obj/VTargets.o and recompiling works fine:

g++ minimum.cpp $EVNDISPSYS/obj/VTargets.o -o minimum.o -I$EVNDISPSYS/inc -L$EVNDISPSYS/lib `root-config --cflags --glibs` -lVAnaSum  -lMLP -lTMVA  -lMinuit -lXMLIO -lSpectrum -lgsl -lmkl_rt

Maybe VTargets is missing somewhere in the makefile?

GernotMaier commented 2 years ago

VTargets is one of the oldest classes in Eventdisplay and has the Crab and a laser run hardwired. It was required when we did not have a database and one has to tell the code kind of source a given run is.

Let's not spend time on this but remove the class completely. I've done this, and there is pull request #161 , but that pull request was done unfortunately on top of another branch (so don't merge). That branch is accidentally waiting for feedback from you :-)

As a quick solution: remove VTargets from VSkyCoordinates.cpp/h should work for you and should allow for compilation.

steob92 commented 2 years ago

Awesome!

FYI I'm just waiting on some analysis to finish (should be by the end of today) to look at that branch!