2 trivial patches for libc++


Does anyone object to these trivial patches? (If not someone please push)


FreeBSD has a local patch that for some stupid reason they have’t pushed upstream. We recently added a commit that without the libc++ fix causes multiple symbols for us and a build regression.

Here’s the patch

commit message - “libcxxrt now implements bad_array_new_length and need to guard against multiple defines”

#2 The attached patch allows libc++ to use libcxxrt on OSX.


libcxx.patch (1.09 KB)

FWIW, your description doesn't seem bad, but we can't commit a patch to
libc++ without the author of the patch contributing it by posting it to the
list... Hopefully whomever wrote this is willing to upstream it?

The CMake part has a bug:

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cd8553c..d489c90 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -53,7 +53,7 @@ target_link_libraries(cxx ${libraries})
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)

-if ( APPLE )
+if ( APPLE AND "${LIBCXX_CXX_ABI}" STREQUAL "libcxxaib" )

This should be "libcxxabi"

Other than that (and needing to test this on OS X with libc++abi to make
sure the typo fix works) the CMake side looks fine. Sadly, the
exception.cpp code is stuff I have never rightly understood well enough to
help with. Hopefully Marshall or someone can help there.


The patch is too trivial to be covered by copyright (it moves an #endif down a few lines). Baptiste committed it to the FreeBSD repo, but on my advice so I can count as the person who wrote it if that's really a problem.


I'd much rather have someone just post a patch they authored than think
about the details of such things.... Much simpler....

I agree. Doesn't cost anything, and makes things a lot clearer.


We're talking about moving a #if a couple lines down. I'd agree there's a
line nobody wants to cross, but it's unrealistic to think this could be
done another way. The time taken for 3 people to write emails was longer
than the commit message.

(Now I guess I understand why FreeBSD has local changes that aren't


I’ve reached out to the author of the patch to get his permission. I’ll review and test the CMake patch tonight and then commit it.