Compile on OSX 10.10.3

Dear experts,

the recent update of OS X to 10.10.3 has broken my self-compiled ROOT 6. I did not keep a copy of the exact error message, but it was along the lines of a mismatch between some standard library and the version that was compiled-against and the one present on the system… I thus wanted to recompile ROOT with the new libs.

Fetching the latest version via git clone http://root.cern.ch/git/root.git I wanted to compile it with the usual instructions for the cmake build. However, I get several compilation errors. The first is:

Scanning dependencies of target MetaUtilsLLVM [ 43%] Building CXX object core/metautils/CMakeFiles/MetaUtilsLLVM.dir/src/BaseSelectionRule.cxx.o In file included from /Users/pigard/ROOT/source/core/metautils/src/BaseSelectionRule.cxx:21: In file included from /Users/pigard/ROOT/source/core/metautils/src/BaseSelectionRule.h:30: In file included from /Users/pigard/ROOT/workdir/include/TMetaUtils.h:73: In file included from /Users/pigard/ROOT/workdir/include/TClassEdit.h:66: In file included from /Users/pigard/ROOT/workdir/include/RStringView.h:18: /Users/pigard/ROOT/workdir/include/RWrap_libcpp_string_view.h:330: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, I also tried the classic make build with the same result.

Any ideas on how to proceed?

Thanks and best regards
Philipp

Hi Philipp,

Can you try the following patch

[code]diff --git a/core/metautils/inc/RStringView.h b/core/metautils/inc/RStringView.h
index ec9edc5…a5143b1 100644
— a/core/metautils/inc/RStringView.h
+++ b/core/metautils/inc/RStringView.h
@@ -12,8 +12,22 @@
#ifndef RStringView_H
#define RStringView_H

+#if defined(__has_include)
+#if __has_include(“string_view”)
+
+#define R_HAS_std_string_view_header
+
+#elif __has_include(“experimental/string_view”)
+
+#define R_HAS_std_experimental_string_view
+
+#endif
+#endif // __has_include
+
#ifdef R_HAS_std_string_view_header
#include <string_view>
+#elif R_HAS_std_experimental_string_view
+#include <experimental/string_view>
#else
#include “RWrap_libcpp_string_view.h”
#endif
[/code]

Thanks,
Philippe.

Hello Philippe,

I applied the proposed patch patch, resulting in the following code for the pre-processor:

[code]#ifndef RStringView_H
#define RStringView_H

#if defined(__has_include)
#if __has_include(“string_view”)
#define R_HAS_std_string_view_header
#elif __has_include(“experimental/string_view”)
#define R_HAS_std_experimental_string_view
#endif
#endif // __has_include

#ifdef R_HAS_std_string_view_header
#include <string_view>
#elif R_HAS_std_experimental_string_view
#include <experimental/string_view>
#else
#include “RWrap_libcpp_string_view.h”
#endif

/*
#ifdef R_HAS_std_string_view_header
#include <string_view>
#else
#include “RWrap_libcpp_string_view.h”
#endif
*/
#if defined( R_HAS_std_experimental_string_view )
[/code]

Compiling this gives the errors reported in my first post and in addition:

/Users/pigard/ROOT/workdir/include/RStringView.h:25:41: error: expected value in expression #elif R_HAS_std_experimental_string_view

Cheers,
Philipp

In the patch replace#elif R_HAS_std_experimental_string_viewwith#elif defined(R_HAS_std_experimental_string_view)

Cheers,
Philippe.

Hello Philippe,

after the replacement I get only one error:

Scanning dependencies of target Unix [ 8%] Building CXX object core/unix/CMakeFiles/Unix.dir/src/TUnixSystem.cxx.o /Users/pigard/ROOT/source/core/unix/src/TUnixSystem.cxx:401:4: error: thread-local storage is not supported for the current target thread_local TString exepath;

Cheers
Philipp

Hi,

Apple’s version of clang explictly disable support for thread_local (and due to a mistake in clang, we could not see this until this release). This required significant backtracking to support this non-compliance with C++11. We completed this work and ROOT should now work properly with XCode 6.3.

Cheers,
Philippe.

Thank you Philippe for the quick responses! Compiles and works like a charm now.

Hi!

I have a similar problem trying to compile ROOT v6-10-08 under OS X 10.9.5. The latest XCode supported for my platform appears to be 6.2. I get the following error:

In file included from /Users/artem/cernroot_git/root/core/foundation/src/TClassEdit.cxx:9:
In file included from /Users/artem/cernroot_git/build/include/TClassEdit.h:65:
In file included from /Users/artem/cernroot_git/build/include/RStringView.h:41:
/Users/artem/cernroot_git/build/include/RWrap_libcpp_string_view.h:143:4: error: redefinition of '__pad_and_output'
   __pad_and_output(_OutputIterator __s,
   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/locale:1449:1: note: previous definition
      is here
__pad_and_output(_OutputIterator __s,
^
In file included from /Users/artem/cernroot_git/root/core/foundation/src/TClassEdit.cxx:9:
In file included from /Users/artem/cernroot_git/build/include/TClassEdit.h:65:
In file included from /Users/artem/cernroot_git/build/include/RStringView.h:41:
/Users/artem/cernroot_git/build/include/RWrap_libcpp_string_view.h:143:4: error: redefinition of '__pad_and_output'
   __pad_and_output(_OutputIterator __s,
   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/locale:1449:1: note: previous definition
      is here
__pad_and_output(_OutputIterator __s,
^

May there be a solution with XCode 6.2?
Would appreciate any help.

Thanks and cheers,
Artem

P. S.
Same thing happens for v6-11-02.
I’ve also tried v6-08-06, but that thing crashes the compiler with a segfault when it gets to building CGBlocks.cpp.o

P. P. S.
After some manipulations I’ve been able to compile v6-06-08…