Opened 4 years ago

Closed 4 years ago

Last modified 7 months ago

#62770 closed defect (fixed)

clang++ 11 broken by MacOS 11.3 update

Reported by: haberg-1 (Hans Åberg) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur x86_64 Cc: kencu (Ken), cjones051073 (Chris Jones), mojca (Mojca Miklavec), mascguy (Christopher Nielsen)
Port: clang-11

Description (last modified by jmroot (Joshua Root))

The update to MacOS 11.3 and Xcode 12.5, with Command Line Tools, broke clang++ 11: It can not find system headers such as wchar.h, it seems. Unclear with workarounds. Curiously, g++ 10 works.

Specifically, /opt/local/bin/clang++-mp-11 hello_world.cc -o hello_world produces the errors below, whereas /opt/local/bin/g++-mp-10 hello_world.cc -o hello_world works.

% /opt/local/bin/clang++-mp-11 hello_world.cc -o hello_world
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/ios:214:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/iosfwd:95:
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:137:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:144:87: error: use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
                                                                                      ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:151:78: error: use of undeclared identifier 'wcsrchr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
                                                                             ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:139:16: note: 'wcschr' declared here
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:158:86: error: use of undeclared identifier 'wcsstr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:141:16: note: 'wcschr' declared here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:158:86: error: no matching function for call to 'wcschr'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:141:16: note: candidate disabled: <no message provided>
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:158:93: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'const wchar_t *'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                            ^~~~
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:141:38: note: passing argument to parameter '__s' here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
                                     ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:165:60: error: unknown type name 'size_t'
wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
                                                           ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:167:57: error: unknown type name 'size_t'
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/wchar.h:169:57: error: unknown type name 'size_t'
      wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/ios:214:
/opt/local/libexec/llvm-11/bin/../include/c++/v1/iosfwd:189:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    streampos;
             ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/iosfwd:190:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    wstreampos;
             ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/iosfwd:195:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u16streampos;
             ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/iosfwd:196:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u32streampos;
             ^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/ios:215:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/__locale:14:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/string:506:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/string_view:175:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/__string:57:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/algorithm:639:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/initializer_list:46:
/opt/local/libexec/llvm-11/bin/../include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
      ~~^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/cstddef:50:9: error: no member named 'size_t' in the global namespace
using ::size_t;
      ~~^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/cstddef:53:9: error: no member named 'max_align_t' in the global namespace
using ::max_align_t;
      ~~^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/ios:215:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/__locale:14:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/string:506:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/string_view:175:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/__string:57:
In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/algorithm:639:
/opt/local/libexec/llvm-11/bin/../include/c++/v1/initializer_list:61:5: error: unknown type name 'size_t'
    size_t    __size_;
    ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/initializer_list:65:38: error: unknown type name 'size_t'
    initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
                                     ^
/opt/local/libexec/llvm-11/bin/../include/c++/v1/initializer_list:73:13: error: unknown type name 'size_t'
    typedef size_t    size_type;
            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Attachments (2)

hello_world.cc (94 bytes) - added by haberg-1 (Hans Åberg) 4 years ago.
Includes <iostream> and calls std::cout to trigger the issue.
0001-clang-11-Backport-upstream-clang-12-patch-for-sysroo.patch (14.6 KB) - added by landonf (Landon Fuller) 4 years ago.
Backport upstream clang-12 patch for <sysroot> for C++ headers

Download all attachments as: .zip

Change History (36)

Changed 4 years ago by haberg-1 (Hans Åberg)

Attachment: hello_world.cc added

Includes <iostream> and calls std::cout to trigger the issue.

comment:1 Changed 4 years ago by jmroot (Joshua Root)

Cc: kencu added
Description: modified (diff)
Milestone: MacPorts Future
Owner: set to jeremyhu
Status: newassigned

comment:2 Changed 4 years ago by kencu (Ken)

OK, noted.

comment:3 Changed 4 years ago by kencu (Ken)

I see the same errors with macports-clang-10 and macports-clang-11 (but not with xcode clang). It appears to be finding the headers, so I don't think it's just a simple SDK search path issue.

The Xcode 12.5 release notes don't give me an immediate answer, although there are some noted changes <https://developer.apple.com/documentation/xcode-release-notes/xcode-12_5-release-notes> .

% clang++ -v hello_world.cc
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.3.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-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello_world.cc -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=11.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -debugger-tuning=lldb -target-linker-version 650.9 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -fdeprecated-macro -fdebug-compilation-dir /Users/cunningh/Downloads -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/mn/s7mk_ptj3d39y51m_hpjnrpm0000gn/T/hello_world-17b97e.o -x c++ hello_world.cc
clang -cc1 version 12.0.5 (clang-1205.0.22.9) default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o a.out -L/usr/local/lib /var/folders/mn/s7mk_ptj3d39y51m_hpjnrpm0000gn/T/hello_world-17b97e.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/lib/darwin/libclang_rt.osx.a
% clang++-mp-10 -v hello_world.cc
clang version 10.0.1 
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-10/bin
 "/opt/local/libexec/llvm-10/bin/clang" -cc1 -triple x86_64-apple-macosx10.16.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello_world.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-rounding-math -masm-verbose -munwind-tables -target-sdk-version=11.3 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609.7 -v -resource-dir /opt/local/libexec/llvm-10/lib/clang/10.0.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /opt/local/libexec/llvm-10/bin/../include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /opt/local/libexec/llvm-10/lib/clang/10.0.1/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -fdeprecated-macro -fdebug-compilation-dir /Users/cunningh/Downloads -ferror-limit 19 -fmessage-length 175 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-10.16.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/mn/s7mk_ptj3d39y51m_hpjnrpm0000gn/T/hello_world-33fa0d.o -x c++ hello_world.cc
clang -cc1 version 10.0.1 based upon LLVM 10.0.1 default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /opt/local/libexec/llvm-10/bin/../include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
 /opt/local/libexec/llvm-10/lib/clang/10.0.1/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/ios:214:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/iosfwd:95:
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:136:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:143:87: error: use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
                                                                                      ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:150:78: error: use of undeclared identifier 'wcsrchr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
                                                                             ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:138:16: note: 'wcschr' declared here
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:157:86: error: use of undeclared identifier 'wcsstr'; did you mean 'wcschr'?
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:140:16: note: 'wcschr' declared here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:157:86: error: no matching function for call to 'wcschr'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                     ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:140:16: note: candidate disabled: <no message provided>
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
               ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:157:93: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'const wchar_t *'
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
                                                                                            ^~~~
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:140:38: note: passing argument to parameter '__s' here
      wchar_t* wcschr(      wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
                                     ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:164:60: error: unknown type name 'size_t'
wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
                                                           ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:166:57: error: unknown type name 'size_t'
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:168:57: error: unknown type name 'size_t'
      wchar_t* wmemchr(      wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
                                                        ^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/ios:214:
/opt/local/libexec/llvm-10/bin/../include/c++/v1/iosfwd:189:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    streampos;
             ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/iosfwd:190:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    wstreampos;
             ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/iosfwd:195:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u16streampos;
             ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/iosfwd:196:14: error: use of undeclared identifier 'mbstate_t'
typedef fpos<mbstate_t>    u32streampos;
             ^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/ios:215:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/__locale:14:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/string:504:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/string_view:175:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/__string:57:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/algorithm:641:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/cstring:60:
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:73:64: error: use of undeclared identifier 'strchr'
char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
                                                               ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:80:75: error: use of undeclared identifier 'strpbrk'
char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
                                                                          ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:87:65: error: use of undeclared identifier 'strrchr'; did you mean 'strchr'?
char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
                                                                ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:75:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:94:76: error: use of undeclared identifier 'memchr'; did you mean 'wmemchr'?
void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
                                                                           ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/wchar.h:166:16: note: 'wmemchr' declared here
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
               ^
In file included from hello_world.cc:2:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/iostream:37:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/ios:215:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/__locale:14:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/string:504:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/string_view:175:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/__string:57:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/algorithm:641:
In file included from /opt/local/libexec/llvm-10/bin/../include/c++/v1/cstring:60:
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:101:74: error: use of undeclared identifier 'strstr'; did you mean 'strchr'?
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
                                                                         ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:77:13: note: 'strchr' declared here
      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:101:74: error: no matching function for call to 'strchr'
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
                                                                         ^
/opt/local/libexec/llvm-10/bin/../include/c++/v1/string.h:77:13: note: candidate disabled: <no message provided>
      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
% ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
__bit_reference			bit				cstring				limits				stdexcept
__bsd_locale_defaults.h		bitset				ctgmath				limits.h			stdint.h
__bsd_locale_fallbacks.h	cassert				ctime				list				stdio.h
__config			ccomplex			ctype.h				locale				stdlib.h
__cxxabi_config.h		cctype				cwchar				locale.h			streambuf
__debug				cerrno				cwctype				map				string
__errc				cfenv				cxxabi.h			math.h				string.h
__functional_03			cfloat				deque				memory				string_view
__functional_base		charconv			errno.h				module.modulemap		strstream
__functional_base_03		chrono				exception			mutex				support
__hash_table			cinttypes			execution			new				system_error
__libcpp_version		ciso646				experimental			numbers				tgmath.h
__locale			climits				ext				numeric				thread
__mutex_base			clocale				fenv.h				optional			tuple
__node_handle			cmath				filesystem			ostream				type_traits
__nullptr			codecvt				float.h				queue				typeindex
__split_buffer			compare				forward_list			random				typeinfo
__sso_allocator			complex				fstream				ratio				unordered_map
__std_stream			complex.h			functional			regex				unordered_set
__string			concepts			future				scoped_allocator		utility
__threading_support		condition_variable		initializer_list		semaphore			valarray
__tree				csetjmp				inttypes.h			set				variant
__tuple				csignal				iomanip				setjmp.h			vector
__undef_macros			cstdarg				ios				shared_mutex			version
algorithm			cstdbool			iosfwd				span				wchar.h
any				cstddef				iostream			sstream				wctype.h
array				cstdint				istream				stack
atomic				cstdio				iterator			stdbool.h
barrier				cstdlib				latch				stddef.h

comment:4 Changed 4 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:5 Changed 4 years ago by cjones051073 (Chris Jones)

Just ran into this issue here myself looking into a gcc11 update failing on macOS11.3 with Xcode 12.5 ...

In case its useful here's my reproducer (from the failing gcc configuration tests)

Oberon ~/cernbox/MacPorts/gcc11 > cat conftest.cpp
#include <stdio.h>
int main () {
 FILE *f = fopen ("conftest.out", "w");
 return ferror (f) || fclose (f) != 0;
}

On Mac OS 11.3, Xcode clang

Oberon ~/cernbox/MacPorts/gcc11 > clang++ conftest.cpp
Oberon ~/cernbox/MacPorts/gcc11 >

compared to MP clang 11

Oberon ~/cernbox/MacPorts/gcc11 > clang++-mp-11 conftest.cpp
conftest.cpp:3:2: error: unknown type name 'FILE'
 FILE *f = fopen ("conftest.out", "w");
 ^
conftest.cpp:3:12: error: use of undeclared identifier 'fopen'
 FILE *f = fopen ("conftest.out", "w");
           ^
2 errors generated.

On MacOS 10.13 (Xcode 10.1) both are fine

Titan ~/cernbox/MacPorts/gcc11 > clang++ conftest.cpp 
Titan ~/cernbox/MacPorts/gcc11 > clang++-mp-11 conftest.cpp 
Titan ~/cernbox/MacPorts/gcc11 > 

On macOS 11 again, tracing the include tree

Oberon ~/cernbox/MacPorts/gcc11 > clang++ -M conftest.cpp
conftest.o: conftest.cpp \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_posix_availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/Availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityInternal.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_pthread/_pthread_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_null.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_off_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_ssize_t.h
Oberon ~/cernbox/MacPorts/gcc11 > clang++-mp-11 -M conftest.cpp 
conftest.o: conftest.cpp \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/stdio.h \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdio.h
Oberon ~/cernbox/MacPorts/gcc11 > 

whereas on MacOS 10.13,

Titan ~/cernbox/MacPorts/gcc11 > clang++ -M conftest.cpp 
conftest.o: conftest.cpp \
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/cdefs.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_symbol_aliasing.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_posix_availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/AvailabilityInternal.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/machine/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/i386/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_pthread/_pthread_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_va_list.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/machine/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/i386/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_intptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uintptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_size_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_null.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_ssize_t.h
Titan ~/cernbox/MacPorts/gcc11 > clang++-mp-11 -M conftest.cpp 
conftest.o: conftest.cpp \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/stdio.h \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/pthread.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/_stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/cdefs.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_symbol_aliasing.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_posix_availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/AvailabilityInternal.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/machine/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/i386/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_pthread/_pthread_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_va_list.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/machine/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/i386/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_u_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_intptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_uintptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_size_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_null.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_ssize_t.h
Titan ~/cernbox/MacPorts/gcc11 > 

So comparing those last outputs for MP clang 11 on the two platforms, the differences seem to start to occur at the pthread.h inclusion

macOS11.3

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdio.h

macOS10.13

 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/pthread.h \
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/stdio.h \
<snip>

If I compare the content of pthread.h on the two platforms, they are entirely different, whatever that means.

Would be interesting to compare to that from macOS11.2 (Xcode 12.4 or older) ....

comment:6 Changed 4 years ago by cjones051073 (Chris Jones)

Small correction..

The differences in fact seem to start from when c++/v1/__config is include,

clang from Xcode on macOS11 of course uses the SDK includes

Oberon ~/cernbox/MacPorts/gcc11 > clang++ -M conftest.cpp
conftest.o: conftest.cpp \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
<snip>

whereas MP clang 11

Oberon ~/cernbox/MacPorts/gcc11 > clang++-mp-11 -M conftest.cpp 
conftest.o: conftest.cpp \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/stdio.h \
  /opt/local/libexec/llvm-11/bin/../include/c++/v1/__config \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdio.h

This is starting to me look like a compatibility issue between the include/c++/v1 headers shipped with the MacPorts stock LLVM builds and those with Xcode.

If I diff the __config file from both, on macOS11

Oberon ~/cernbox/MacPorts/gcc11 > diff /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config  /opt/local/libexec/llvm-11/bin/../include/c++/v1/__config
16c16
< #define _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
---
> /* #undef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT */
31c31
< #define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
---
> /* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */
73c73
< #define _LIBCPP_VERSION 12000
---
> #define _LIBCPP_VERSION 11000
79c79
< #if __STDC_HOSTED__ == 0
---
> #ifndef __STDC_HOSTED__
146,149d145
< // Enable clang::trivial_abi on std::unique_ptr.
< #  define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
< // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
< #  define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
388a385
> #    define _LIBCPP_HAS_C11_FEATURES
393a391
> #    define _LIBCPP_HAS_C11_FEATURES
406a405
> #    define _LIBCPP_HAS_C11_FEATURES
413a413
> #        define _LIBCPP_HAS_C11_FEATURES
419a420
> #      define _LIBCPP_HAS_C11_FEATURES
421,431c422
< #  elif defined(__APPLE__)
<      // timespec_get and aligned_alloc were introduced in macOS 10.15 and
<      // aligned releases
< #    if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \
<          __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
<          __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
<          __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)
< #      define _LIBCPP_HAS_ALIGNED_ALLOC
< #      define _LIBCPP_HAS_TIMESPEC_GET
< #    endif
< #  endif // __APPLE__
---
> #  endif // __linux__
439c430,432
< # error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang"
---
> // This definition is potentially buggy, but it's only taken with GCC in C++03,
> // which we barely support anyway. See llvm.org/PR39713
> # define _LIBCPP_ALIGNOF(_Tp) __alignof(_Tp)
454,475d446
< #if defined(__APPLE__) && defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__)
< #  define _LIBCPP_DRIVERKIT
< 
<    // System libraries on DriverKit build against a libc that provides
<    // additional declarations beyond the normal DriverKit API. This
<    // determines whether we can rely on those declarations being provided
<    // by the underlying libc (when defined, we can't rely on them).
< #  include <sys/cdefs.h>
< #  if defined(__DRIVERKIT_LIBC__)
< #    define _LIBCPP_DRIVERKIT_LIBC
< #  endif
< #endif
< 
< // For the DriverKit ABI, we use ABI v1 with a few ABI breaking fixes on top.
< #if defined(_LIBCPP_DRIVERKIT)
< #  define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
< #  define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
< #  define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
< #  define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
< #  define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
< #endif
< 
514a486,489
> #if !(__has_feature(cxx_rvalue_references))
> #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
> #endif
> 
518a494,497
> #if !(__has_feature(cxx_variadic_templates))
> #define _LIBCPP_HAS_NO_VARIADICS
> #endif
> 
808,809d786
< 
< 
1142a1120,1125
> #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
> #  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
> #else
> #  define _LIBCPP_EXPLICIT_MOVE(x) (x)
> #endif
> 

so yes, different, but then they are on macOS10.13 as well....

comment:7 Changed 4 years ago by cjones051073 (Chris Jones)

So, interestingly, MacPorts clang-devel (currently using the a 20210401 tag) works fine on macOS11

Oberon ~/cernbox/MacPorts/gcc11 > clang++-mp-devel conftest.cpp   
Oberon ~/cernbox/MacPorts/gcc11 > clang++-mp-devel -M conftest.cpp
conftest.o: conftest.cpp \
  /opt/local/libexec/llvm-devel/bin/../include/c++/v1/stdio.h \
  /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__config \
  /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__config_site \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_symbol_aliasing.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_posix_availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/Availability.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityInternal.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_pthread/_pthread_types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/types.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int8_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int16_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int32_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_u_int64_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_intptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_uintptr_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_size_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_null.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/stdio.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_off_t.h \
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_ssize_t.h

so presumably something relating to this has been fixed in the master branch of LLVM...

comment:8 Changed 4 years ago by cjones051073 (Chris Jones)

Ken, how's your clang-12 port going ? could you maybe run my reproducer above using that on macOS11 ?

comment:9 Changed 4 years ago by kencu (Ken)

the only thing in the release notes that seems possibly related is this:

libc++ no longer honors the _LIBCPP_RAW_ITERATORS macro. Use wrapped iterators instead. (63088925)

but, ... how could that be doing this??

comment:10 Changed 4 years ago by cjones051073 (Chris Jones)

I don't know, but diffing

kdiff3 /opt/local/libexec/llvm-11/include/c++/v1/__config /opt/local/libexec/llvm-devel/include/c++/v1/__config

there's a lot going on, particularly related to various LIBCPP defines.

comment:11 Changed 4 years ago by kencu (Ken)

toggling one of these in the libc++ headers in llvm-10 and llvm-11 on BigSur 11.3 might prove fruitful:

< #define _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
---
> /* #undef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT */
31c31
< #define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
---
> /* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */

comment:12 Changed 4 years ago by mojca (Mojca Miklavec)

Cc: mojca added

Changed 4 years ago by landonf (Landon Fuller)

Backport upstream clang-12 patch for <sysroot> for C++ headers

comment:13 Changed 4 years ago by landonf (Landon Fuller)

See attached patch; it's a simple backport of the fix from https://reviews.llvm.org/D89001

comment:14 Changed 4 years ago by kencu (Ken)

Thanks Landon!

comment:15 Changed 4 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:16 Changed 4 years ago by mascguy (Christopher Nielsen)

Today I'm seeing unexpected configure failures for mpich-clang90, mpich-clang10, and mpich-clang11, on the Big Sur builders (both Intel and ARM).

It's not clear from the logs precisely how things are failing under-the-hood, but they're certainly suspicious. And the behavior is consistent across all three:

checking size of bool... 0
configure: error: unable to determine matching C type for C++ bool

The logs are available here:

mpich-clang90: https://build.macports.org/builders/ports-11_x86_64-builder/builds/29469/steps/install-port/logs/stdio

mpich-clang10: https://build.macports.org/builders/ports-11_x86_64-builder/builds/29467/steps/install-port/logs/stdio

mpich-clang11: https://build.macports.org/builders/ports-11_x86_64-builder/builds/29468/steps/install-port/logs/stdio

Is it possible clang 9.0 is also affected...?

comment:17 Changed 4 years ago by kencu (Ken)

all clangs < 12 probably need the patch, sure.

Fun fun fun.

comment:18 Changed 4 years ago by mascguy (Christopher Nielsen)

No worries, I'm simply happy that I didn't inadvertently break mpich on Big Sur. Pfew!

comment:19 Changed 4 years ago by ken-cunningham-webuse

Resolution: fixed
Status: assignedclosed

In b4d02201add7b3e5758513e2df61a140692ead57/macports-ports (master):

clang-11: backport include-next fix

thanks to @landonf for spelunking this one

Currently, Clang looks for libc++ headers alongside the installation
directory of Clang, and it also adds a search path for headers in the
-isysroot. This is problematic if headers are found in both the toolchain
and in the sysroot, since #include_next will end up finding the libc++
headers in the sysroot instead of the intended system headers.

This patch changes the logic such that if the toolchain contains libc++
headers, no C++ header paths are added in the sysroot. However, if the
toolchain does *not* contain libc++ headers, the sysroot is searched as
usual.

This should not be a breaking change, since any code that previously
relied on some libc++ headers being found in the sysroot suffered from
the #include_next issue described above, which renders any libc++ header
basically useless.

closes: #62770

comment:20 Changed 4 years ago by kencu (Ken)

We should sort out if backporting this further to earlier clangs is needed or makes sense.

I guess it probably does, as this is behaviour that was broken forever, even though it didn't show up until some recent change in the libc++ headers made it obvious.

comment:21 Changed 4 years ago by mascguy (Christopher Nielsen)

Ken, if we don't backport this to clang 9 and 10, aren't we going to have a significant number of ports without binaries for Big Sur?

EDIT: Thinking more about this, I suppose the number would be small, assuming clang 9 is never selected automatically for most Big Sur builds...

Last edited 4 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:22 Changed 4 years ago by cjones051073 (Chris Jones)

clang-9 is currently not available for macOS11 and will never be selected as a fallback. clang-11 is the default fallback on this platform, followed by clang-10.

So, if possible a back port to clang-10 would be useful.

comment:23 Changed 4 years ago by mascguy (Christopher Nielsen)

Chris, if clang 9 isn't available for Big Sur, how is it that ports like mpich-clang9 compiled successfully on our Big Sur x86_64 builder a month or so ago?

comment:24 Changed 4 years ago by cjones051073 (Chris Jones)

clang-9 builds cannot be reliably used, I've seen it generate bad code, give ICE etc. mpich should not generate these variants/subports on macOS11

Last edited 4 years ago by cjones051073 (Chris Jones) (previous) (diff)

comment:25 Changed 4 years ago by cjones051073 (Chris Jones)

should have said "clang-9 builds but ....."

comment:26 Changed 4 years ago by mascguy (Christopher Nielsen)

Ken, can you confirm Chris' statement? So clang 9 "works" (or at least did) on Big Sur, but the results are questionable?

comment:27 Changed 4 years ago by mascguy (Christopher Nielsen)

Chris, if you're right, then shouldn't we also set known_fail in the clang 9 portfile?

Last edited 4 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:28 Changed 4 years ago by cjones051073 (Chris Jones)

Sorry... I may have mis-spoken from my bad memory...

What I say above is correct for macOS11(arm), but intel indeed does still use clang-9 first

https://github.com/macports/macports-ports/blob/master/_resources/port1.0/compilers/clang_compilers.tcl

so yeah, we should either fix clang-(9,10) on macOS11(intel) or remove them from the fallback lists above.

comment:29 in reply to:  28 Changed 4 years ago by mascguy (Christopher Nielsen)

Replying to cjones051073:

Sorry... I may have mis-spoken from my bad memory...

What I say above is correct for macOS11(arm), but intel indeed does still use clang-9 first

https://github.com/macports/macports-ports/blob/master/_resources/port1.0/compilers/clang_compilers.tcl

so yeah, we should either fix clang-(9,10) on macOS11(intel) or remove them from the fallback lists above.

Pfew, glad to hear! You almost gave me an early-morning aneurysm... :-)

comment:30 Changed 4 years ago by kencu (Ken)

This header search issue is really broken in all the clangs we have <= 11.

We just got away with it until now by luck.

comment:31 Changed 4 years ago by kencu (Ken)

In 3277f12cb68326a5aaf3c05230a90d9d40dade1c/macports-ports (master):

clang-10: backport include-next fix

see: #62770

comment:32 Changed 4 years ago by cjones051073 (Chris Jones)

Another ticket I am sure is caused by the issues with clang-9

#62817

Last edited 7 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:33 Changed 4 years ago by kencu (Ken)

I'll try clang-9.0 today...each clang is a little different to patch and then has to be tested...

comment:34 Changed 4 years ago by kencu (Ken)

In 0d9645676913520cfd38de347cdfbe5b51c56dfb/macports-ports (master):

clang-9.0: backport include-next fix

see: #62770

Note: See TracTickets for help on using tickets.