Issue compiling simple code with clang++-mp-11

Christopher Jones jonesc at hep.phy.cam.ac.uk
Mon May 3 12:17:46 UTC 2021


See

https://trac.macports.org/ticket/62770 <https://trac.macports.org/ticket/62770>

Its the macOS11.3 / Xcode 12.5 update, it has broken all MacPorts clang versions <= 11

At this time the only macports clang that works is the clang-level port.

Chris

> On 3 May 2021, at 1:14 pm, Andrew Udvare <audvare at gmail.com> wrote:
> 
> This code compiles fine with Xcode but fails with Clang from MacPorts. I have not been able to figure out why. I successfully rebuilt Clang and LLVM from source but it made no difference.
> 
> Setup:
> 
> macOS 11.3 20E232 x86_64
> Xcode 12.5 12E262
> 
> The code (main.cpp):
> 
> #include <filesystem>
> int main(int argc, char *argv[]) {
>  std::filesystem::path p(argv[0]);
>  return p.string().length();
> }
> 
> $ xcrun clang++ -std=c++17 main.cpp
> # No errors
> 
> Anyone know why it would fail with MacPorts' Clang? Seems to be an include path/file issue.
> 
> $ /opt/local/bin/clang++-mp-11 -std=c++17 main.cpp -ferror-limit=2
> In file included from main.cpp:1:
> In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/filesystem:234:
> In file included from /opt/local/libexec/llvm-11/bin/../include/c++/v1/cstdlib:85:
> /opt/local/libexec/llvm-11/bin/../include/c++/v1/stdlib.h:142:34: error: unknown type name 'ldiv_t'
> inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
>                                 ^
> /opt/local/libexec/llvm-11/bin/../include/c++/v1/stdlib.h:143:12: error: no member named 'ldiv' in the global namespace
>  return ::ldiv(__x, __y);
>         ~~^
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
> 3 errors generated.
> 
> This generates a lot of errors that are members are missing from the global namespace.
> 
> This affects this port I have had working for a while, probably by accident because it wasn't until recently that Xcode Clang and MacPorts Clang versions mismatched their highest numbers (Xcode 12.5 having Clang 12, MacPorts having up to 11).
> 
> https://github.com/Tatsh/ports/blob/ycm-fixes/devel/ycmd/Portfile
> 
> This project tries to compile this code within CMake to test for required arguments, but it's failing for the reason above rather than actually missing filesystem implementation. See https://github.com/ycm-core/ycmd/blob/master/cpp/ycm/CMakeLists.txt#L279
> 
> -- 
> Andrew Udvare
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20210503/02e66252/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1930 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20210503/02e66252/attachment.bin>


More information about the macports-users mailing list