Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Using custom Clang version

New Contributor I


I am trying to upgrade a project to a newer compiler stack and language standard. I end up with some strange errors. I have this command line:

/opt/intel/compilers_and_libraries_2016.4.210/mac/bin/intel64/icpc -D_REENTRANT -DHAVE_GCCVISIBILITY -DMACOSX \
-mmacosx-version-min=10.11 -clangxx-name=/usr/local/llvm-3.9.1/bin/clang++ -std=c++11 -fno-omit-frame-pointer \
-fPIC -fvisibility=hidden -fmath-errno -qopenmp -fp-model precise -g -Wall -Wno-deprecated -pthread -o foo.o -c foo.cpp

It returns:

In file included from foo.cpp(9):
bar.hpp(16): catastrophic error: cannot open source file "iostream"
    #include <iostream>
compilation aborted for foo.cpp (code 4)

It builds fine if built for macOS 10.8 and gnu++98.

Another problem that I am facing is that I can't get LLVM functionality, for example llvm::dyn_cast is unknown no matter what I include.

Has anybody faced similar problems?

0 Kudos
2 Replies
Valued Contributor II
>>...#include iostream >> >>...cannot open source file "iostream" It is a path related problem. All environment variables ( paths to include and binary directories ) used by Intel C/C++ compilers ( icpc or icc ) need to be set using a source command. Did you call it?
New Contributor I

What I am supposed to source in my case? Can you please give an example? The Intel compiler is installed in /opt/intel/compilers_and_libraries_2016.4.210 while Clang is installed in /usr/local/llvm-3.9.1.


By the way, if I revert to gnu++98 and minimal macos support 10.8, it bulds but the following fails when using LLVM functionality:

#include <llvm/Support/Casting.h>


foobar.cpp(26): catastrophic error: cannot open source file "llvm/Support/Casting.h"
  #include <llvm/Support/Casting.h>

Supplying -I/usr/local/llvm-3.9.1/include complains about not finding type_traits:

In file included from /usr/local/llvm-3.9.1/include/llvm/Support/Casting.h(19),
                 from foobar.cpp(26):
/usr/local/llvm-3.9.1/include/llvm/Support/type_traits.h(17): catastrophic error: cannot open source file "type_traits"
  #include <type_traits>

If I supply -I/usr/local/llvm-3.9.1/include/c++/v1, the things get completely out of control.

If I instead use the default Clang on Mac, I have the same issues.