Support #18043
UPS GCC 6.3.0 include configuration borked on OSX 10.12 (Sierra)
Description
The distribution of GCC for OSX Sierra is borked enough that it's not possible to use g++
to compile standard things. For example, including iostream
does not work:
setup gcc v6_3_0 g++ -c -xc++ -o /dev/null - <<< "#include <iostream>"fails to find
wchar.h
.The problem appears to be that the system include path does not include standard C libraries. Please compare GCC output:
$ echo | gcc -E -Wp,-v - ignoring nonexistent directory "/Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/../../../../x86_64-apple-darwin16.3.0/include" ignoring duplicate directory "/Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/../../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/include" ignoring duplicate directory "/Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/../../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/include-fixed" ignoring nonexistent directory "/Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/../../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/../../../../x86_64-apple-darwin16.3.0/include" ignoring nonexistent directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/include /Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/x86_64-apple-darwin16.3.0/6.3.0/include-fixed /usr/local/include /Users/petrillo/physics/LArSoft/software/products/gcc/v6_3_0/Darwin64bit+16/bin/../lib/gcc/../../include /System/Library/Frameworks /Library/Frameworks End of search list. # 1 "<stdin>" # 1 "<built-in>" # 1 "<command-line>" # 1 "<stdin>"
with Clang (which works in the same shell where GCC fails):
$ echo | clang -E -Wp,-v - clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.7.0 ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory) End of search list. # 1 "<stdin>" # 1 "<built-in>" 1 # 1 "<built-in>" 3 # 330 "<built-in>" 3 # 1 "<command line>" 1 # 1 "<built-in>" 2 # 1 "<stdin>" 2
Since compilation via cetbuildtools does work, I suppose there is some magic that it does and that users need to do as well.
Tested on OSX 10.12 (Sierra) with Xcode 8.3.3 (according t xcodebuild -version
, build version 8E3004b).
History
#1 Updated by Lynn Garren over 3 years ago
- Status changed from New to Feedback
We are unable to reproduce the problem. However, we suspect that the problem might be related to your installation of the command line tools. Did you reinstall the older command line tools when you downgraded to Xcode 8.3.3?
On a working laptop:
$ xcodebuild -version Xcode 8.3.3 Build version 8E3004b $ xcode-select --version xcode-select version 2347. $ g++ -c -xc++ -o /dev/null - <<< "#include <iostream>" (no complaints)
#2 Updated by Lynn Garren over 3 years ago
- Status changed from Feedback to Resolved
We note that /usr/include/wchar.h should exist on macOS. Reinstalling the command line tools has fixed the problem.
#3 Updated by Gianluca Petrillo over 3 years ago
I report an important information from Lynn:
mac-126940:~ garren$ ls -l /usr/include/wchar.h -r--r--r-- 1 root wheel 10079 Feb 4 2017 /usr/include/wchar.h
meaning that in a complete installation the missing header should be provided by the system.
#4 Updated by Lynn Garren over 3 years ago
- Assignee set to Gianluca Petrillo
Leon has already reinstalled the command line tools and resolved the problem.
#5 Updated by Lynn Garren over 3 years ago
- Assignee changed from Gianluca Petrillo to Lynn Garren
#6 Updated by Leon Rochester over 3 years ago
The fix was to re-install the command-line tools:
xcode-select --install
#7 Updated by Gianluca Petrillo over 3 years ago
I confirm that the command from Leon fixes the issue on my laptop, too.
#8 Updated by Kyle Knoepfel over 3 years ago
- Tracker changed from Bug to Support
- Status changed from Resolved to Closed