MadAnalysis / madanalysis5

A package for event file analysis and recasting of LHC results
http://madanalysis.irmp.ucl.ac.be
GNU General Public License v3.0
22 stars 18 forks source link

MadAnalysis 5 not recognizing Python 3 on MacOS 12 #94

Closed snehadrid closed 2 years ago

snehadrid commented 2 years ago

Question

Operating system: macOS v12.4 Python version: 3.9.1 gcc/c++ version:

Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

MadAnalysis 5 version: 1.9.6

Hi, I recently updated my MacOS from Big Sur to Monterey and MadAnalysis 5 is now 1) Not recognizing my version of python 3 and giving me a warning about deprecated python 2 detection. python --version still returns Python 3.9.1 so I'm not sure why it's not being detected. When I remove Python 2.7, it simply does not detect any version of Python. The warning is

MA5: Checking mandatory packages: 
MA5-WARNING: Python version 2.7.18 detected.
MA5-WARNING: Python 2 functionality is deprecated, and will no longer be supported in a close future.

2) Failing while attempting to link the project. The error is

MA5:    Component 4/13 - library: interface to zlib
MA5:      - Cleaning the project before building the library ...
MA5:      - Compiling the source files ...
MA5:      - Linking the library ...
MA5-ERROR: impossible to link the project. For more details, see the log file:
MA5-ERROR: /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Interfaces/linking_zlib.log
MA5-ERROR: The library building aborted.

This is the output of the log file.

c++ -shared -o ../Lib/libzlib_for_ma5.so zlib/gz_streambase.o  -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib -lz -lcommons_for_ma5
ld: warning: ignoring file /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib/libz.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_gzclose", referenced from:
      MA5::gz_streambuf::~gz_streambuf() in gz_streambase.o
      MA5::gz_streambuf::close() in gz_streambase.o
  "_gzoffset", referenced from:
      MA5::gz_streambuf::tellg() in gz_streambase.o
  "_gzopen", referenced from:
      MA5::gz_streambuf::open(char const*, int) in gz_streambase.o
  "_gzread", referenced from:
      MA5::gz_streambuf::underflow() in gz_streambase.o
  "_gzwrite", referenced from:
      MA5::gz_streambuf::~gz_streambuf() in gz_streambase.o
      MA5::gz_streambuf::flush_buffer() in gz_streambase.o
      MA5::gz_streambuf::overflow(int) in gz_streambase.o
      MA5::gz_streambuf::sync() in gz_streambase.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [link] Error 1

I have tried re-installing MadAnalysis after the OS update but it hasn't worked. Thanks!

jackaraz commented 2 years ago

Hi @snehadrid

Not recognizing my version of python 3 and giving me a warning about deprecated python 2 detection. python --version still returns Python 3.9.1 so I'm not sure why it's not being detected. When I remove Python 2.7, it simply does not detect any version of Python.

Could you try to run MadAnalysis with the following command

/PATH/TO/PYTHON/EXE/python bin/ma5

macOS still has python 2.7 as default python so it is likely that it can not see your newer python version. This might be due to your PYTHONPATH configuration.

Failing while attempting to link the project. The error is

Have you installed zlib through ma5? your local version might not be the one that we support.

hope it helps.

snehadrid commented 2 years ago

The python path fix did get rid of the warning, thanks! Installing zlib through madgraph also got rid of that message, but I now get the similar error

MA5-ERROR: impossible to link the project. For more details, see the log file:
MA5-ERROR: /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Interfaces/linking_fastjet.log
MA5-ERROR: The library building aborted.

I imagine I have to now install fastjet through ma5, but I can't do so since ma5 will not compile. Is there an option to open ma5 without fastjet so it will compile and I can install it at that point? Thanks!

jackaraz commented 2 years ago

Hi @snehadrid

You can use the following portion of the file to veto the local FastJet installation. https://github.com/MadAnalysis/madanalysis5/blob/8faaff08c3c2f4865a9a6e8584e05ee4ef9239cc/madanalysis/input/installation_options.dat#L32-L34

Note that you will still see some issues if different compilers have been used to compile third-party software. That's why I would suggest installing everything through MadAnalysis (except for ROOT) for consistency.

snehadrid commented 2 years ago

Thanks, that worked!

I'm now having trouble with linking to root, presumably because of the same path issue at with python. I downloaded the newest version root but I still run into errors, even when sourcing the root I just downloaded. Is there some way to specify the path of the root I want to use to run ma5? Also, how would I permanently change the root and python paths to the correct ones? Thanks!

snehadrid commented 2 years ago

Sorry, I forgot to include the error.

c++ -shared -o ../Lib/libroot_for_ma5.so root/ROOTReader.o root/RootMainHeaders.o root/TreeReaderBase.o  -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib -L/Users/localmacaccount/Downloads/root/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/Users/localmacaccount/Downloads/root/lib -stdlib=libc++ -lpthread -lm -ldl -lEG -lcommons_for_ma5 -L/Users/localmacaccount/Downloads/root/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/Users/localmacaccount/Downloads/root/lib -stdlib=libc++ -lpthread -lm -ldl -lEG
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libImt.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libCore.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libRIO.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libNet.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libGraf.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libHist.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libGraf3d.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libGpad.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libROOTVecOps.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libTree.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libRint.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libTreePlayer.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libMatrix.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libPostscript.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libMathCore.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libPhysics.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libMultiProc.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libThread.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libROOTDataFrame.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/localmacaccount/Downloads/root/lib/libEG.so, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "TVersionCheck::TVersionCheck(int)", referenced from:
      __GLOBAL__sub_I_ROOTReader.cpp in ROOTReader.o
      __GLOBAL__sub_I_RootMainHeaders.cpp in RootMainHeaders.o
      __GLOBAL__sub_I_TreeReaderBase.cpp in TreeReaderBase.o
  "ROOT::GetROOT()", referenced from:
      MA5::ROOTReader::ReadHeader(MA5::SampleFormat&) in ROOTReader.o
  "TFile::Open(char const*, char const*, char const*, int, int)", referenced from:
      MA5::ROOTReader::Initialize(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, MA5::Configuration const&) in ROOTReader.o
  "TObject::fgObjectStat", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  "TObject::AddToTObjectTable(TObject*)", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  "TObject::~TObject()", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  "vtable for TLorentzVector", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for TObject", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for TVector3", referenced from:
      ToTLorentzVector(MA5::MALorentzVector const&) in RootMainHeaders.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [link] Error 1
snehadrid commented 2 years ago

I resolved it, I just reinstalled root into the directory it was suggesting. Is it possible to set the default python path? Thanks!

jackaraz commented 2 years ago

Hi @snehadrid, that depends on what base language you are using. In bash, you can set up a ~/.bash_profile and include your paths there, just like in Linux, which is executed when you open a terminal. But macOS has a zsh base which I'm not familiar with, so I suggest doing a google search on how to set up your PYTHONPATH (or how to change your base to bash depending on your taste).

BFuks commented 2 years ago

Hi,

In order to do this, you can simply add an “export PYTHONPATH = …” line in the file /etc/zshrc.

Cheers,

Benjamin

On 16 Jun 2022, at 23:10, Jack Y. Araz @.***> wrote:

Hi @snehadrid https://github.com/snehadrid, that depends on what base language you are using. In bash, you can set up a ~/.bash_profile and include your paths there, just like in Linux, which is executed when you open a terminal. But macOS has a zsh base which I'm not familiar with, so I suggest doing a google search on how to set up your PYTHONPATH (or how to change your base to bash depending on your taste).

— Reply to this email directly, view it on GitHub https://github.com/MadAnalysis/madanalysis5/issues/94#issuecomment-1158133843, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWJNJ3GPTQXDTAMD4PTAZ3VPOJ5VANCNFSM5Y7FKYJA. You are receiving this because you are subscribed to this thread.

snehadrid commented 2 years ago

Thank you both so much. Unfortunately I've received another error when trying to produce a cutflow, and the files referenced actually do exist this time.

--------------------------------------------------------
    Your environment is properly configured for MA5     
--------------------------------------------------------
localmacaccount@H4TGP0XSQ6W2 Build % make           
-e --------------------------------------------------------
-e                 Building MadAnalysis Job                
-e --------------------------------------------------------
-e --------------------------------------------------------
-e                       Compilation                       
-e --------------------------------------------------------
clang++ -Wall -O3 -fPIC -I/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/ -I./ -stdlib=libc++ -pthread -std=c++17 -m64 -I/opt/homebrew/Cellar/root/6.26.04/include/root -o Main/main.o -c Main/main.cpp
clang++ -Wall -O3 -fPIC -I/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/ -I./ -stdlib=libc++ -pthread -std=c++17 -m64 -I/opt/homebrew/Cellar/root/6.26.04/include/root -o SampleAnalyzer/User/Analyzer/direct_electrons_800_gev.o -c SampleAnalyzer/User/Analyzer/direct_electrons_800_gev.cpp
-e --------------------------------------------------------
-e                         Linking                         
-e --------------------------------------------------------
clang++ Main/main.o SampleAnalyzer/User/Analyzer/direct_electrons_800_gev.o  -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib -L/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/ExternalSymLink/Lib -lprocess_for_ma5 -lprocess_for_ma5 -L/opt/homebrew/Cellar/root/6.26.04/lib/root -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/opt/homebrew/Cellar/root/6.26.04/lib/root -stdlib=libc++ -lpthread -lm -ldl -lEG -lcommons_for_ma5 -o ./MadAnalysis5job
ld: warning: ignoring file /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libprocess_for_ma5.so, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libcommons_for_ma5.so, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "MA5::LogService::SetVerbosityLevel(MA5::LogService::VerbosityLevel)", referenced from:
      MA5::LogService::LogService() in main.o
      MA5::LogService::LogService() in direct_electrons_800_gev.o
  "MA5::LogService::Service_", referenced from:
      Info(MA5::SampleAnalyzer&) in main.o
      _main in main.o
      MA5::ManagerBase<MA5::AnalyzerBase>::Print(std::__1::vector<MA5::AnalyzerBase*, std::__1::allocator<MA5::AnalyzerBase*> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, unsigned int> > > const&, MA5::LogStream&) const in main.o
      MA5::direct_electrons_800_gev::Initialize(MA5::Configuration const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) in direct_electrons_800_gev.o
  "MA5::PhysicsService::service_", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::SampleAnalyzer::Initialize(int, char**, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::PostInitialize()", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::UpdateProgressBar()", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::InitializeAnalyzer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&)", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::Finalize(std::__1::vector<MA5::SampleFormat, std::__1::allocator<MA5::SampleFormat> >&, MA5::EventFormat&)", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::NextFile(MA5::SampleFormat&)", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::NextEvent(MA5::SampleFormat&, MA5::EventFormat&)", referenced from:
      _main in main.o
  "MA5::SampleAnalyzer::SampleAnalyzer()", referenced from:
      _main in main.o
  "MA5::SortingService::service_", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::MALorentzVector::MALorentzVector(MA5::MAVector3 const&, double)", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::MALorentzVector::MALorentzVector()", referenced from:
      MA5::PhysicsService::PhysicsService() in direct_electrons_800_gev.o
  "MA5::MALorentzVector::~MALorentzVector()", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
      MA5::PhysicsService::PhysicsService() in direct_electrons_800_gev.o
  "MA5::ExceptionService::Display(MA5::ExceptionType const&)", referenced from:
      void MA5::RegionSelectionManager::AddCut<13>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [13]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddCut<26>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [26]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddCut<4>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [4]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddHisto<13>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, double, double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [13]) in direct_electrons_800_gev.o
      MA5::Histo::Histo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, double, double) in direct_electrons_800_gev.o
  "MA5::ExceptionService::Service_", referenced from:
      void MA5::RegionSelectionManager::AddCut<13>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [13]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddCut<26>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [26]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddCut<4>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [4]) in direct_electrons_800_gev.o
      void MA5::RegionSelectionManager::AddHisto<13>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, double, double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const (&) [13]) in direct_electrons_800_gev.o
      MA5::Histo::Histo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, double, double) in direct_electrons_800_gev.o
  "MA5::TransverseVariables::GetMT2()", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::RegionSelectionManager::ApplyCut(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::RegionSelectionManager::FillHisto(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, double)", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::endmsg(MA5::LogStream&)", referenced from:
      Info(MA5::SampleAnalyzer&) in main.o
      _main in main.o
      MA5::ManagerBase<MA5::AnalyzerBase>::Print(std::__1::vector<MA5::AnalyzerBase*, std::__1::allocator<MA5::AnalyzerBase*> > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, unsigned int> > > const&, MA5::LogStream&) const in main.o
      MA5::direct_electrons_800_gev::Initialize(MA5::Configuration const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecLeptonFormat const*, std::__1::vector<MA5::RecTowerFormat, std::__1::allocator<MA5::RecTowerFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationCalorimeter::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationCombined::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecLeptonFormat const*, std::__1::vector<MA5::RecTrackFormat, std::__1::allocator<MA5::RecTrackFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationTracker::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationCombined::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double, MA5::IsolationEFlow::ComponentType) const in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecLeptonFormat const*, std::__1::vector<MA5::RecParticleFormat, std::__1::allocator<MA5::RecParticleFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationEFlow::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecLeptonFormat const*, MA5::RecEventFormat const*, double const&, double, MA5::IsolationEFlow::ComponentType) const in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecPhotonFormat const*, std::__1::vector<MA5::RecTowerFormat, std::__1::allocator<MA5::RecTowerFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationCalorimeter::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationCombined::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecPhotonFormat const*, std::__1::vector<MA5::RecTrackFormat, std::__1::allocator<MA5::RecTrackFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationTracker::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationCombined::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double, MA5::IsolationEFlow::ComponentType) const in direct_electrons_800_gev.o
  "MA5::IsolationBase::sumPT(MA5::RecPhotonFormat const*, std::__1::vector<MA5::RecParticleFormat, std::__1::allocator<MA5::RecParticleFormat> > const&, double const&, double) const", referenced from:
      MA5::IsolationEFlow::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double) const in direct_electrons_800_gev.o
      MA5::IsolationEFlow::sumIsolation(MA5::RecPhotonFormat const*, MA5::RecEventFormat const*, double const&, double, MA5::IsolationEFlow::ComponentType) const in direct_electrons_800_gev.o
  "MA5::Isolation::JetCleaning(std::__1::vector<MA5::RecJetFormat const*, std::__1::allocator<MA5::RecJetFormat const*> > const&, std::__1::vector<MA5::RecLeptonFormat const*, std::__1::allocator<MA5::RecLeptonFormat const*> > const&, double, double) const", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::MAVector3::PseudoRapidity() const", referenced from:
      MA5::direct_electrons_800_gev::Execute(MA5::SampleFormat&, MA5::EventFormat const&) in direct_electrons_800_gev.o
  "MA5::MAVector3::DeltaR(MA5::MAVector3 const&) const", referenced from:
      std::__1::vector<MA5::RecLeptonFormat const*, std::__1::allocator<MA5::RecLeptonFormat const*> > Removal<MA5::RecLeptonFormat, MA5::RecLeptonFormat>(std::__1::vector<MA5::RecLeptonFormat const*, std::__1::allocator<MA5::RecLeptonFormat const*> >&, std::__1::vector<MA5::RecLeptonFormat const*, std::__1::allocator<MA5::RecLeptonFormat const*> >&, double const&) in direct_electrons_800_gev.o
  "vtable for MA5::WriterTextBase", referenced from:
      MA5::AnalyzerBase::AnalyzerBase() in main.o
      MA5::AnalyzerBase::~AnalyzerBase() in main.o
      MA5::AnalyzerBase::~AnalyzerBase() in direct_electrons_800_gev.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for MA5::Histo", referenced from:
      MA5::Histo::Histo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, double, double) in direct_electrons_800_gev.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for MA5::SAFWriter", referenced from:
      MA5::AnalyzerBase::AnalyzerBase() in main.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [link] Error 1
localmacaccount@H4TGP0XSQ6W2 Build % 
jackaraz commented 2 years ago

Hi @snehadrid, have you typed source setup.sh before compilation?

snehadrid commented 2 years ago

Yes, I have. I think that's what prompts the "Your environment is properly configured for MA5" notice at the top.

jackaraz commented 2 years ago

Hi @snehadrid, your ROOT installation requires std=c++17, which has been observed to interfere with the rest of the MadAnalysis built in macOS. I don't have a solution for ROOT/Delphes in macOS unfortunately (maybe @BFuks or @econte-cms can weigh in here). Could you try to compile without root? If that doesn't work then there is a deeper issue with your system configuration that we need to look into. MadAnalysis v1.9.60 does not support c++17, which doesn't lead to many problems in Linux machines but we observed some subtleties with macOS. From v1.10+ the c++ support will be extended.

snehadrid commented 2 years ago

Thanks, @jackaraz. I receive the same error when compiling without root.

jackaraz commented 2 years ago

Hi @snehadrid it looks like the ma5 libraries are built with a different compiler i.e. you are compiling with arm64 but the libraries seem to be compiled via x86_64. Please make sure that you are compiling with the same backend.

snehadrid commented 2 years ago

I do have an arm64 chip. I attempted to reinstall ma5 through MadGraph and ran into an error when building the SampleAnalyzer libraries, at the linking root stage again (Now linking_root.log does not exist in the Interfaces folder). MadGraph then attempted to reinstall ma5 with the option --no_root_in_MA5. This is the output.

MA5:    Component 8/11 - library: interface to Root
MA5:      - Cleaning the project before building the library ...
MA5-DEBUG: LogFile: /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Interfaces/mrproper_root.log
MA5-DEBUG: Makefile: Makefile_root
MA5-DEBUG: Command: make mrproper --file=Makefile_root
MA5:      - Compiling the source files ...
MA5:      - Linking the library ...
MA5-ERROR: impossible to link the project. For more details, see the log file:
MA5-ERROR: /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Interfaces/linking_root.log
MA5-ERROR: The library building aborted.

Default installation of Madanalys5 failed.
MG5aMC will now attempt to reinstall it with the options '--no_MA5_further_install --no_root_in_MA5'.
This will however limit MA5 applicability for hadron-level analysis.
If you would like to prevent MG5aMC to re-attempt MA5 installation, start MG5aMC with './bin/mg5_aMC --debug'.
Now installing madanalysis5. Be patient...
Removing existing installation of tool 'madanalysis5' in '/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools'.
Fetching data with command:
  curl -OL https://github.com/MadAnalysis/madanalysis5/archive/refs/tags/v1.9.60.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  827k    0  827k    0     0  1553k      0 --:--:-- --:--:-- --:--:-- 1553k
Installing tool 'madanalysis5'...
    > Follow the installation progress by running the command below in a separate terminal)
    > tail -f /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5_install.log
['madanalysis5-1.9.60']
mv madanalysis5-1.9.60 madanalysis5
Successful installation of 'madanalysis5' in '/Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools'.
madanalysis5 successfully installed in /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools.
save configuration file to /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/input/mg5_configuration.txt
Command "install MadAnalysis5" interrupted with error:
InvalidCmd : Installation of madanalysis5 failed.

Am I going about fixing the backend the wrong way? Thanks!

jackaraz commented 2 years ago

Hi @snehadrid your log file says

ld: warning: ignoring file /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libprocess_for_ma5.so, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/localmacaccount/Simulations/MG5_aMC_v3_3_1/HEPTools/madanalysis5/madanalysis5/tools/SampleAnalyzer/Lib/libcommons_for_ma5.so, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

You don't need to have an arm64 chip, due to the new M1 configuration macOS now accommodates different types of compiler backends to be able to run everything on the machine. So for some reason, your machine is compiling different portions of the software with different backends which makes it incompatible to run together. I have no idea at the moment why this would happen but on top of my head maybe you have an installation through Xcode and another through homebrew and they coexist in the machine, maybe?

I suggest installing MadAnalysis without MadGraph (since the way it installs and compiles things is fixed). I think compiling every piece separately would help i.e. first raw MadAnalysis, then installing FastJet through MadAnalysis etc. Then you can figure out which piece is creating the problem. All Make files are written during compilation time so you can check them as well. I've never seen this problem before so, unfortunately, can't say more than this.

snehadrid commented 2 years ago

Thanks @jackaraz. I deleted my old MadAnalysis folder and re-installed through github. Installing FastJet and Zlib went fine. With ROOT on, I run into the above error when building the SampleAnalyzer libraries. With ROOT off, I run into the same error after typing "make." I see the make files but am not sure what to do with them.

"maybe you have an installation through Xcode and another through homebrew and they coexist in the machine" Do you mean I have different installations of ma5 through those installers? To my knowledge I only have ma5 installed through MadGraph (which I deleted) and then through github, which I have now.

snehadrid commented 2 years ago

"your machine is compiling different portions of the software with different backends which makes it incompatible to run together"

Is there a way to force the machine to compile it with just one backend, or would that break things elsewhere?

jackaraz commented 2 years ago

"your machine is compiling different portions of the software with different backends which makes it incompatible to run together"

Is there a way to force the machine to compile it with just one backend, or would that break things elsewhere?

You need to google it, I don't know how it changes for every single machine configuration.

I can not guarantee that ROOT will work. It has a very specific configuration and known problems with macOS. You will need to ask the ROOT developers if you want to use it. MadAnalysis can run without ROOT.

snehadrid commented 2 years ago

Thank you both for all the help. I solved the problem by installing from Rosetta 2.