Changes between Initial Version and Version 1 of LibcxxOnOlderSystems


Ignore:
Timestamp:
Jan 12, 2015, 1:51:02 AM (9 years ago)
Author:
jeremyhu (Jeremy Huddleston Sequoia)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LibcxxOnOlderSystems

    v1 v1  
     1= Using libc++ on older system =
     2
     3== Lion and Mountain Lion ==
     4
     5Lion and Mountain Lion systems have libc++ installed with the OS but still use libstdc++ as the default C++ runtime.  You can use it by passing -stdlib=libc++ as a command line argument to clang++, and you can instruct MacPorts to use it instead of libstdc++ as the default C++ runtime.
     6
     71. Start with a new install of MacPorts or '''uninstall all ports that use C++'''
     82. Edit /opt/local/etc/macports/macports.conf to contain:
     9
     10{{{
     11cxx_stdlib         libc++
     12buildfromsource    always
     13delete_la_files    yes
     14}}}
     15
     16delete_la_files is not necessary, it is reccomended since you need to set buildfromsource.
     17
     18== Leopard and Snow Leopard ==
     19
     20Leopard and Snow Leopard do not have libc++ installed by the OS, but MacPorts can build and install system roots that contain these runtimes for your use.  After installing these roots (which is done automatically when the libcxxabi and libcxx ports activate), you can choose to continue using libstdc++ as the default C++ runtime in MacPorts or configure MacPorts to use the new libc++ runtime.
     21
     22=== Bootstrapping: Install libc++ and libc++abi ===
     23
     241. Start with a new install of MacPorts or '''uninstall all ports that use C++'''
     252. Install the libcxx port.  When it activates, the libcxxabi and libcxx ports will install libc++.dylib and libc++abi.dylib (which will remain after you uninstall MacPorts).  This will pull in a number of dependencies.
     26{{{
     27sudo port -v -s install libcxx
     28}}}
     293. Deactivate all your active ports (or at least the C++ ports) in order to prepare to rebuild them, and just activate the new toolchain:
     30{{{
     31        sudo port -v -f deactivate active
     32        sudo port -v install clang-3.4 ld64 cctools
     33}}}
     344. Edit /opt/local/etc/macports/macports.conf to contain:
     35{{{
     36cxx_stdlib         libc++
     37buildfromsource    always
     38delete_la_files    yes
     39default_compilers  macports-clang-3.4 macports-clang-3.3 gcc-4.2 apple-gcc-4.2 gcc-4.0
     40}}}
     415. Uninstall all the remaining inactive ports:
     42{{{
     43sudo port -v -f uninstall inactive
     44}}}
     456. Build a newer clang compiler using libc++ and uninstall the old one using libstdc++:
     46{{{
     47sudo port -v install clang-3.5
     48sudo port -v uninstall llvm-3.4 clang-3.4
     49}}}
     507. Either:
     51    1. Edit /opt/local/etc/macports/macports.conf again to add macports-clang-3.5 before macports-clang-3.4.
     52    2. Rebuild clang-3.4 using clang-3.5:
     53{{{
     54sudo port -v install clang-3.4 configure.compiler=macports-clang-3.5
     55}}}