Software/ROOT: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
No edit summary
Line 18: Line 18:
* Right-click on the project and select properties (shortcut: CMD+I)
* Right-click on the project and select properties (shortcut: CMD+I)
* Navigate to C/C++ Build –> Environment and add the variables:  
* Navigate to C/C++ Build –> Environment and add the variables:  
** Name: LD_LIBRARY_PATH,  Value: /Applications/root_v6.14.00/lib
** Name: DYLD_LIBRARY_PATH,  Value: /Applications/root_v6.14.00/lib
** Name: ROOTSYS, Value: /Applications/root_v6.14.00
** Name: ROOTSYS, Value: /Applications/root_v6.14.00
* Navigate to C/C++ Build –> Settings –> Tool Settings –> MacOS X C++ Linker –> Libraries
* Navigate to C/C++ Build –> Settings –> Tool Settings –> MacOS X C++ Linker –> Libraries

Revision as of 17:50, 17 March 2020

Local Installation on MacOS

Correct for MacOS High Sierra 10.13.6

  • Install Xcode from the Mac App Store. (Note: If using an older version of MacOS, previous versions of Xcode can be found here: [1])
  • Enable command line tools for Xcode using the terminal command: xcode-select --install.
  • Download and run the ROOT dmg from CERN: [2]
  • Navigate to your user folder in Finder, use CMD+SHIFT+. to show hidden files, one of which will be .bash_profile.
  • Edit the text file by adding the line: . <pathname>/root/bin/thisroot.sh (where <pathname> is the directory that leads to the folder ROOT is installed in, noting that the folder root typically has a version number attached to it)
  • If your .bash_profile is locked, add permissions by selecting “Get Info” and unlocking the file/giving yourself read and write privileges.
  • You can now run ROOT in terminal by typing root.

Using ROOT in Eclipse IDE on MacOS

C++ code for analysis of data from LeCroy Oscilloscope and QUARC exist in pre-compiled software, edited in Eclipse and containing a rudimentary text-based interface to minimise programming knowledge required for usage. These instructions detail how to allow a C/C++ Eclipse project to access ROOT's libraries.

  • First, locate the directory where ROOT is installed on your computer, e.g. for ROOT v6.14.00 on MacOS: "/Applications/root_v6.14.00". The following instructions will use this path as an example.
  • Right-click on the project and select properties (shortcut: CMD+I)
  • Navigate to C/C++ Build –> Environment and add the variables:
    • Name: DYLD_LIBRARY_PATH, Value: /Applications/root_v6.14.00/lib
    • Name: ROOTSYS, Value: /Applications/root_v6.14.00
  • Navigate to C/C++ Build –> Settings –> Tool Settings –> MacOS X C++ Linker –> Libraries
    • Add the libraries, in individual entries and in this order (exclude commas): Gui, Core, Imt, RIO, Net, Hist, Graf, Graf3d, Gpad, ROOTDataFrame, ROOTVecOps, Tree, TreePlayer, Rint, Postscript, Matrix, Physics, MathCore, Thread, MultiProc, pThread, m, dl
    • Add the library search path: /Applications/root_v6.14.00/lib
  • Navigate to MacOS X C++ Linker –> Miscellaneous and add (replacing if needed): -pthread -stdlib=libc++ -std=c++11 -m64
  • Navigate to GCC C++ Compiler –> Includes and add the include path: /Applications/root_v6.14.00/include
  • Navigate to GCC C++ Compiler –> Optimization
    • Change the Optimization Level to "Optimize most (-O3)
    • Add the following Other Optimization Flags (replacing if needed): -pthread -stdlib=libc++ -std=c++11 -m64
  • Navigate to GCC C++ Compiler –> Miscellaneous and add (replacing if needed): -c -fmessage-length=0 -pthread -stdlib=libc++ -std=c++11 -m64
  • Repeat the instructions for GCC C++ Compiler for GCC C Compiler if you wish to write/edit C code'. Otherwise, ensure that all C++ source files which are not headers have the file extension '.cpp'.

These instructions were based off this tutorial.