OSX build failing

Hi,

I am attempting to build/install the current prod version of ROOT on my Mac (6.08.00), which is running OSX 10.9.4 but I am getting an enormous number of errors when running CMake.

I have put the error log here.

http://www.slac.stanford.edu/~jeremym/debug/CMakeError.log

Here is the info about the installed gcc compiler.

[559 $] gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

CMake is version 3.7 but I doubt that matters at all here.

This is the cmake command I’m running, which is basically just enabling GDML and leaving all other options as default.

cmake -Dgdml=ON ../root-6.08.00

I understand that this should be a supported platform. Is there some doc I should read about setting up XCode so that it will be able to build ROOT properly?

For instance, I see it complains about a missing Fortran compiler, amongst other errors, so I assume that’s something I need to install.

Other errors look at bit more scary, as they seem to indicate incompatibilities between the std headers ROOT is using vs what is installed on my machine.

Thanks.

–Jeremy

I think you need to upgrade the Xcode, install the command line tools xcode-select --install, and if you want to disable all fortran add the option -Dfortran=OFF
See root.cern.ch/build-prerequisites#macosx

Okay, that fixes CMake. I’ve disabled Fortran for now. Thanks for this tip.

Then I get a compile error in clang compilation …

[ 48%] Building CXX object interpreter/llvm/src/tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGBlocks.cpp.o
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name CGBlocks.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -coverage-file /work/ldmx/dev/root-6.08.00-build/interpreter/llvm/src/tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGBlocks.cpp.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -D GTEST_HAS_RTTI=0 -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D NDEBUG -I /work/ldmx/dev/root-6.08.00-build/interpreter/llvm/src/tools/clang/lib/CodeGen -I /work/ldmx/dev/root-6.08.00/interpreter/llvm/src/tools/clang/lib/CodeGen -I /work/ldmx/dev/root-6.08.00/interpreter/llvm/src/tools/clang/include -I /work/ldmx/dev/root-6.08.00-build/interpreter/llvm/src/tools/clang/include -I /work/ldmx/dev/root-6.08.00-build/interpreter/llvm/src/include -I /work/ldmx/dev/root-6.08.00/interpreter/llvm/src/include -stdlib=libc++ -O2 -W -Wall -Woverloaded-virtual -Wno-comment -Wno-missing-field-initializers -Wno-conditional-uninitialized -Wno-unused-private-field -Wno-parentheses-equality -Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Woverloaded-virtual -Wno-nested-anon-types -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /work/ldmx/dev/root-6.08.00-build/interpreter/llvm/src/tools/clang/lib/CodeGen -ferror-limit 19 -fmessage-length 126 -fvisibility hidden -fvisibility-inlines-hidden -pthread -stack-protector 1 -mstackrealign -fblocks -fno-rtti -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fno-common -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o CMakeFiles/clangCodeGen.dir/CGBlocks.cpp.o -x c++ /work/ldmx/dev/root-6.08.00/interpreter/llvm/src/tools/clang/lib/CodeGen/CGBlocks.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/work/ldmx/dev/root-6.08.00/interpreter/llvm/src/tools/clang/lib/CodeGen/CGBlocks.cpp'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN5clang7CodeGen15CodeGenFunction12EmitCallArgsINS_17FunctionProtoTypeEEEvRNS0_11CallArgListEPKT_N4llvm14iterator_rangeINS_4Stmt17ConstExprIteratorEEEPKNS_12FunctionDeclEj'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: error: unable to execute command: Segmentation fault: 11
clang: note: diagnostic msg: Error generating preprocessed source(s).
make[2]: *** [interpreter/llvm/src/tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGBlocks.cpp.o] Error 254
make[1]: *** [interpreter/llvm/src/tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/all] Error 2
make: *** [all] Error 2

This is my OS info:

[524 $] uname -a
Darwin jeremys-mbp-2.attlocal.net 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

It does not appear that the xcode-select command upgraded the compiler version. It is the same as before.

Any ideas?

I just noticed my OS version is old and so is Xcode itself so I’m going to download Sierra and update Xcode from the app store. I’ll let you know if this fixes things.

Hi Jeremy,

With the latest install of MacOSX and XCode, you must configure with -Dfortran=OFF
because fortran is not part of the regular code installation . The default is ON and
this is a bug in cmake configuration.

-Eddy

Hi Eddy,
There are parts in ROOT that require the Fortran compiler. This is the reason to have this option as default ON. What happens is that if the fortran compiler is not found, then all the elements requiring fortran are switched off. But, if a fortran compiler is found but incompatible with the c++ or any other problem, then the option ‘fortran’ is there to force ignoring the found compiler and all the fortran elements.
Pere

Hi Pere,

On a MacOSX Siera system, even after installing XCode, fortran is NOT available,
therefore the default option has to be OFF.
(I am aware that optional parts of ROOT do need a fortran compiler).

-Eddy

Hi Eddy,

The CMake implementation had a bug where fortran would still be on even if not found. I think that’s indeed fixed.

Axel.

Hi,

I take that back: we have a new report on this issue with ROOT’s CMake scripts. I.e. apparently it’s not yet solved.

Axel.

After updating, my build fails here now:

[ 54%] Building CXX object core/metautils/CMakeFiles/MetaUtils.dir/src/RConversionRuleParser.cxx.o
In file included from /work/ldmx/dev/root-6.08.00/core/metautils/src/RConversionRuleParser.cxx:6:
In file included from /work/ldmx/dev/root-6.08.00-build/include/TMetaUtils.h:74:
In file included from /work/ldmx/dev/root-6.08.00-build/include/TClassEdit.h:67:
In file included from /work/ldmx/dev/root-6.08.00-build/include/RStringView.h:26:
/work/ldmx/dev/root-6.08.00-build/include/RWrap_libcpp_string_view.h:329:4: error: redefinition of '__find_first_of_ce'
   __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1047:1: note: previous
      definition is here
__find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
^
In file included from /work/ldmx/dev/root-6.08.00/core/metautils/src/RConversionRuleParser.cxx:6:
In file included from /work/ldmx/dev/root-6.08.00-build/include/TMetaUtils.h:74:
In file included from /work/ldmx/dev/root-6.08.00-build/include/TClassEdit.h:67:
In file included from /work/ldmx/dev/root-6.08.00-build/include/RStringView.h:26:
/work/ldmx/dev/root-6.08.00-build/include/RWrap_libcpp_string_view.h:342:4: error: redefinition of '__str_find'
   __str_find(const _CharT *__p, _SizeT __sz,

There’s quite a long list of similar error messages.

Here’s the compiler info:

[511 $] gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix

XCode version after upgrade is 8.1 on OSX 10.12.1 (Sierra).

Enabled packages are: asimage astiff bonjour builtin_afterimage builtin_ftgl builtin_freetype builtin_gl2ps builtin_glew builtin_pcre builtin_unuran builtin_lzma builtin_llvm cxx11 cling cocoa exceptions explicitlink gviz gdml genvector krb5 ldap memstat mysql opengl pch python shared sqlite thread tmva vdt xml.

Any ideas? Does this have anything to do with the Fortran config? (It doesn’t look like it to me.)

What is a known good config on OSX that is used to generate the distribution tarballs on the ROOT site?

Did you start from a clean build area after upgrading (Xcode?)?

I thought I did. I’ll retry this tonight and make sure to wipe out everything completely before rebuilding. Thanks.

Hi,

Reviving this thread…

I am pretty sure that a clean build on OSX with up-to-date toolchain is not working for me.

What is the known good configuration of gcc, XCode, OSX version, etc. that is used to generate the ROOT distributions?

It would be helpful if I could compare against my toolchain to see if there are any major version differences which might be the source of my build troubles.

Thanks.

–Jeremy

Hi Jeremy,
Our MacOS distributions are done with the native clang compiler (just installing Xcode and the command line tools). The configuration command we use on the nightlies is as follows (enabling all the tests and all features)

"/Applications/CMake.app/Contents/bin/cmake" "-Dall=ON" "-Dtesting=ON" "-Droottest=ON" "-DCMAKE_INSTALL_PREFIX=/Volumes/MacintoshHD2/ec/build/workspace/root-nightly-master/BUILDTYPE/Release/COMPILER/native/LABEL/mac1012/install" "-Dmacos_native=ON" "-Dvc=OFF" "-DCMAKE_BUILD_TYPE:STRING=Release" "-GUnix Makefiles" "/Volumes/MacintoshHD2/ec/build/workspace/root-nightly-master/BUILDTYPE/Release/COMPILER/native/LABEL/mac1012/root"

Lets debug it then. Can you post your current toolchain, your configuration commands and the errors you get.

Pere

Hi, mato.

Sorry for the late reply…

It seems to be working now! Possible I didn’t fully cleanup my previous build which was using old build tool versions.

Just for reference, I am using this config:

ROOT 6.08.00

OSX 10.12.1

[510 $] /usr/bin/xcodebuild -version
Xcode 8.1
Build version 8B62

cmake version 3.7.0

[505 $] gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I run cmake like:

cmake …/root-6.08.00 -Dfortran=OFF

Then ‘make -j4’ seems to work okay and builds ROOT into my install dir.

Thanks!