Opened 22 months ago
Closed 22 months ago
#66886 closed defect (worksforme)
clang-devel seems to be broken on macOS 12
Reported by: | catap (Kirill A. Korinsky) | Owned by: | jeremyhu (Jeremy Huddleston Sequoia) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | cjones051073 (Chris Jones) | |
Port: | clang-devel |
Description
An attempt to compile a trivial program:
#include <iostream> int main() { std::cout << "Hello World!"; return 0; }
fails as:
√ /tmp % /opt/local/libexec/llvm-devel/bin/clang++ test.cc In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:100: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:29: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/wchar.h:143: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-devel/bin/../include/c++/v1/wchar.h:150: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-devel/bin/../include/c++/v1/wchar.h:157: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-devel/bin/../include/c++/v1/wchar.h:145: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-devel/bin/../include/c++/v1/wchar.h:164: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-devel/bin/../include/c++/v1/wchar.h:147:16: note: 'wcschr' declared here wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);} ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/wchar.h:164: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-devel/bin/../include/c++/v1/wchar.h:147: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-devel/bin/../include/c++/v1/wchar.h:164: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-devel/bin/../include/c++/v1/wchar.h:147: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-devel/bin/../include/c++/v1/wchar.h:171:90: error: use of undeclared identifier 'wmemchr' wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);} ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:218:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:218:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:219:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> wstreampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:219:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> wstreampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:223:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> u16streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:223:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> u16streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:224:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> u32streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:220: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__ios/fpos.h:14: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iosfwd:224:14: error: reference to unresolved using declaration typedef fpos<mbstate_t> u32streampos; ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__mbstate_t.h:40:1: note: using declaration annotated with 'using_if_exists' here using ::mbstate_t _LIBCPP_USING_IF_EXISTS; ^ In file included from test.cc:1: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/iostream:43: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/ios:221: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__locale:18: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/mutex:191: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__memory/shared_ptr.h:22: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__memory/allocation_guard.h:14: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__memory/allocator_traits.h:14: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/__memory/construct_at.h:20: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/new:93: In file included from /opt/local/libexec/llvm-devel/bin/../include/c++/v1/cstdlib:87: /opt/local/libexec/llvm-devel/bin/../include/c++/v1/stdlib.h:150:34: error: unknown type name 'ldiv_t' inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT { ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/stdlib.h:151:12: error: no member named 'ldiv' in the global namespace return ::ldiv(__x, __y); ~~^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/stdlib.h:154:34: error: unknown type name 'lldiv_t' inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, ^ /opt/local/libexec/llvm-devel/bin/../include/c++/v1/stdlib.h:156:12: error: no member named 'lldiv' in the global namespace return ::lldiv(__x, __y); ~~^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
Change History (8)
comment:1 Changed 22 months ago by jmroot (Joshua Root)
Cc: | cjones051073 added |
---|---|
Owner: | set to jeremyhu |
Status: | new → assigned |
comment:2 Changed 22 months ago by kencu (Ken)
working normally on MacOS 13 :
% clang++-mp-devel -v test.cc clang version 16.0.0 Target: arm64-apple-darwin22.2.0 Thread model: posix InstalledDir: /opt/local/libexec/llvm-devel/bin "/opt/local/libexec/llvm-devel/bin/clang" -cc1 -triple arm64-apple-macosx13.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cc -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -funwind-tables=1 -target-sdk-version=13.1 -fcompatibility-qualified-id-block-type-checking -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +crc -target-feature +lse -target-feature +rdm -target-feature +crypto -target-feature +dotprod -target-feature +fp-armv8 -target-feature +neon -target-feature +fp16fml -target-feature +ras -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 820.1 -v -fcoverage-compilation-dir=/Users/Shared -resource-dir /opt/local/libexec/llvm-devel/lib/clang/16 -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-devel/bin/../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-devel/lib/clang/16/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -fdeprecated-macro -fdebug-compilation-dir=/Users/Shared -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcolor-diagnostics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/97/nn3swcb52bg003_4bctdbyd80000gn/T/test-84bac6.o -x c++ test.cc clang -cc1 version 16.0.0 based upon LLVM 16.0.0git default target arm64-apple-darwin22.2.0 ignoring nonexistent directory "/usr/local/include" 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: /opt/local/libexec/llvm-devel/bin/../include/c++/v1 /opt/local/libexec/llvm-devel/lib/clang/16/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. "/opt/local/libexec/llvm-devel/bin/ld" -demangle -lto_library /opt/local/libexec/llvm-devel/lib/libLTO.dylib -no_deduplicate -dynamic -arch arm64 -platform_version macos 13.0.0 13.1 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o a.out -L/usr/local/lib /var/folders/97/nn3swcb52bg003_4bctdbyd80000gn/T/test-84bac6.o -lc++ -lSystem /opt/local/libexec/llvm-devel/lib/clang/16/lib/darwin/libclang_rt.osx.a
if you use the "-v" option we might spot what is going wrong on your system. My first guess is it is not finding your MacOSX.sdk anywhere, but we shall see...
comment:3 Changed 22 months ago by catap (Kirill A. Korinsky)
Ken, if I use clang++-mp-devel
it works. It fails only when I call /opt/local/libexec/llvm-XXX/bin/clang++
.
comment:4 Changed 22 months ago by kencu (Ken)
Yeah, don't do that :>
when you go through clang++-mp-devel
it calls clang through xcrun
and that sets up the SDKROOT. Otherwise, if you want to call /opt/local/libexec/llvm-XXX/bin/clang++
then you must set up the SDKROOT yourself.
try it with "-v" like I said and you should see what I mean.
comment:5 Changed 22 months ago by kencu (Ken)
At least I think that is what you will see when you try it -- you can tell me if that is what you see, after you do it.
comment:6 Changed 22 months ago by kencu (Ken)
or do this:
/opt/local/libexec/llvm-devel/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk test.cc
or this:
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /opt/local/libexec/llvm-devel/bin/clang++ test.cc
or -- etc etc
comment:8 Changed 22 months ago by kencu (Ken)
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
there are a lot of interactive moving parts to this equation, for sure!
Please remember to Cc the port maintainers.