- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just wondering if it is possible to use classic icpc with just Apple's Command Line Tools installed? Seems to be that icpc doesn't quite get its include search path right. So if we have a very simple one line c++ file:
#include <stdio.h>
and we try and compile that with icpc with Apple's command line tools we get an error because the Apple C++ version of <stdio.h> is found correctly but that file uses #include_next <stdio.h> to find the C version (on macOS that'd be in the SDK) which is not on the search path:
--> icpc -c stdio.cpp
In file included from stdio.cpp(1):
/Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++/v1/stdio.h(107): catastrophic error: cannot open source file "stdio.h"
#include_next <stdio.h>
^
compilation aborted for stdio.cpp (code 4)
using -I$SDKDIR isn't a simple option here because that'll get put at the front of the search path and #include_next needs it to be after the C++ one. I guess I could use two -I flags, first for the C++ header and then the C version but I'm hoping there is a simpler technique. I looked into using CPATH that I know classic also puts into the search path but that's also too early.
Here's the actual search path I end up with on such a mac:
--> icpc -c -H -v stdio.cpp
...
#include "..." search starts here:
#include <...> search starts here:
/opt/intel/oneapi/tbb/2021.5.0/env/../include
/opt/intel/oneapi/dnnl/2022.0.0/cpu_iomp/lib
/opt/intel/oneapi/dev-utilities/2021.5.0/include
/opt/intel/oneapi/compiler/2022.0.0/mac/bin/intel64/../../compiler/include/icc
/opt/intel/oneapi/compiler/2022.0.0/mac/bin/intel64/../../compiler/include
/Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++/v1
/System/Library/Frameworks
/Library/Frameworks
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
/usr/local/include
End of search list.
. /Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++/v1/stdio.h
.. /Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++/v1/__config
In file included from stdio.cpp(1):
/Library/Developer/CommandLineTools/usr/bin/../../usr/include/c++/v1/stdio.h(107): catastrophic error: cannot open source file "stdio.h"
#include_next <stdio.h>
^
compilation aborted for stdio.cpp (code 4)
which is super close, just missing the SDK entirely.
I can just install Xcode, and that seems to trigger the inclusion of the SDK directory, I'm just trying to avoid that.
cheers,
- James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about using -isysroot?
icpc main.cpp -isysroot /path_to/MacOSX.sdk
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are able to reproduce your issue. We are working on it internally and will get back to you soon.
Thanks & Regards,
Varsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about using -isysroot?
icpc main.cpp -isysroot /path_to/MacOSX.sdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That works for me, thank you!
I used, this on my macOS 11.5 machine
--> clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
--> icpc -c -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk stdio.cpp
MacOSX.sdk is a symlink to a specific version, presumeably that'll change over time. I tried 10.15, 11.3 and 12.1, they all worked
- James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for accepting the solution. Let's close this thread. If you need further assistance, please create a new thread.
Regards,
Viet
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page