Update instructions for building and using libc++ on Mac OS
authorHoward Hinnant <hhinnant@apple.com>
Tue, 6 Nov 2012 21:31:37 +0000 (21:31 +0000)
committerHoward Hinnant <hhinnant@apple.com>
Tue, 6 Nov 2012 21:31:37 +0000 (21:31 +0000)
llvm-svn: 167490

libcxx/www/index.html

index 3c7bc9d..200ad5f 100644 (file)
   </ul>
 
   <p>
-     On Mac OS 10.7 (Lion), the easiest way to get this library is to install
+     On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
      Xcode 4.2 or later.  However if you want to install tip-of-trunk from here
      (getting the bleeding edge), read on.  However, be warned that Mac OS
      10.7 will not boot without a valid copy of <code>libc++.1.dylib</code> in
      <code>/usr/lib</code>.
   </p>
 
-  <p>To build on Mac OS X 10.6 (Snow Leopard), you need a helper library and header 
-    <a href="http://home.roadrunner.com/~hinnant/libcppabi.zip">found here</a>.
-    cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib.  On Mac OS
-    X 10.7 (Lion) and later, this helper library and header are already installed
-    for you.
-    <p>
-    
   <p>
      Next:
   </p>
   <ul>
     <li><code>cd libcxx/lib</code></li>
     <li><code>export TRIPLE=-apple-</code></li>
-    <li>Only on 10.6: <code>export MACOSX_DEPLOYMENT_TARGET=10.6</code></li>
     <li><code>./buildit</code></li>
+    <li><code>ln -sf libc++.1.dylib libc++.dylib</code></li>
   </ul>
   
   <p>
-     That should result in a libc++.1.dylib.  To install it I like to use links
-     instead of copying, but either should work:
+     That should result in a libc++.1.dylib and libc++.dylib.  The safest thing
+     to do is to use it from where your libcxx is installed instead of replacing
+     these in your Mac OS.
+  </p>
+
+  <p>
+  To use your system-installed libc++ with clang you can:
   </p>
 
   <ul>
-    <li><code>cd /usr/lib</code></li>
-    <li><code>sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.1.dylib</code></li>
-    <li><code>sudo ln -sf libc++.1.dylib libc++.dylib</code></li>
-    <li><code>cd /usr/include/c++</code></li>
-    <li><code>sudo ln -sf path-to-libcxx/include v1</code></li>
+    <li><code>clang++ -stdlib=libc++ test.cpp</code></li>
+    <li><code>clang++ -std=c++11 -stdlib=libc++ test.cpp</code></li>
   </ul>
 
   <p>
-  To use with clang you can:
+  To use your tip-of-trunk libc++ on Mac OS with clang you can:
   </p>
 
   <ul>
-    <li><code>clang++ -stdlib=libc++ test.cpp</code></li>
-    <li><code>clang++ -std=c++11 -stdlib=libc++ test.cpp</code></li>
+    <li><code>export DYLD_LIBRARY_PATH=&lt;path-to-libcxx&gt;/lib</code>
+    <li><code>clang++ -std=c++11 -stdlib=libc++ -nostdinc++
+         -I&lt;path-to-libcxx&gt;/include -L&lt;path-to-libcxx&gt;/lib
+         test.cpp</code></li>
   </ul>
 
   <p>To run the libc++ test suite (recommended):</p>
   <li><code>cd libcxx/test</code></li>
   <li><code>./testit</code></li>
      <ul>
-       <li>On Mac OS 10.6, to work around bugs in libc headers like
-           math.h and inttypes.h, add "-U__STRICT_ANSI__" and
-           "-D__STDC_FORMAT_MACROS" to the command line with:
-           <blockquote>
-             <pre>export OPTIONS="-std=c++11 -stdlib=libc++ -U__STRICT_ANSI__ -D__STDC_FORMAT_MACROS"</pre>
-           </blockquote></li>
-       <li>People porting libc++ to other OSes will likely have to
-           define similar macros.</li>
+       <li>You can alter the command line options <code>testit</code> uses
+       with <code>export OPTIONS="whatever you need"</code></li>
      </ul>
   </ul>