clang++ and libc++

Paul Floyd pjfloyd at wanadoo.fr
Tue Mar 16 12:19:56 UTC 2021


On 3/3/21 4:05 PM, Ken Cunningham wrote:
> As of clang-11, the most current libc++ is installed tucked away in 
> the llvm-11 libs dir.
>
> There is both a dylib (rpathed) and a static libc++ there.
>
> I set this up for now for people like you to use for exactly this. You 
> will have to force it (DYLD_LIBRARY_PATH, possibly static link it, or 
> some other way).
>
> It's new. Please feel free to let me know how it works for you.
>

Hi again

A bit more on the specific testcases that I want to get to compile.

The first one, using C++17 over-aligned new and delete gives me

paulf> clang++-mp-11 -g cxx17_aligned_new.cpp -std=c++17 -stdlib=libc++
cxx17_aligned_new.cpp:17:24: error: aligned allocation function of type 
'void *(std::size_t, std::align_val_t)' is only available on macOS 10.14 
or newer
     MyClass* myClass = new MyClass;
                        ^
I get the same when adding  -L /opt/local/libexec/llvm-11/lib 
-Wl,-rpath,/opt/local/libexec/llvm-11/lib -nostdinc++ -I 
/opt/local/libexec/llvm-11/include/c++/v1

The message seems clear enough. Is this error to be expected? Or is 
there a way to get fully featured libc++ on old machines?

The second testcase uses C++14 sized delete, and I can get that to build OK.


A+

Paul



More information about the macports-users mailing list