[Lldb-commits] [lldb] r199511 - Add -stdlib=c++ to the LDFLAGS when configuring llvm. The lldb

Jason Molenda jmolenda at apple.com
Fri Jan 17 12:59:33 PST 2014

Author: jmolenda
Date: Fri Jan 17 14:59:32 2014
New Revision: 199511

URL: http://llvm.org/viewvc/llvm-project?rev=199511&view=rev
Add -stdlib=c++ to the LDFLAGS when configuring llvm.  The lldb
xcode project file sets the MACOSX_DEPLOYMENT_TARGET to 10.7.
llvm/configure (as of r199313) tries to compile a .cpp file which
includes <atomic> with -std=c++0x.  If the deployment target is set
to earlier than 10.9 and no C++ library is specified, clang will
error out at this point.

Fixes xcode building of lldb on Mac OS X.  If this change causes
problems for any of the other build workflows, please let me know
and I'll fix it.


Modified: lldb/trunk/scripts/build-llvm.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-llvm.pl?rev=199511&r1=199510&r2=199511&view=diff
--- lldb/trunk/scripts/build-llvm.pl (original)
+++ lldb/trunk/scripts/build-llvm.pl Fri Jan 17 14:59:32 2014
@@ -242,6 +242,12 @@ sub build_llvm
             print "Configuring clang ($arch) in '$llvm_dstroot_arch'...\n";
             my $lldb_configuration_options = "--enable-targets=x86_64,arm $common_configure_options $llvm_config_href->{configure_options}";
+            # We're configuring llvm/clang with --enable-cxx11 and --enable-libcpp but llvm/configure doesn't
+            # pick up the right C++ standard library.  If we have a MACOSX_DEPLOYMENT_TARGET of 10.7 or 10.8
+            # (or are using actually building on those releases), we need to specify "-stdlib=libc++" at link
+            # time or llvm/configure will not see <atomic> as available and error out (v. llvm r199313).
+            $ENV{LDFLAGS} = $ENV{LDFLAGS} . " -stdlib=libc++";
             if ($is_arm)
                 $lldb_configuration_options .= " --host=arm-apple-darwin${os_release} --target=arm-apple-darwin${os_release} --build=i686-apple-darwin${os_release} --program-prefix=\"\"";

More information about the lldb-commits mailing list