Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7833 Discussions

macOS Catalina must set sysroot for icpc?

ONeil__Michael
Beginner
1,855 Views

I'm running macOS Catalina 10.15.3, Xcode 11.3.1 (all is a fresh install, new computer) with Intel C++ 2020 Initial Release. When trying to compile the simple program "main.cpp" :

- - - - - - - 

#include <iostream>
int main() {
  std::cout << "hello world" << std::endl;
  return 0;
}

- - - - - - - - 

with the command "icpc main.cpp" I get the following error:

- - - - - - - - 

In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd(96),

                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios(215),

                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream(38),

                 from main.cpp(1):

/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h(119): catastrophic error: cannot open source file "wchar.h"

  #include_next <wchar.h>

                         ^

compilation aborted for main.cpp (code 4)

- - - - - - - - 

 

The error goes away and the code compiles fine when I use: "icpc main.cpp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"

How come Intel doesn't ship these headers so that the compiler is self-contained? I'm executing the compilervars script when I launch my terminal, why is this directory not set? Is there a way around setting sysroot when compiling? This was also address in stack overflow, but no alternative solution was proposed:

https://stackoverflow.com/questions/59938881/intel-c-cannot-open-wchar-h-on-mac-osx

Thanks - 

Mike

0 Kudos
1 Solution
Viet_H_Intel
Moderator
1,855 Views

I don't have Xcode 11.3.1 on our systems. But it compiled on Xcode 11.2.1

 

orcsme146:tmp super$ sw_vers -productVersion
10.15.3
orcsme146:tmp super$ /opt/intel/compilers_and_libraries_2020.0.166/mac/bin/intel64/icpc t.cpp -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

orcsme146:tmp super$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
Xcode 11.2.1
Build version 11B500
orcsme146:tmp super$
orcsme146:tmp super$ cat t.cpp
#include <iostream>
int main() {
  std::cout << "hello world" << std::endl;
  return 0;
}

orcsme146:tmp super$ /opt/intel/compilers_and_libraries_2020.0.166/mac/bin/intel64/icpc t.cpp
orcsme146:tmp super$
 

View solution in original post

0 Kudos
7 Replies
RahulV_intel
Moderator
1,854 Views

Hi Micheal,

This sounds like a bug. We are investigating on this issue and we will get back to you at the earliest. 

Thanks for reporting this issue.

 

Regards,

Rahul

0 Kudos
ONeil__Michael
Beginner
1,855 Views

Great - thanks very much for looking into this!

0 Kudos
Viet_H_Intel
Moderator
1,856 Views

I don't have Xcode 11.3.1 on our systems. But it compiled on Xcode 11.2.1

 

orcsme146:tmp super$ sw_vers -productVersion
10.15.3
orcsme146:tmp super$ /opt/intel/compilers_and_libraries_2020.0.166/mac/bin/intel64/icpc t.cpp -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

orcsme146:tmp super$ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
Xcode 11.2.1
Build version 11B500
orcsme146:tmp super$
orcsme146:tmp super$ cat t.cpp
#include <iostream>
int main() {
  std::cout << "hello world" << std::endl;
  return 0;
}

orcsme146:tmp super$ /opt/intel/compilers_and_libraries_2020.0.166/mac/bin/intel64/icpc t.cpp
orcsme146:tmp super$
 

0 Kudos
ONeil__Michael
Beginner
1,855 Views

Directly running /opt/intel/compilers_and_libraries_2020.0.166/mac/bin/intel64/icpc on my machine still did not work.

What do you recommend? Installing Xcode 11.12.1 for the time being and using that one? Do you have detailed instructions for how to maintain multiple Xcode versions? Do the Intel compilers need to be reinstalled? Are these the correct instructions?

http://iosdevelopertips.com/xcode/xcode-select-managing-multiple-versions-of-xcode.html

What is the correct order of installations:

1 - Xcode 11.12.1

2 - Command-line tools

3 - (Reinstall Intel compilers?)

0 Kudos
Viet_H_Intel
Moderator
1,855 Views

Xcode 11.3.1 release just about a month ago (a few months after Intel C++ 2020 Initial Release). I would suggest to use Xcode versions which released before the compiler released date.

0 Kudos
ONeil__Michael
Beginner
1,855 Views

I can confirm that this code will build with Xcode 11.2.1. Thanks for your help!

0 Kudos
Viet_H_Intel
Moderator
1,287 Views

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,


0 Kudos
Reply