clang++ and libc++

Paul Floyd pjfloyd at
Wed Mar 3 09:59:31 UTC 2021


A slightly off topic question. I have two macbooks, and the old one I 
use for testing the build of Valgrind when I'm wearing my opensource hat.

The Mac is running 10.7.5. XCode for this platform is too old to build 
the current Valgrind source, so I'm using clang 9.0.1 from macports.

This mostly works, at least for building the code, but there is an issue 
with C++ code. There are some regression tests that use 'modern C++' (my 
fault!). These use automake configure tests to check that the compiler 
supports these features. This works OK, but when it comes to linking 
there is a failure.

For instance, one test covers C++14 sized deallocation.

The configure test is

   return 0;
]])], [
], [

and the link error is

/opt/local/bin/clang++-mp-9.0 -Winline -Wall -Wshadow -Wno-long-long -g 
-fno-stack-protector -Wno-unused-private-field     -arch x86_64 
-fsized-deallocation -o sized_delete sized_delete-sized_delete.o
Undefined symbols for architecture x86_64:
   "operator delete[](void*, unsigned long)", referenced from:
       _main in sized_delete-sized_delete.o
   "operator delete(void*, unsigned long)", referenced from:
       _main in sized_delete-sized_delete.o
ld: symbol(s) not found for architecture x86_64

So my question, is there a way to get such code to link with clang++ on 
such an old platform? Or does in only use /usr/lib/libc++.1.dylib and so 
is limited to the C++ library features present in that library?



More information about the macports-users mailing list