Mac OSX xcode command line tools v9.0

Earlier today, my Mac updated xcode and command line tools to v9.0 and now I am not able to compile programs that #include <TROOT.h>. For example, this simple program compiles fine if the #include <TROOT.h> is commented out.

#include <iostream>
#include <TROOT.h>

int main(int argc, char *argv[]) {
         std::cout << "hello" << std::endl;
}

Uncommenting the #include <TROOT.h> and compiling with

g++ -Wall -o anal anal.C

produces the following compilation errors:

visitor050:rootInc reimer$ g++ -Wall -o anal anal.C
In file included from anal.C:2:
In file included from /usr/local/include/TROOT.h:29:
In file included from /usr/local/include/TDirectory.h:25:
In file included from /usr/local/include/TNamed.h:29:
In file included from /usr/local/include/TString.h:41:
/usr/local/include/RStringView.h:35:12: error: unknown type name
      'basic_string_view'
   typedef basic_string_view<char> string_view;
           ^
/usr/local/include/RStringView.h:35:29: error: expected unqualified-id
   typedef basic_string_view<char> string_view;
                            ^
/usr/local/include/RStringView.h:36:12: error: unknown type name
      'basic_string_view'
   typedef basic_string_view<char16_t> u16string_view;
           ^
/usr/local/include/RStringView.h:36:29: error: expected unqualified-id
   typedef basic_string_view<char16_t> u16string_view;
                            ^
/usr/local/include/RStringView.h:37:12: error: unknown type name
      'basic_string_view'
   typedef basic_string_view<char32_t> u32string_view;
           ^
/usr/local/include/RStringView.h:37:29: error: expected unqualified-id
   typedef basic_string_view<char32_t> u32string_view;
                            ^
/usr/local/include/RStringView.h:38:12: error: unknown type name
      'basic_string_view'
   typedef basic_string_view<wchar_t> wstring_view;
           ^
/usr/local/include/RStringView.h:38:29: error: expected unqualified-id
   typedef basic_string_view<wchar_t> wstring_view;
                            ^
/usr/local/include/RStringView.h:50:28: error: no member named 'to_string' in
      'std::__1::basic_string_view<char, std::__1::char_traits<char> >'
      return std::stod(str.to_string(),pos);
                       ~~~ ^
In file included from anal.C:2:
In file included from /usr/local/include/TROOT.h:29:
In file included from /usr/local/include/TDirectory.h:25:
In file included from /usr/local/include/TNamed.h:29:
/usr/local/include/TString.h:117:75: error: no member named 'to_string' in
      'std::__1::basic_string_view<char, std::__1::char_traits<char> >'
  ...std::string() const { return std::string_view(Data(),fExtent).to_string(...
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
10 errors generated.

For completeness,

visitor050:rootInc reimer$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and

visitor050:rootInc reimer$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29

Thanks

Paul

Forgot to add, I’m using root includes/libraries from 6.06/08

visitor050:rootInc reimer$ root
   -------------------------------------------------------------------------
  | Welcome to ROOT 6.06/08                             http://root.cern.ch |
  |                                            (c) 1995-2016, The ROOT Team |
  | Built for macosx64                                                      |
  | From heads/v6-06-00-patches@v6-06-06-30-g3bae07b, Sep 01 2016, 14:28:05 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'              |
   -------------------------------------------------------------------------

Unfortunately, XCode 9 is introducing changes to the standard library that are incompatible with that version of ROOT. There is a small chance that reconfigure and rebuild ROOT itself from scratch will solve the problem (depending on which plugin you need).

If this does not work, you will need to use the master branch of ROOT with commit 263508429dec26449513914e71f0f71c9ce9485f or later.

Cheers,
Philippe.

1 Like

Thanks, I pulled a recent version with

git clone http://root.cern.ch/git/root.git

and compiled and installed it and then everything worked perfectly.

Paul

Hi,

I guess I am having a similar problem:
I have a macbook pro 2016 running macOS Sierra (10.12.6) and I have installed root6 via homebrew and it has been working without any problems.

This morning I updated Command Line Tools to version 9.0, and this happens to crash with root:

francescolosterzo ~$ root -l 
input_line_1:1:10: fatal error: file '/Library/Developer/CommandLineTools/usr/include/c++/v1/new' modified since it was first processed
#include <new>
         ^
input_line_3:36:10: fatal error: file '/Library/Developer/CommandLineTools/usr/include/c++/v1/string' modified since it was first processed
#include <string>
         ^
input_line_7:2:10: fatal error: error opening file '/Library/Developer/CommandLineTools/usr/include/c++/v1/string':
#include <string>

As you can see above I can’t even open root without having this problem.
Do you foresee any permanent fix to this?

What shall I do? Is reverting to the previous version of Command Line Tools an option?

I tried to reinstall root from scratch (always via brew) but this didn’t fix the problem.

Thanks!!
Francesco

My expérience with the last Mac updates is:

First I installed XCode 9 when it showed up. I still had MacOS 10.12 at that time. ROOT did not compiled because of the TString issue. This is now fixed in the ROOT code.

Then, later on, I installed MacOS 10.13 when it showed up too. Again ROOT did not compile … But in some part of the code we had not touched. I solved that doing:

$ xcode-select --install

Now all is fine for me.

Hi @couet

Command Line Tools are already installed on my mac:

francescolosterzo ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
francescolosterzo ~$ 

And having gone to “Software Update” is what triggered the problem.

Thanks!
Francesco

ok … I just told you my experience in case it could help. On my mac I now have all the most recent versions of Xcode, MacOS and ROOT and all is finally working.

Hi, I am having the same issue too…

I’m quite new to all this, but I just need to update Root? I have the v6.06/08. I’ve been using Homebrew to download Root previously, any of you using that too?
Thanks in advance!
Barnabas

Ahh, but you installed ROOT from source where as @losterzo is trying to install from homebrew. I suspect that homebrew has not been updated with the recent fix and that you will need to build from source until that time. See this page for instruction on how to build from source: Building ROOT from source - ROOT

Yes yes sure … I just explained what I did to make clear there is no problem with the current ROOT master.

I’m not sure that was clear to the others, just wanted to make it explicit.

Any timeline on when the patch will be in a release? I’m reluctant to upgrade my machine until this point as I don’t want to tell the users I support that I can only verify the code against the master.

1 Like

yes, is there any idea on when the homebrew version will be fixed? If it’s coming, I’d avoid compiling root.

Thanks!!!

Another option:

1 Like

Hi @ksmith

it looks like I have the Command Line Tools (update to v9.0 via the App Store), but I have no Xcode (if I look for it on the App Store I see the “Get” button) … I didn’t know this was even possible.

From my post above:

francescolosterzo ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
francescolosterzo ~$ 

The point is that I found instructions about how to downgrade Xcode, but I can’t find any about how to downgrade a “standalone” instance of Command Line Tools.

Any ideas/suggestions? Shall I just install the older version of Xcode and that will take care of CLT? Or shall I instead install the latest Xcode and then downgrade it?

Thanks!!!

Perhaps @Ashley_Hood knows more as it was her post.

@losterzo,

I uninstalled my Xcode 9 and restarted my computer. I then went to the developer website and downloaded the Xcode 8.3.3. After installing that version, everything in root has been running smoothly. Here’s the site again: https://developer.apple.com/download/more/

edit: I already had root6 installed using Homebrew and I didn’t need to fix anything after reinstalling Xcode.

It worked indeed. I installed Xcode 8.3.3 and ran

brew upgrade root

and now everything works fine.

Thanks!

Sorry to bother, but I still see some problem here:
as I wrote above when I run root everything is fine, but I see that when I run my python to generate some plots I get this error:

francescolosterzo MCStudies$ python makePlots.py 
fatal error: file
      '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory'
      modified since it was first processed

The error is not there if I just open a python shell.

Any idea? What shall I do?

Try rebuilding ROOT from scratch …