Embedded cling error with latest xcode

Apologies, you have already printed the relevant information.

Hi,

Does “xcode-select --install” (without the quotes) help?

Axel.

Hi Axel,

xcode is already at its latest version, so, no it does not help (also without quote…)

Alessia

Hi,

What’s the output of

echo '#include <new>' | clang -x c++ -fsyntax-only -v -

Cheers, Axel.

$ echo '#include <new>' | clang -x c++ -fsyntax-only -v -
clang version 3.7.0 (http://root.cern.ch/git/clang.git 74fc5c43a975e53670382cf3cecf15925154d1ad) (http://root.cern.ch/git/llvm.git 4f6e66a29b11d6c6398f7e8cfa90356d07c1036a)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
 "/usr/local/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -fsyntax-only -disable-free -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -dwarf-column-info -resource-dir /usr/local/bin/../lib/clang/3.7.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/user/Downloads/cling-all-in-one -ferror-limit 19 -fmessage-length 142 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -x c++ -
clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target x86_64-apple-darwin16.0.0
ignoring nonexistent directory "/usr/local/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/bin/../lib/clang/3.7.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
<stdin>:1:10: fatal error: 'new' file not found
#include <new>
  
1 error generated.

Just to give you some background: clang/cling have been installed using yours (Axel’s) cling-all-in-one (github.com/karies/cling-all-in-one) script

Thanks,
Alessia

Hi,

O I see - you’re compiling cling with cling’s clang. Don’t do that :slight_smile: I.e. please make sure you use the “native” compiler.

  • don’t add cling’s bin directory to PATH when calling CMake
  • or pass -DCMAKE_CXX_COMPILER=/usr/bin/clang++ to the cmake invocation

Cheers, Axel.

cling wasn’t included in the PATH, but clang was overwritten. Fixed and now it works, thanks.
Alessia

Great! Thanks for confirming, Alessia!

Axel.

Hello everyone,

I installed root today and have the same issue. Despite reading the comments thoroughly, I could not figure out how to fix the problem. I have the command-line tools installed and I would like to avoid installing Xcode. I have root 6.10.00 installed on Sierra (10.12.5).

The error when starting root:

$ root
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
  LC_ALL=C /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -O2 -DNDEBUG -xc++ -E -v /dev/null 2>&1 >/dev/null | awk '/^#include </,/^End of search/{if (!/^#include </ && !/^End of search/){ print }}' | GREP_OPTIONS= grep -E "(c|g)\+\+"
Results was:
With exit code 256
input_line_1:1:10: fatal error: 'new' file not found
#include <new>
         ^
input_line_3:36:10: fatal error: 'string' file not found
#include <string>
         ^
   ------------------------------------------------------------
  | Welcome to ROOT 6.10/00                http://root.cern.ch |
  |                               (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                         |
  | From tag v6-10-00, 13 June 2017                            |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

input_line_7:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^

And since it seems to be important, also this

$ echo | LC_ALL=C clang++ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -O3 -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fno-common -Wcast-qual -fno-strict-aliasing -xc++ -E -v - 2>&1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 278.4 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.1.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -stdlib=libc++ -O3 -Wcast-qual -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/konstantin -ferror-limit 19 -fmessage-length 204 -fvisibility-inlines-hidden -stack-protector 1 -fblocks -fno-rtti -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fno-common -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o - -x c++ -
clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.6.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
 /usr/local/include
 /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.1.0/include
 /Library/Developer/CommandLineTools/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 354 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

Any help will be appreciated, thanks!
Konstantin

Hi Konstantin,

Indeed - we only support ROOT with Xcode installed.

Cheers, Axel.

Ok, thank you, Axel.

Konstantin

Sorry for what maybe an obvious question, but how does one edit the cmake invocation?

Can you open a new topic, please? And post there:

  • what you try to do (including platform, compiler etc)
  • what you get (error messages)
    Cheers, Axel.

Hello everyone,

I get the same problem, I recently updated to root 6.10.08 and to MacOs High Sierra (10.13) and to the latest version of Xcode, agreed to Xcode license. I seem to have done anything already suggested in the thread, nonetheless i get similar errors. Any idea why?

Nicolas-MBP:Thesis Nikolajal$ root
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
  LC_ALL=C /Library/Developer/CommandLineTools/usr/bin/c++   -O2 -DNDEBUG -xc++ -E -v /dev/null 2>&1 >/dev/null | awk '/^#include </,/^End of search/{if (!/^#include </ && !/^End of search/){ print }}' | GREP_OPTIONS= grep -E "(c|g)\+\+"
Results was:
With exit code 256
input_line_1:1:10: fatal error: 'new' file not found
#include <new>
         ^
input_line_3:36:10: fatal error: 'string' file not found
#include <string>
         ^
   ------------------------------------------------------------
  | Welcome to ROOT 6.10/08                http://root.cern.ch |
  |                               (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                         |
  | From tag v6-10-08, 16 October 2017                         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

input_line_7:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
root [0] .q
Nicolas-MBP:Thesis Nikolajal$ echo '#include <new>' | clang -x c++ -fsyntax-only -v -
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -fsyntax-only -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 302.3.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I/usr/local/include -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/Nikolajal/Thesis -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.13.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -x c++ -
clang -cc1 version 9.0.0 (clang-900.0.38) default target x86_64-apple-darwin17.2.0
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks (framework directory)
End of search list.'

In the future, please don’t answer to old topics but open a new one.

From your error log (/Library/Developer/CommandLineTools/usr/bin/c++) you might not have had Xcode installed when building cling. Did you build it yourself? Can you post the contents of the file tools/cling//lib/Interpreter/cling-compiledata.h?

Also, you will probably need the v6-10-00-patches branch, since this patch didn’t make it to v6.10/08.

Hi to all,
I’m sorry for retrieve this old topic. I’m trying to compile root v6-26 on my new MacBook Pro with OSX 12.5 and Xcode 13.4.1 but at 78% of the compiling process it fails with this error:

[ 78%] Linking CXX shared library …/…/…/lib/libCling.so
While building module ‘Core’:
While building module ‘std’ imported from input_line_1:1:
While building module ‘Darwin’ imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ctype.h:38:
In file included from :1421:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ncurses.h:141:
/opt/local/include/unctrl.h:61:38: error: cannot initialize a variable of type ‘char *’ with an lvalue of type ‘char *(chtype)’ (aka ‘char *(unsigned int)’)
NCURSES_EXPORT(NCURSES_CONST char ) NCURSES_SP_NAME(unctrl) (SCREEN, chtype);
^ ~~~~~~
/opt/local/include/unctrl.h:61:61: error: expected ‘;’ after top level declarator
NCURSES_EXPORT(NCURSES_CONST char ) NCURSES_SP_NAME(unctrl) (SCREEN, chtype);
^
While building module ‘Core’:
While building module ‘std’ imported from input_line_1:1:
In file included from :2:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ctype.h:38:15: fatal error: could not build module ‘Darwin’
#include_next <ctype.h>

input_line_1:1:10: fatal error: could not build module 'std'
#include <new>
~~~~~~~~^
Warning in cling::IncrementalParser::CheckABICompatibility():
 Failed to extract C++ standard library version.
Warning in cling::IncrementalParser::CheckABICompatibility():
 Possible C++ standard library mismatch, compiled with _LIBCPP_ABI_VERSION '1'
 Extraction of runtime standard library version was: ''
While building module 'Core':
While building module 'Cling_Runtime' imported from input_line_2:1:
While building module 'Cling_Runtime_Extra' imported from /Users/simone/root-6.26.00-build/etc/cling/Interpreter/RuntimeUniverse.h:27:
In file included from <module-includes>:1:
/Users/simone/root-6.26.00-build/etc/cling/Interpreter/DynamicExprInfo.h:13:10: fatal error: could not build module 'std'
#include <string>
~~~~~~~~^
/Users/simone/root-6.26.00-build/etc/cling/Interpreter/RuntimeUniverse.h:27:10: fatal error: could not build module 'Cling_Runtime_Extra'
#include "cling/Interpreter/Visibility.h"
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While building module 'Core':
While building module '_Builtin_intrinsics':
In file included from <module-includes>:2:
In file included from /Users/simone/root-6.26.00-build/etc/cling/lib/clang/9.0.1/include/immintrin.h:18:
In file included from /Users/simone/root-6.26.00-build/etc/cling/lib/clang/9.0.1/include/xmmintrin.h:27:
In file included from /Users/simone/root-6.26.00-build/etc/cling/lib/clang/9.0.1/include/mm_malloc.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:93:
/Users/simone/root-6.26.00-build/etc/cling/lib/clang/9.0.1/include/stdlib.h:8:15: fatal error: could not build module 'Darwin'
#include_next <stdlib.h>
~~~~~~~~~~~~~^
While building module 'Core':
<<< cling interactive line includer >>>: fatal error: could not build module '_Builtin_intrinsics'
Error: Module '_Builtin_intrinsics' failed to load.
[ 78%] Built target Cling
While building module 'Core':
While building module 'ROOT_Rtypes' imported from /Users/simone/root-6.26.00-build/include/Rtypes.h:23:
In file included from <module-includes>:1:
In file included from /Users/simone/root-6.26.00-build/include/RtypesCore.h:23:
/Users/simone/root-6.26.00-build/include/ROOT/RConfig.hxx:279:13: fatal error: could not build module 'Darwin'
#   include <AvailabilityMacros.h>
   ~~~~~~~~^
While building module 'Core':
While building module 'ROOT_Rtypes' imported from /Users/simone/root-6.26.00-build/include/Rtypes.h:23:
While building module 'ROOT_Config' imported from /Users/simone/root-6.26.00-build/include/RtypesCore.h:25:
In file included from <module-includes>:1:
In file included from /Users/simone/root-6.26.00-build/include/RConfig.h:23:
/Users/simone/root-6.26.00-build/include/ROOT/RConfig.hxx:279:13: fatal error: could not build module 'Darwin'
#   include <AvailabilityMacros.h>
   ~~~~~~~~^
While building module 'Core':
While building module 'ROOT_Foundation_C' imported from /Users/simone/root-6.26.00-build/include/Rtypes.h:29:
In file included from <module-includes>:1:
In file included from /Users/simone/root-6.26.00-build/include/ThreadLocalStorage.h:57:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stddef.h:45:15: fatal error: could not build module 'Darwin'
#include_next <stddef.h>
~~~~~~~~~~~~~^
While building module 'Core':
While building module 'ROOT_Foundation_Stage1_NoRTTI' imported from /Users/simone/root-6.26.00-build/include/Rtypes.h:195:
In file included from <module-includes>:2:
/Users/simone/root-6.26.00-build/include/ROOT/RStringView.hxx:25:10: fatal error: could not build module 'std'
#include <string_view>
~~~~~~~~^
Error: Error loading the default rootcling header files.
make[2]: *** [core/G__Core.cxx] Error 1
make[1]: *** [core/CMakeFiles/G__Core.dir/all] Error 2
make: *** [all] Error 2

I went through all the messages in this topic but I still not resolve the problem.
Any other idea?
Thank you very much.

Try the head of the v6-26-00-patches branch (the “latest stable” for today).

Thanks for the prompt feedback Wile, but the error is still there :frowning:

That’s caused by an inconsistency between homebrew (?)'s /opt/local/include/unctrl.h vs macOS’s ncurses.h. Can you ask the homebrew (if that’s what you have installed) folks for their recommendation? We probably need to hide /opt/local/include here.