How to keep root running after quitting sessions

ROOT Version: 6.18/04
Platform: Mac OSX
Compiler: VSCode


When I initiate root, I do this:

  1. Open Mac Terminal
  2. Type cd Documents
  3. Type cd root2 (name of my root folder)
  4. Type source ./bin/thisroot.sh
  5. Type root

At this point, it runs fine. When I run a program (by running .L file name and then calling the method), it works normally. However, when I do .L (file name) and run the same file again, it gives the following text:

IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L3maxIlEERKT_S3_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of long const& std::__1::max<long>(long const&, long const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L4moveIRPFiP7__sFILEEEEONS_16remove_referenceIT_E4typeEOS7_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::remove_reference<int (*&)(__sFILE*)>::type&& std::__1::move<int (*&)(__sFILE*)>(int (*&&&)(__sFILE*))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L3minImEERKT_S3_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of unsigned long const& std::__1::min<unsigned long>(unsigned long const&, unsigned long const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L7forwardIRP7__sFILEEEOT_RNS_16remove_referenceIS4_E4typeE' unresolved while linking [cling interface function]!
You are probably missing the definition of __sFILE*&&& std::__1::forward<__sFILE*&>(std::__1::remove_reference<__sFILE*&>::type&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9addressofIKcEEPT_RS2_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::addressof<char const>(char const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L16__throw_bad_castEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::__throw_bad_cast()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base8setstateEj' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::setstate(unsigned int)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5widthEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L7forwardIPFiP7__sFILEEEEOT_RNS_16remove_referenceIS5_E4typeE' unresolved while linking [cling interface function]!
You are probably missing the definition of int (*&&std::__1::forward<int (*)(__sFILE*)>(std::__1::remove_reference<int (*)(__sFILE*)>::type&))(__sFILE*)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9has_facetINS_7codecvtIcc11__mbstate_tEEEEbRKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9use_facetINS_7codecvtIcc11__mbstate_tEEEERKT_RKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::codecvt<char, char, __mbstate_t> const& std::__1::use_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base4failEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::fail() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base5widthEl' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width(long)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L4endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base3eofEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::eof() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9use_facetINS_5ctypeIcEEEERKT_RKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5flagsEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::flags() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L16__to_raw_pointerIKcEEPT_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::__to_raw_pointer<char const>(char const*)
Maybe you need to load the corresponding shared library?
root [4] 

When I run the same program again, it says:

*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[/usr/lib/system/libsystem_malloc.dylib] tiny_malloc_from_free_list (no debug info)
[<unknown binary>] (no debug info)
[/usr/lib/libc++.1.dylib] std::__1::basic_istream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_istream<char, std::__1::char_traits<char> >&, bool) (no debug info)
[/usr/lib/libc++.1.dylib] std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(double&) (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/Users/name/Documents/root2/lib/libCling.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/Users/name/Documents/root2/lib/libRint.6.18.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/Users/name/Documents/root2/lib/libRint.6.18.so] TRint::HandleTermInput() (no debug info)
[/Users/name/Documents/root2/lib/libCore.6.18.so] TUnixSystem::CheckDescriptors() (no debug info)
[/Users/name/Documents/root2/lib/libCore.6.18.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)
[/Users/name/Documents/root2/lib/libCore.6.18.so] TSystem::InnerLoop() (no debug info)
[/Users/name/Documents/root2/lib/libCore.6.18.so] TSystem::Run() (no debug info)
[/Users/name/Documents/root2/lib/libCore.6.18.so] TApplication::Run(bool) (no debug info)
[/Users/name/Documents/root2/lib/libRint.6.18.so] TRint::Run(bool) (no debug info)
[/Users/name/Documents/root2/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
Root > 

At this point, I have to exit and repeat the steps above.
I have two questions?

  1. Is there anyway to run root when I open Terminal so I don’t have to type in cd…, source…, etc every time I run root?
  2. What is the reason for the error and how do I fix it?

Thanks

You can add source ./bin/thisroot.sh to your ~/.bashrc or ~/.profile file. If you want to go to a particular directory everytime you open Terminal, you can add cd /Documents/folder to your ~/.bashrc also.

When you .L filename in root once that file/executable is loaded into the memory. Now when you do it again with another .L filename, the previous file is still in the memory, which causes the error you see.
To fix is you have to reset the root memory, which you do by quitting or type gROOT->Reset()