Reading ROOT files with Mathematica

Version 5 of ROOT and version 9 of Mathematica had software to read ROOT files into Mathematica via a mathlink interface. This no longer works with version 6 of ROOT and version 10 of Mathematica - at least on the Mac platform. I am interested in getting this working again. So far, the most obvious errors on the ROOT side have been removed and there is some effort at Wolfram Research to fix the mathlink side. Perhaps there are others who are also interested in getting this feature working again.

I think ROOT 6 requires “clang” compiler on Mac OS X while Mathematica requires “gcc”.
These compilers are not binary compatible, if I remember well.
Try ROOT 5 and make sure that you build it with “gcc” and not “clang”.

There has been a similar problem reported here: Call mathematica math function from root

Hi Marvin,

What are you trying to do exactly (command that fails), and how does it fail?

As Pepe points out, ROOT now requires C++11. The GCC version distributed with MacOS X (really the libstdc++) is version 4.2 which does not support C++11. So you’ll have to install your own GCC, or (preferred and recommended) use clang. I.e. likely the C++ “bridge” between ROOT and Mathematica needs to be built with clang - but that shouldn’t be that difficult to achieve. To get there, I’ll need the answers to my first question :slight_smile:

Cheers, Axel.

I follow the procedure listed in cd-docdb.fnal.gov/0042/004252/00 … _users.pdf
The makefile is edited to remove Lcint and to put in the latest math link file.

Below is the part of the output from the make operation (The original is longer than 60000 characters so I cut out a large section in the middle). It appears to fail because of undefined symbols. This could be due to a compiler incompatibility. A consultant at Wolfram also suggested that it could be a compiler issue but he was not sure. Perhaps only a re compile using the GCC compiler is needed.

Marvin-Johnsons-Mac-Pro:ROOT marvinjohnson$ make clean
rm -rf root_interface.cpp
Marvin-Johnsons-Mac-Pro:ROOT marvinjohnson$ make
/Applications/Mathematica.app/Contents//SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/mprep root_interface.tm > root_interface.cpp
gcc -framework CoreFoundation -Wall -O3 -std=c++11 -Wl,-rpath,/Applications/root_v6.04.12/lib -I/Applications/Mathematica.app/Contents//SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -I/Applications/root_v6.04.12/include -lstdc++ -L/Applications/root_v6.04.12/lib -lRIO -lTree -lHist -lCore  -lNet -lThread -lMatrix -lMathCore -L/Applications/Mathematica.app/Contents//SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions -lMLi4 root_interface.cpp -o ./Binaries/MacOSX-x86-64/ROOT.exe
Undefined symbols for architecture x86_64:
  "std::__basic_file<char>::is_open() const", referenced from:
      MathLink::MLLog::logSelectorToFileWithName(MathLink::mllogselector, char const*) in libMLi4.a(mllog.cpp.o)
  "std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:
      mlopen_argv(ml_environment*, long, char**, void*, void*, int*) in libMLi4.a(mlopen.c.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
  "std::basic_ios<char, std::char_traits<char> >::widen(char) const", referenced from:
      feature_greeting(ml_environment*, MLink*, device_kebab*, _queue*, feature_set*) in libMLi4.a(mlgreet.c.o)
      MathLink::MLExceptionMessage::print(std::ostream&) const in libMLi4.a(mlexceptions.cpp.o)
      MathLink::initSyncObjectDir() in libMLi4.a(mlplatformthreads.cpp.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
      MathLink::MLLog::operator()(MathLink::mllogselector) in libMLi4.a(mllog.cpp.o)
      MathLink::MLExprLog::writeContentsToStreams(MathLink::MLExprLog::mllogdirection&, bool, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLInterfaceContainer::PrintInterfaceContainer(std::ostream&) const in libMLi4.a(mlinterface.cpp.o)
      ...
  "std::istream& std::istream::_M_extract<unsigned long>(unsigned long&)", referenced from:
      determineTheCorrectKey(MathLink::MLStringDictionaryManager&, std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlgreet.c.o)
      MathLink::MLDeviceParameters::MLDeviceParameters(char*, void*) in libMLi4.a(mldeviceparameters.cpp.o)
  "std::istream& std::istream::_M_extract<unsigned short>(unsigned short&)", referenced from:
      MathLink::MLIPAddress::MLIPAddress(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&, std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&) in libMLi4.a(mlipaddress.cpp.o)
      MathLink::MLIPAddress::MLIPAddress(char const*, char const*) in libMLi4.a(mlipaddress.cpp.o)
      MathLink::MLIPAddress::MLIPAddress(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&, MathLink::_mlipprotocol, std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&) in libMLi4.a(mlipaddress.cpp.o)
      MathLink::MLIPAddress::MLIPAddress(char const*, MathLink::_mlipprotocol, char const*) in libMLi4.a(mlipaddress.cpp.o)
      MathLink::MLIPAddress::initForAnyAddressWithPort(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&, MathLink::_mlipprotocol) in libMLi4.a(mlipaddress.cpp.o)
      MathLink::MLIPAddress::AddPort(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&) in libMLi4.a(mlipaddress.cpp.o)
  "std::istream::sentry::sentry(std::istream&, bool)", referenced from:
      std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char>, MathLink::MLStdAllocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlgreet.c.o)
  "std::basic_istream<char, std::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldevctl.c.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlgreet.c.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlexceptions.cpp.o)
      construction vtable for std::istream-in-std::basic_istringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldeviceparameters.cpp.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldateformatter.cpp.o)
      construction vtable for std::istream-in-std::basic_istringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlipaddress.cpp.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlsyncobjectnamerecordmanager.cpp.o)
      ...
  "std::basic_istream<char, std::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldevctl.c.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlgreet.c.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlexceptions.cpp.o)
      construction vtable for std::istream-in-std::basic_istringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldeviceparameters.cpp.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldateformatter.cpp.o)
      construction vtable for std::istream-in-std::basic_istringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlipaddress.cpp.o)
      construction vtable for std::istream-in-std::basic_stringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlsyncobjectnamerecordmanager.cpp.o)
      ...
  "std::ostream::put(char)", referenced from:
      feature_greeting(ml_environment*, MLink*, device_kebab*, _queue*, feature_set*) in libMLi4.a(mlgreet.c.o)
      MathLink::MLExceptionMessage::print(std::ostream&) const in libMLi4.a(mlexceptions.cpp.o)
      MathLink::initSyncObjectDir() in libMLi4.a(mlplatformthreads.cpp.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
      MathLink::MLLog::operator()(MathLink::mllogselector) in libMLi4.a(mllog.cpp.o)
      MathLink::MLExprLog::writeContentsToStreams(MathLink::MLExprLog::mllogdirection&, bool, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLInterfaceContainer::PrintInterfaceContainer(std::ostream&) const in libMLi4.a(mlinterface.cpp.o)
      ...
  "std::ostream::flush()", referenced from:
      feature_greeting(ml_environment*, MLink*, device_kebab*, _queue*, feature_set*) in libMLi4.a(mlgreet.c.o)
      MathLink::MLExceptionMessage::print(std::ostream&) const in libMLi4.a(mlexceptions.cpp.o)
      MathLink::initSyncObjectDir() in libMLi4.a(mlplatformthreads.cpp.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
      MathLink::MLLog::operator()(MathLink::mllogselector) in libMLi4.a(mllog.cpp.o)
      MathLink::MLLockedStream::writeToStream(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::MLExprLog::writeContentsToStreams(MathLink::MLExprLog::mllogdirection&, bool, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlexprlog.cpp.o)
      ...
  "std::ostream& std::ostream::_M_insert<void const*>(void const*)", referenced from:
      MathLink::MLSmartPointer<MathLink::MLUTF8String>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLMemoryPool>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLDeviceInstance>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLLinkLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLExprLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLLockedStream>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLMutexHandle>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      ...
  "std::ostream& std::ostream::_M_insert<bool>(bool)", referenced from:
      MathLink::MLSmartPointer<MathLink::MLUTF8String>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLMemoryPool>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLDeviceInstance>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLLinkLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLExprLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLLockedStream>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLMutexHandle>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      ...
  "std::ostream& std::ostream::_M_insert<double>(double)", referenced from:
      MathLink::MLLockedStream::writeToStream(float const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::MLLockedStream::writeToStream(double const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::operator<<(MathLink::MLLockedStream&, double const&) in libMLi4.a(mllockedstream.cpp.o)
      float* MathLink::MLExprLog::logArrayLevel<float>(float*, int*, char**, int, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, int) in libMLi4.a(mlexprlog.cpp.o)
      double* MathLink::MLExprLog::logArrayLevel<double>(double*, int*, char**, int, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, int) in libMLi4.a(mlexprlog.cpp.o)
      float* MathLink::MLExprLog::logArrayLevel<float>(float*, long*, char**, long, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, long) in libMLi4.a(mlexprlog.cpp.o)
      double* MathLink::MLExprLog::logArrayLevel<double>(double*, long*, char**, long, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, long) in libMLi4.a(mlexprlog.cpp.o)
      ...
  "std::ostream& std::ostream::_M_insert<long double>(long double)", referenced from:
      MathLink::MLLockedStream::writeToStream(long double const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::operator<<(MathLink::MLLockedStream&, long double const&) in libMLi4.a(mllockedstream.cpp.o)
      long double* MathLink::MLExprLog::logArrayLevel<long double>(long double*, int*, char**, int, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, int) in libMLi4.a(mlexprlog.cpp.o)
      long double* MathLink::MLExprLog::logArrayLevel<long double>(long double*, long*, char**, long, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, long) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLExprLog::logReal128(MathLink::MLExprLog::mllogdirection, long double) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLExprLog::logReal128List(MathLink::MLExprLog::mllogdirection, long double*, unsigned long) in libMLi4.a(mlexprlog.cpp.o)
  "std::ostream& std::ostream::_M_insert<long>(long)", referenced from:
      mlopen_argv(ml_environment*, long, char**, void*, void*, int*) in libMLi4.a(mlopen.c.o)
      _MLLowLevelDeviceName in libMLi4.a(mldevctl.c.o)
      MathLink::MLLockedStream::writeToStream(long const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::operator<<(MathLink::MLLockedStream&, long const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::MLExprLog::logInt(MathLink::MLExprLog::mllogdirection, long) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLExprLog::logInt64(MathLink::MLExprLog::mllogdirection, long&) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLExprLog::logInt64List(MathLink::MLExprLog::mllogdirection, long*, unsigned long) in libMLi4.a(mlexprlog.cpp.o)
      ...
  "std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long)", referenced from:
      MathLink::MLSmartPointer<MathLink::MLUTF8String>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLMemoryPool>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLDeviceInstance>::print(std::ostream&) const in libMLi4.a(mlopen.c.o)
      MathLink::MLSmartPointer<MathLink::MLLinkLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLExprLog>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLLockedStream>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      MathLink::MLSmartPointer<MathLink::MLMutexHandle>::print(std::ostream&) const in libMLi4.a(mlmake.c.o)
      ...
  "std::ostream::operator<<(int)", referenced from:
      unix_ready_parallel(readyParallelEnv*, MLink**, int, _mltimeval) in libMLi4.a(mlready.c.o)
      _MLRegisterLinkServiceWithPortAndHostname in libMLi4.a(mlservicediscoveryapi.c.o)
      _MLRegisterLinkServiceWithHostname in libMLi4.a(mlservicediscoveryapi.c.o)
      _MLRegisterLinkService in libMLi4.a(mlservicediscoveryapi.c.o)
      MathLink::MLExceptionMessage::getHeader() const in libMLi4.a(mlexceptions.cpp.o)
      MathLink::operator<<(std::ostream&, std::map<int, MathLink::MLProcess, std::less<int>, std::allocator<std::pair<int const, MathLink::MLProcess> > > const&) in libMLi4.a(mlprocessmanager.cpp.o)
      MathLink::MLUnixSyncObject::InitializePidString() in libMLi4.a(mlplatformthreads.cpp.o)
      ...
  "std::ostream::operator<<(short)", referenced from:
      MathLink::MLLockedStream::writeToStream(short const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::operator<<(MathLink::MLLockedStream&, short const&) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::MLExprLog::logInt16List(MathLink::MLExprLog::mllogdirection, short*, unsigned long) in libMLi4.a(mlexprlog.cpp.o)
      short* MathLink::MLExprLog::logArrayLevel<short>(short*, int*, char**, int, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, int) in libMLi4.a(mlexprlog.cpp.o)
      short* MathLink::MLExprLog::logArrayLevel<short>(short*, long*, char**, long, std::basic_ostringstream<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&, long) in libMLi4.a(mlexprlog.cpp.o)
      MathLink::MLSHMLayoutData::print(std::ostream&) const in libMLi4.a(mlshmlayout.cpp.o)
      MathLink::MLDateComponents::print(std::ostream&) const in libMLi4.a(mldatecomponents.cpp.o)
      ...
  "std::string::_M_leak_hard()", referenced from:
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 8ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<8ul> const&) in libMLi4.a(mlenvparameters.cpp.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 60ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<60ul> const&) in libMLi4.a(mlsignalhandlerdispositionset.cpp.o)
  "std::string::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)", referenced from:
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 8ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<8ul> const&) in libMLi4.a(mlenvparameters.cpp.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 60ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<60ul> const&) in libMLi4.a(mlsignalhandlerdispositionset.cpp.o)
  "std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
      mlopen_argv(ml_environment*, long, char**, void*, void*, int*) in libMLi4.a(mlopen.c.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 8ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<8ul> const&) in libMLi4.a(mlenvparameters.cpp.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 60ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<60ul> const&) in libMLi4.a(mlsignalhandlerdispositionset.cpp.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
      _mlfile_load_dir_names in libMLi4.a(mlfileops.c.o)
      std::_Rb_tree<std::string, std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const, int> >, std::less<std::string>, std::allocator<std::pair<std::string const, int> > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, int> >*) in libMLi4.a(mlfileops.c.o)
  "std::string::_Rep::_S_empty_rep_storage", referenced from:
      mlopen_argv(ml_environment*, long, char**, void*, void*, int*) in libMLi4.a(mlopen.c.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 8ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<8ul> const&) in libMLi4.a(mlenvparameters.cpp.o)
      std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char>, 60ul>(std::basic_ostream<char, std::char_traits<char> >&, std::bitset<60ul> const&) in libMLi4.a(mlsignalhandlerdispositionset.cpp.o)
      MathLink::MLLog::~MLLog() in libMLi4.a(mllog.cpp.o)
      _mlfile_load_dir_names in libMLi4.a(mlfileops.c.o)
      std::_Rb_tree<std::string, std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const, int> >, std::less<std::string>, std::allocator<std::pair<std::string const, int> > >::_M_erase(std::_Rb_tree_node<std::pair<std::string const, int> >*) in libMLi4.a(mlfileops.c.o)
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
      _mlfile_load_dir_names in libMLi4.a(mlfileops.c.o)
  "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:
      _mlfile_load_dir_names in libMLi4.a(mlfileops.c.o)
      std::_Rb_tree<std::string, std::pair<std::string const, int>, std::_Select1st<std::pair<std::string const, int> >, std::less<std::string>, std::allocator<std::pair<std::string const, int> > >::_M_create_node(std::pair<std::string const, int> const&) in libMLi4.a(mlfileops.c.o)
  "std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(char const*, std::_Ios_Openmode)", referenced from:
      MathLink::MLLog::logSelectorToFileWithName(MathLink::mllogselector, char const*) in libMLi4.a(mllog.cpp.o)
      MathLink::MLLockedStream::MLLockedStream(char const*, std::_Ios_Openmode) in libMLi4.a(mllockedstream.cpp.o)
      MathLink::MLLockedStream::MLLockedStream(std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > const&, std::_Ios_Openmode) in libMLi4.a(mllockedstream.cpp.o)
  "std::_List_node_base::hook(std::_List_node_base*)", referenced from:
      void std::list<MLink*, MathLink::MLStdAllocator<MLink*> >::insert<std::_List_const_iterator<MLink*> >(std::_List_iterator<MLink*>, std::_List_const_iterator<MLink*>, std::_List_const_iterator<MLink*>) in libMLi4.a(mlopen.c.o)
      std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::list<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >(std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > const&) in libMLi4.a(mlopen.c.o)
      getLinksInEnvironment(ml_environment*) in libMLi4.a(mlmake.c.o)
      determineTheCorrectKey(MathLink::MLStringDictionaryManager&, std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >&) in libMLi4.a(mlgreet.c.o)
      void std::list<unsigned long, MathLink::MLStdAllocator<unsigned long> >::insert<std::_List_const_iterator<unsigned long> >(std::_List_iterator<unsigned long>, std::_List_const_iterator<unsigned long>, std::_List_const_iterator<unsigned long>) in libMLi4.a(mlgreet.c.o)
      MathLink::MLMemoryPool::resizePool(unsigned long) in libMLi4.a(mlmemorypool.cpp.o)
      MathLink::MLDeviceManager::setPreferredDeviceLoadOrder() in libMLi4.a(mldevicemanager.cpp.o)
      ...
  "std::_List_node_base::swap(std::_List_node_base&, std::_List_node_base&)", referenced from:
      std::list<unsigned long, std::allocator<unsigned long> >::sort() in libMLi4.a(mlmemorypool.cpp.o)
      std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::sort() in libMLi4.a(mlinterface.cpp.o)
  "std::_List_node_base::unhook()", referenced from:
      std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::operator=(std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > > const&) in libMLi4.a(mlopen.c.o)
      std::list<MLink*, MathLink::MLStdAllocator<MLink*> >::operator=(std::list<MLink*, MathLink::MLStdAllocator<MLink*> > const&) in libMLi4.a(mlopen.c.o)
      std::list<unsigned long, MathLink::MLStdAllocator<unsigned long> >::operator=(std::list<unsigned long, MathLink::MLStdAllocator<unsigned long> > const&) in libMLi4.a(mlgreet.c.o)
      MathLink::MLMemoryPool::resizePool(unsigned long) in libMLi4.a(mlmemorypool.cpp.o)
      std::list<MathLink::MLSyncObjectNameRecord, MathLink::MLStdAllocator<MathLink::MLSyncObjectNameRecord> >::operator=(std::list<MathLink::MLSyncObjectNameRecord, MathLink::MLStdAllocator<MathLink::MLSyncObjectNameRecord> > const&) in libMLi4.a(mlplatformthreads.cpp.o)
      std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::operator=(std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > > const&) in libMLi4.a(mlipinterface.c.o)
      MathLink::MLTCPIPDevice::~MLTCPIPDevice() in libMLi4.a(mltcpip.cpp.o)
      ...
  "std::_List_node_base::transfer(std::_List_node_base*, std::_List_node_base*)", referenced from:
      void std::list<MLink*, MathLink::MLStdAllocator<MLink*> >::insert<std::_List_const_iterator<MLink*> >(std::_List_iterator<MLink*>, std::_List_const_iterator<MLink*>, std::_List_const_iterator<MLink*>) in libMLi4.a(mlopen.c.o)
      void std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >) in libMLi4.a(mlopen.c.o)
      void std::list<unsigned long, MathLink::MLStdAllocator<unsigned long> >::insert<std::_List_const_iterator<unsigned long> >(std::_List_iterator<unsigned long>, std::_List_const_iterator<unsigned long>, std::_List_const_iterator<unsigned long>) in libMLi4.a(mlgreet.c.o)
      std::list<unsigned long, std::allocator<unsigned long> >::sort() in libMLi4.a(mlmemorypool.cpp.o)
      void std::list<MathLink::MLSyncObjectNameRecord, MathLink::MLStdAllocator<MathLink::MLSyncObjectNameRecord> >::insert<std::_List_const_iterator<MathLink::MLSyncObjectNameRecord> >(std::_List_iterator<MathLink::MLSyncObjectNameRecord>, std::_List_const_iterator<MathLink::MLSyncObjectNameRecord>, std::_List_const_iterator<MathLink::MLSyncObjectNameRecord>) in libMLi4.a(mlplatformthreads.cpp.o)
      void std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >) in libMLi4.a(mlipinterface.c.o)
      void std::list<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> >, MathLink::MLStdAllocator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >::insert<std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > > >(std::_List_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >, std::_List_const_iterator<std::basic_string<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > >) in libMLi4.a(mlshm.cpp.o)
      ...
  "std::basic_streambuf<char, std::char_traits<char> >::sync()", referenced from:
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldevctl.c.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlservicediscoveryapi.c.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlgreet.c.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlexceptions.cpp.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mlplatformthreads.cpp.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mldeviceparameters.cpp.o)
      vtable for std::basic_stringbuf<char, std::char_traits<char>, MathLink::MLStdAllocator<char> > in libMLi4.a(mllinklog.cpp.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: *** [ROOT.exe] Error 1
Marvin-Johnsons-Mac-Pro:ROOT marvinjohnson$

Hi,

Please use clang++ to compile this, not GCC. (This is C++ code, so you need clang++, not clang.)

Cheers, Axel.

Wolfram research has alternative libraries compiled with libc++ as opposed to libstdc++. I have also changed the compiler to clang++ and sys lib to stdc++11. I no longer get the large error print out. However, I get the following error

Marvin-Johnsons-Mac-Pro:ROOT marvinjohnson$ make
/Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativeLibraries/mprep root_interface.tm > root_interface.cpp
/bin/sh: /Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativeLibraries/mprep: No such file or directory
make: *** [root_interface.cpp] Error 127
The modified make file is
###################################################################################
# COMPILER SETTINGS
###################################################################################
CC = Clang++
MACFLAGS = -framework CoreFoundation
FLAGS = $(MACFLAGS) -Wall -O3

###################################################################################
# MATHEMATICA MATHLINK VARIABLES
###################################################################################

# Your Mathematica 8 installation location may be different
MLINK = /Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativLibraries
MINC = $(MLINK)
MLIB = $(MLINK)
MATHLIB = -lMLi4

###################################################################################
# CERN ROOT VARIABLES
###################################################################################

# $(ROOTSYS) is not needed for building, but used here for the convenience of
# defining the other variables, which are all needed.
ROOTSYS = /Applications/root_v6.04.12 ### CHANGE THIS ###
RINC := $(shell root-config --incdir)
RLIB := $(shell root-config --libdir)
ROOTLIB = -lRIO -lTree -lHist -lCore  -lNet -lThread -lMatrix -lMathCore
RPATH = -Wl,-rpath,$(RLIB)


###################################################################################
# SYSTEM VARIABLES
###################################################################################

SYSLIB = -lstdc++11

###################################################################################
# PROJECTS
###################################################################################

# $@ is the target
# $< is the first item in the dependency list
# $^ is the entire dependency list

############## ALL PROJECTS ##################################################

all: ROOT.exe

############## MATHLINK PROJECT ##################################################

# By default, we place the executables in the same directory

ROOT.exe: root_interface.cpp
	$(CC) $(FLAGS) $(RPATH) -I$(MINC) -I$(RINC) $(SYSLIB) -L$(RLIB) $(ROOTLIB) -L$(MLIB) $(MATHLIB) $^ -o ./Binaries/MacOSX-x86-64/ROOT.exe

root_interface.cpp: root_interface.tm
	$(MLINK)/mprep $< > $@

################################ CLEAN #######################################
##############################################################################

clean:
	rm -rf root_interface.cpp

Any suggestions on how to fix this error?

Hi,

Apparently the issue is:[quote]/Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativeLibraries/mprep[/quote]which is a tool within the Mathematica distribution. I would guess that it has been moved and/or renamed.

Cheers,
Philippe.

Hi,

Plus you have

SYSLIB = -lstdc++11

which should read

SYSLIB = -std=c++11

and the compiler is clang++, not Clang++.

Cheers, Axel.

…and I would leave all but the MLIB path pointing to the original (not alternate) directories:

MLINK = /Applications/Mathematica.app/Contents//SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions
MINC = $(MLINK)
MLIB = /Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativLibraries

Cheers, Axel.

…and a comment from Wolfram Research:

I.e. 4.36 will behave better on MacOS.

Cheers, Axel.

Thanks to the efforts of several people, I am now able to import root files directly into Mathematica 10.4 on a Mac. This works for both the test examples and in the example used in in “Meet a TTree”. However, when I try the following file
root [0] TFile ThisFile = TFile::Open(“HistoForRun18409.root”)
root [1] .ls
TFile
* HistoForRun18409.root
TFile* HistoForRun18409.root
KEY: TDirectoryFile tpcdaqtooffline;1 tpcdaqtooffline (TpcDAQToOffline) folder
root [2] tpcdaqtooffline->cd()
(Bool_t)1
root [3] .ls
TDirectoryFile* tpcdaqtooffline tpcdaqtooffline (TpcDAQToOffline) folder
KEY: TTree FlatDigitTree;8 FlatDigitTree
KEY: TTree FlatDigitTree;7 FlatDigitTree
root [4] FlatDigitTree->Print()


*Tree :FlatDigitTree: FlatDigitTree *
*Entries : 50 : Total = 1536216683 bytes File Size = 233752893 *

  •    :          : Tree compression factor =   6.57                       *
    

*Br 0 :NSamples : NSamples/I *
*Entries : 50 : Total Size= 1358 bytes File Size = 872 *
*Baskets : 8 : Basket Size= 51200 bytes Compression= 1.00 *

*Br 1 :smiley:igSize : DigSize/I *
*Entries : 50 : Total Size= 1346 bytes File Size = 829 *
*Baskets : 8 : Basket Size= 51200 bytes Compression= 1.04 *

*Br 2 :Channel : Channel[DigSize]/F *
*Entries : 50 : Total Size= 103909 bytes File Size = 11196 *
*Baskets : 8 : Basket Size= 51200 bytes Compression= 9.23 *

*Br 3 :stuck_out_tongue:edestal : Pedestal[DigSize]/F *
*Entries : 50 : Total Size= 103921 bytes File Size = 9517 *
*Baskets : 8 : Basket Size= 51200 bytes Compression= 10.86 *

*Br 4 :ADCs : ADCs[DigSize][15000]/F *
*Entries : 50 : Total Size= 1536006003 bytes File Size = 233728966 *
*Baskets : 50 : Basket Size= 25600000 bytes Compression= 6.57 *
The listing shows that the TTree name is FlatDigitTree but when I import it, Mathematica says that there is no valid TTree other than the null tree. Any suggestions as to why this is the case?