Building ROOT under a conda environment


ROOT Version: 6.16.00
Platform: macOS 10.14.5
Compiler: Apple LLVM version 10.0.1 (clang-1001.0.46.4)


I would like to build ROOT 6.16.00 with a Python environment installed by Anaconda being linked so that I can use PyROOT and other Python modules together in the conda environment.

Having installed some basic programs and python packages in conda environment cta (Python 3.6.8), such as CMake, SWIG, SciPy, NumPy, I tried to build ROOT 6.16.00.

(base) $ conda activate cta
(cta) $ which cmake
/Users/oxon/anaconda3/envs/cta/bin/cmake
(cta) $ which python
/Users/oxon/anaconda3/envs/cta/bin/python
(cta) $ python --version
Python 3.6.8 :: Anaconda, Inc.
(cta) $ which clang
/usr/bin/clang
(cta) $ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(cta) $ mkdir /usr/local/root-6.16.00/obj_conda
(cta) $ cd /usr/local/root-6.16.00/obj_conda
(cta) $ cmake ../ -DPYTHON_EXECUTABLE=`which python3` -Dminuit2=ON
CMake Error at /Users/oxon/anaconda3/envs/cta/share/cmake-3.14/Modules/CMakeDetermineCCompiler.cmake:49 (message):
  Could not find compiler set in environment variable CC:

  x86_64-apple-darwin13.4.0-clang.
Call Stack (most recent call first):
  CMakeLists.txt:12 (project)


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/usr/local/root-6.16.00/obj_conda/CMakeFiles/CMakeOutput.log".

Since it looks that C/C++ compilers are not properly set in the conda CMake environment, I manually set them in CMake options.

(cta) $ cmake ../ -DPYTHON_EXECUTABLE=`which python3` -Dminuit2=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang
-- Check for working CXX compiler: /usr/bin/clang -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.20.1 (Apple Git-117)") 
-- ROOT default compression algorithm: zlib
-- Performing Test HAS_CXX11
-- Performing Test HAS_CXX11 - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found a Mac OS X System 10.14
-- Found a 64bit system
-- Found LLVM compiler collection
-- Performing Test GLIBCXX_USE_CXX11_ABI
-- Performing Test GLIBCXX_USE_CXX11_ABI - Failed
-- ROOT Platform: macosx
-- ROOT Architecture: macosx64
-- Build Type: RelWithDebInfo
-- Compiler Flags: -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -stdlib=libc++ 
-- Looking for ZLib
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11") 
-- Building freetype version 2.6.1 included in ROOT itself
-- Looking for PCRE
-- Found PCRE: /usr/local/include  
-- Looking for LZMA
-- Found LZMA includes at /usr/local/include
-- Found LZMA library at /usr/local/lib/liblzma.dylib
-- Looking for xxHash
-- Could NOT find xxHash (missing: xxHash_LIBRARY xxHash_INCLUDE_DIR) 
-- xxHash not found. Switching on builtin_xxhash option
-- Looking for LZ4
-- Could NOT find LZ4 (missing: LZ4_LIBRARY LZ4_INCLUDE_DIR) 
-- LZ4 not found. Switching on builtin_lz4 option
-- Could NOT find GIF (missing: GIF_LIBRARY GIF_INCLUDE_DIR) 
-- Found TIFF: /usr/local/lib/libtiff.dylib (found version "4.0.9") 
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.6.35") 
-- Found JPEG: /usr/local/lib/libjpeg.dylib (found version "90") 
-- Building AfterImage library included in ROOT itself
-- Looking for GSL
-- FindGSL: gsl-config not found.
-- GSL not found. Set variable GSL_DIR to point to your GSL installation
--                Alternatively, you can also enable the option 'builtin_gsl' to build the GSL libraries internally'
--                For the time being switching OFF 'mathmore' option
-- Looking for python
-- Found PythonInterp: /Users/oxon/anaconda3/envs/cta/bin/python3 (found version "3.6.8") 
-- Found PythonLibs: /Users/oxon/anaconda3/envs/cta/lib/libpython3.6m.dylib (found version "3.6.8") 
-- Looking for numpy (python package)
-- TMVA: numpy not found for python /Users/oxon/anaconda3/envs/cta/bin/python3. Switching off tmva-pymva option
-- Looking for OpenGL
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework   
-- Looking for gl2ps
-- Could NOT find GL2PS (missing: GL2PS_LIBRARY GL2PS_INCLUDE_DIR) 
-- gl2ps not found. Switching on builtin_gl2ps option
-- Looking for LibXml2
-- Found LibXml2: /usr/lib/libxml2.dylib (found version "2.9.4") 
-- Found OpenSSL: /usr/lib/libcrypto.dylib (found version "1.1.1c")  
-- Looking for MySQL
-- Could NOT find MYSQL (missing: MYSQL_INCLUDE_DIR MYSQL_LIBRARIES) 
-- MySQL not found. Switching off mysql option
-- Looking for Oracle
-- Oracle not found.
-- Oracle: You can specify includes: -DORACLE_PATH_INCLUDES=/usr/include/oracle/10.2.0.3/client
--    currently found includes: 
-- Oracle: You can specify libs: -DORACLE_PATH_LIB=/usr/lib/oracle/10.2.0.3/client/lib
--    currently found libs: ORACLE_LIBRARY_OCCI-NOTFOUND;ORACLE_LIBRARY_CLNTSH-NOTFOUND;ORACLE_LIBRARY_LNNZ-NOTFOUND
-- Oracle not found. Switching off oracle option
-- Looking for PostgreSQL
-- Could NOT find PostgreSQL (missing: POSTGRESQL_INCLUDE_DIR) 
-- PostgreSQL not found. Switching off pgsql option
-- Looking for SQLite
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2") 
-- Found Sqlite: /Users/oxon/anaconda3/envs/cta/include  
-- Looking for Pythia6
-- Pythia6 not found. Switching off pythia6 option
-- Looking for Pythia8
-- Could NOT find Pythia8 (missing: PYTHIA8_INCLUDE_DIR PYTHIA8_LIBRARY) 
-- Pythia8 not found. Switching off pythia8 option
-- Looking for FFTW3
-- FFTW3 not found. Set [environment] variable FFTW_DIR to point to your FFTW3 installation
--                  Alternatively, you can also enable the option 'builtin_fftw3' to build FFTW3 internally'
--                  For the time being switching OFF 'fftw3' option
-- Looking for CFITSIO
-- Found CFITSIO: /usr/local/include  
-- Found CFITSIO version: 3.45
-- Looking for XROOTD
-- XROOTD not found. Set environment variable XRDSYS to point to your XROOTD installation
--                   Alternatively, you can also enable the option 'builtin_xrootd' to build XROOTD internally
--                   For the time being switching OFF 'xrootd' option
-- Could NOT find GFAL (missing: GFAL_INCLUDE_DIR SRM_IFCE_INCLUDE_DIR GFAL_LIBRARY) 
-- GFAL library not found. Set variable GFAL_DIR to point to your gfal installation
                      and the variable SRM_IFCE_DIR to the srm_ifce installation
-- For the time being switching OFF 'gfal' option
-- Checking for module 'davix>=0.6.4'
--   No package 'davix' found
-- Looking for uuid_generate_random in uuid
-- Looking for uuid_generate_random in uuid - not found
-- Found uuid: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include  
-- Davix not found, switching ON 'builtin_davix' option.
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for TBB
-- Could NOT find TBB (missing: TBB_ROOT_DIR TBB_INCLUDE_DIR TBB_LIBRARY) 
-- TBB not found. Switching on builtin_tbb option
-- Performing Test CXX_HAS_mno_rtm
-- Performing Test CXX_HAS_mno_rtm - Success
-- Looking for VDT
-- Could NOT find VDT (missing: VDT_INCLUDE_DIR VDT_LIBRARY) 
-- VDT not found. Ensure that the installation of VDT is in the CMAKE_PREFIX_PATH
--                Switching ON 'builtin_vdt' option
-- Looking for BLAS for optional parts of TMVA
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /Users/oxon/anaconda3/envs/cta/lib/libopenblas.a  
-- Enabled support for:  asimage astiff builtin_afterimage builtin_clang builtin_davix builtin_freetype builtin_ftgl builtin_gl2ps builtin_glew builtin_llvm builtin_lz4 builtin_tbb builtin_vdt builtin_xxhash clad cling cocoa cxx11 davix exceptions explicitlink fitsio gdml http imt libcxx minuit2 opengl pch python roofit shared sqlite ssl thread tmva tmva-cpu vdt xml
-- The ASM compiler identification is AppleClang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include  
-- Native target architecture is X86
-- Threads disabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- Found ld64 - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- LLVM host triple: x86_64-apple-darwin18.6.0
-- LLVM default target triple: x86_64-apple-darwin18.6.0
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- SysLibs: curses;/usr/lib/libz.dylib
-- Targeting X86
-- Clang version: 5.0.0
-- Cling version (from VERSION file): ROOT_0.6~dev
-- Cling will look for C++ headers in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1' at runtime.
-- And then fallback to: 'clang'
-- Performing Test __result
-- Performing Test __result - Failed
-- Performing Test CXX_HAS_fno_rtti
-- Performing Test CXX_HAS_fno_rtti - Success
-- Performing Test CXX_HAS_Wno_conditional_uninitialized
-- Performing Test CXX_HAS_Wno_conditional_uninitialized - Success
Recording the git revision now
-- Performing Test C_HAS_Wno_strict_overflow
-- Performing Test C_HAS_Wno_strict_overflow - Success
-- Performing Test C_HAS_Wno_maybe_uninitialized
-- Performing Test C_HAS_Wno_maybe_uninitialized - Failed
-- Performing Test C_HAS_Wno_parentheses_equality
-- Performing Test C_HAS_Wno_parentheses_equality - Success
-- Looking for m
-- Looking for m - not found
-- Performing Test CXX_HAS_fno_strict_aliasing
-- Performing Test CXX_HAS_fno_strict_aliasing - Success
-- Performing Test CXX_HAS_Wno_parentheses_equality
-- Performing Test CXX_HAS_Wno_parentheses_equality - Success
-- Performing Test CXX_HAS_Wno_cast_function_type
-- Performing Test CXX_HAS_Wno_cast_function_type - Failed
-- Performing Test CXX_HAS_Wno_deprecated_register
-- Performing Test CXX_HAS_Wno_deprecated_register - Success
-- Performing Test CXX_HAS_Wno_register
-- Performing Test CXX_HAS_Wno_register - Success
-- Using TMVA-DNN with BLAS installation: /Users/oxon/anaconda3/envs/cta/lib/libopenblas.a
-- Performing Test found_setresuid
-- Performing Test found_setresuid - Failed
-- Performing Test found_stdstringview
-- Performing Test found_stdstringview - Success
-- Performing Test found_stod_stringview
-- Performing Test found_stod_stringview - Failed
-- Performing Test found_stdapply
-- Performing Test found_stdapply - Failed
-- Performing Test found_stdinvoke
-- Performing Test found_stdinvoke - Failed
-- Performing Test found_stdindexsequence
-- Performing Test found_stdindexsequence - Failed
-- Performing Test found_attribute_always_inline
-- Performing Test found_attribute_always_inline - Success
Running /usr/local/root-6.16.00/build/unix/compiledata.sh
Making /usr/local/root-6.16.00/obj_conda/include/compiledata.h
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/root-6.16.00/obj_conda

Now CMake runs OK, but my first attempt to building ROOT stopped after a while, and I had to kill it with Ctrl-C.

(cta) $ make -j 8
Scanning dependencies of target xxhash
Scanning dependencies of target VDT
...
[ 56%] Copying /usr/local/root-6.16.00/tutorials/xml/xmlreadfile.C
[ 56%] Built target move_artifacts
^Cmake[2]: *** [TBB-prefix/src/TBB-stamp/TBB-build] Interrupt: 2
make[1]: *** [CMakeFiles/TBB.dir/all] Interrupt: 2
make: *** [all] Interrupt: 2

So I executed make again without the option, but it stopped again when bin/clang-tblgen is built.

(cta) $ make
...
[ 29%] Linking CXX executable ../../../../bin/clang-tblgen
Undefined symbols for architecture x86_64:
  "std::__1::error_code::message() const", referenced from:
      llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) in libLLVMTableGen.a(Main.cpp.o)
  "operator new[](unsigned long)", referenced from:
      unsigned int llvm::ComputeEditDistance<char>(llvm::ArrayRef<char>, llvm::ArrayRef<char>, bool, unsigned int) in libLLVMSupport.a(StringRef.cpp.o)
      llvm::raw_ostream::SetBuffered() in libLLVMSupport.a(raw_ostream.cpp.o)
  "operator delete[](void*)", referenced from:
      unsigned int llvm::ComputeEditDistance<char>(llvm::ArrayRef<char>, llvm::ArrayRef<char>, bool, unsigned int) in libLLVMSupport.a(StringRef.cpp.o)
      llvm::raw_ostream::~raw_ostream() in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::raw_ostream::SetBuffered() in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::raw_ostream::SetBufferAndMode(char*, unsigned long, llvm::raw_ostream::BufferKind) in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::raw_svector_ostream::~raw_svector_ostream() in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::raw_fd_ostream::~raw_fd_ostream() in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::raw_string_ostream::~raw_string_ostream() in libLLVMSupport.a(raw_ostream.cpp.o)
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::replace(unsigned long, unsigned long, char const*, unsigned long)", referenced from:
      (anonymous namespace)::Intrinsic::emitBody(llvm::StringRef) in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::DagEmitter::emitDag(llvm::DagInit*) in NeonEmitter.cpp.o
      llvm::TernOpInit::Fold(llvm::Record*, llvm::MultiClass*) const in libLLVMTableGen.a(Record.cpp.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, char const*, unsigned long)", referenced from:
      (anonymous namespace)::Intrinsic::emitBody(llvm::StringRef) in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::mangleName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, (anonymous namespace)::ClassKind) const in NeonEmitter.cpp.o
      char const* parse_encoding<(anonymous namespace)::Db>(char const*, char const*, (anonymous namespace)::Db&) in libLLVMDemangle.a(ItaniumDemangle.cpp.o)
      char const* parse_type<(anonymous namespace)::Db>(char const*, char const*, (anonymous namespace)::Db&) in libLLVMDemangle.a(ItaniumDemangle.cpp.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
      clang::EmitNeonSema(llvm::RecordKeeper&, llvm::raw_ostream&) in NeonEmitter.cpp.o
      (anonymous namespace)::NeonEmitter::createIntrinsic(llvm::Record*, llvm::SmallVectorImpl<(anonymous namespace)::Intrinsic*>&) in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::emitBody(llvm::StringRef) in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::protoHasScalar() const in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::mangleName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, (anonymous namespace)::ClassKind) const in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::generateImpl(bool, llvm::StringRef, llvm::StringRef) in NeonEmitter.cpp.o
  "std::__1::generic_category()", referenced from:
      getOpenFileImpl(int, llvm::Twine const&, unsigned long long, unsigned long long, long long, bool, bool) in libLLVMSupport.a(MemoryBuffer.cpp.o)
      getMemoryBufferForStream(int, llvm::Twine const&) in libLLVMSupport.a(MemoryBuffer.cpp.o)
      llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef<llvm::StringRef>) in libLLVMSupport.a(Program.cpp.o)
      llvm::sys::fs::openFileForRead(llvm::Twine const&, int&, llvm::SmallVectorImpl<char>*) in libLLVMSupport.a(Path.cpp.o)
      llvm::sys::fs::openFileForWrite(llvm::Twine const&, int&, llvm::sys::fs::OpenFlags, unsigned int) in libLLVMSupport.a(Path.cpp.o)
      llvm::sys::fs::current_path(llvm::SmallVectorImpl<char>&) in libLLVMSupport.a(Path.cpp.o)
      llvm::sys::fs::remove(llvm::Twine const&, bool) in libLLVMSupport.a(Path.cpp.o)
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      clang::EmitNeon(llvm::RecordKeeper&, llvm::raw_ostream&) in NeonEmitter.cpp.o
      clang::EmitNeonSema(llvm::RecordKeeper&, llvm::raw_ostream&) in NeonEmitter.cpp.o
      (anonymous namespace)::TypeSpec::fromTypeSpecs(llvm::StringRef) in NeonEmitter.cpp.o
      (anonymous namespace)::NeonEmitter::createIntrinsic(llvm::Record*, llvm::SmallVectorImpl<(anonymous namespace)::Intrinsic*>&) in NeonEmitter.cpp.o
      void std::__1::vector<(anonymous namespace)::Type, std::__1::allocator<(anonymous namespace)::Type> >::emplace_back<(anonymous namespace)::TypeSpec&, char>((anonymous namespace)::TypeSpec&&&, char&&) in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::initVariables() in NeonEmitter.cpp.o
      (anonymous namespace)::Intrinsic::emitBody(llvm::StringRef) in NeonEmitter.cpp.o
      ...
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::setbuf(char*, long)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(std::__1::__wrap_iter<char const*>, char)", referenced from:
      clang::EmitClangOptDocs(llvm::RecordKeeper&, llvm::raw_ostream&) in ClangOptionDocEmitter.cpp.o
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
      construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
      construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
      construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
      construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)", referenced from:
      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> >::__append_forward_unsafe<char const*>(char const*, char const*) in ClangDiagnosticsEmitter.cpp.o
      std::__1::enable_if<(__is_forward_iterator<char const*>::value) && (__libcpp_string_gets_noexcept_iterator<char const*>::value), std::__1::__wrap_iter<char*> >::type std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert<char const*>(std::__1::__wrap_iter<char const*>, char const*, char const*) in libLLVMDemangle.a(ItaniumDemangle.cpp.o)
      llvm::TGLexer::LexIdentifier() in libLLVMTableGen.a(TGLexer.cpp.o)
      llvm::TGLexer::LexVarName() in libLLVMTableGen.a(TGLexer.cpp.o)
      llvm::TGLexer::LexBracket() in libLLVMTableGen.a(TGLexer.cpp.o)
  "std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
      construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::system_category()", referenced from:
      llvm::raw_fd_ostream::raw_fd_ostream(llvm::StringRef, std::__1::error_code&, llvm::sys::fs::OpenFlags) in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::outs() in libLLVMSupport.a(raw_ostream.cpp.o)
      llvm::TableGenMain(char*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) in libLLVMTableGen.a(Main.cpp.o)
      printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&) in libLLVMSupport.a(Signals.cpp.o)
      getOpenFileImpl(int, llvm::Twine const&, unsigned long long, unsigned long long, long long, bool, bool) in libLLVMSupport.a(MemoryBuffer.cpp.o)
      llvm::sys::ChangeStdinToBinary() in libLLVMSupport.a(Program.cpp.o)
      llvm::sys::ChangeStdoutToBinary() in libLLVMSupport.a(Program.cpp.o)
      ...
  "virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
      construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
      construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in ClangAttrEmitter.cpp.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in ClangAttrEmitter.cpp.o
  "std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))", referenced from:
      llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void (*)(void*)) const in libLLVMSupport.a(ManagedStatic.cpp.o)
      llvm::llvm_shutdown() in libLLVMSupport.a(ManagedStatic.cpp.o)
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in ClangAttrEmitter.cpp.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in ClangAttrEmitter.cpp.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
      createArgument(llvm::Record const&, llvm::StringRef, llvm::Record const*) in ClangAttrEmitter.cpp.o
      CreateSemanticSpellings(std::__1::vector<(anonymous namespace)::FlattenedSpelling, std::__1::allocator<(anonymous namespace)::FlattenedSpelling> > const&, std::__1::map<unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in ClangAttrEmitter.cpp.o
      clang::EmitClangAttrSubjectMatchRuleList(llvm::RecordKeeper&, llvm::raw_ostream&) in ClangAttrEmitter.cpp.o
      clang::GenerateHasAttrSpellingStringSwitch(std::__1::vector<llvm::Record*, std::__1::allocator<llvm::Record*> > const&, llvm::raw_ostream&, 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 ClangAttrEmitter.cpp.o
      clang::EmitClangAttrParsedAttrImpl(llvm::RecordKeeper&, llvm::raw_ostream&) in ClangAttrEmitter.cpp.o
      clang::EmitClangAttrParsedAttrKinds(llvm::RecordKeeper&, llvm::raw_ostream&) in ClangAttrEmitter.cpp.o
      clang::EmitClangAttrDocs(llvm::RecordKeeper&, llvm::raw_ostream&) in ClangAttrEmitter.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[2]: *** [interpreter/llvm/src/bin/clang-tblgen] Error 1
make[1]: *** [interpreter/llvm/src/tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/all] Error 2
make: *** [all] Error 2

Could anyone help me? Installing ROOT by using conda is not an option because it also changes the Clang version to 4.0.1.

I made another conda environment in which I did not install CMake, but instead I used another CMake installation via Homebrew. By using the latter, building ROOT was successful, and I did not have to give the options -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang to CMake.

However, I got a seg fault when I tried to import ROOT as shown below.

(cta_root_test) $ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT

 *** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/lib/libpython3.6m.dylib] PyUnicode_InternFromString (no debug info)
[/usr/local/root-6.16.00/obj_conda/lib/libPyROOT.so] PyROOT::CreatePyStrings() /usr/local/root-6.16.00/bindings/pyroot/src/PyStrings.cxx:64
[/usr/local/root-6.16.00/obj_conda/lib/libPyROOT.so] PyInit_libPyROOT /usr/local/root-6.16.00/bindings/pyroot/src/RootModule.cxx:848
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyImport_LoadDynamicModuleWithSpec (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _imp_create_dynamic (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyCFunction_Call (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] builtin_exec (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyCFunction_Call (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] builtin_exec (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyCFunction_Call (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] fast_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] call_function (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyRun_InteractiveOneObjectEx (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyRun_InteractiveLoopFlags (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] PyRun_AnyFileExFlags (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] Py_Main (no debug info)
[/Users/oxon/anaconda3/envs/cta_root_test/bin/python] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)

Any idea?

According to this thread, the reason may be the incompatibility of the compilers used for the ROOT build (system Clang 10.0.1) and Python build (Anaconda uses Clang 4.0.1 for Python build).

(cta_root_test) $ otool -L $ROOTSYS/lib/libPyROOT.so             
/usr/local/root-6.16.00/obj_conda/lib/libPyROOT.so:
	@rpath/libPyROOT.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libTree.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libpython3.6m.dylib (compatibility version 3.6.0, current version 3.6.0)
	@rpath/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libRIO.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCore.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
(cta_root_test)$ otool -L `which python3`          
/Users/oxon/anaconda3/envs/cta_root_test/bin/python3:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

The both uses the same /usr/lib/libSystem.B.dylib, but the versions printed are 1252.250.1 for libPyROOT.so and 1197.1.1 for python3.

Is this the reason of the seg fault? Any workaround?

Yes, you really have to use the same compiler, otherwise the libraries are not guaranteed to be compatible. Is there a reason you cannot take ROOT already compiled from conda-forge?

I have two reasons. The first one is that NumPy installation from the default source got broken by conda-forge NumPy that needed to be installed together with ROOT, resulting in import error during import numpy. There may be a workaround, but I did not dig into the issue.

The second one is that the conda ROOT installation brings Clang 4.0.1, which is used by default when compiling non-conda packages, and I got different behavior in the build process of the non-conda packages from that by the system default Clang.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.