Skip to content

Commit e44604a

Browse files
committedJun 2, 2016
Update libcxx.llvm.org documentation by linking to new docs.
Summary: Currently much of the libcxx website is duplicated between the old www/ documentation and newer Sphinx docs. This patch changes the main libc++ webpage so that it links to the new documentation where possible. This means removing numerous sections from the landing page. @mclow.lists What do you think? Reviewers: mclow.lists Subscribers: cfe-commits, mclow.lists Differential Revision: http://reviews.llvm.org/D19250 llvm-svn: 271469
1 parent cd24b0d commit e44604a

File tree

3 files changed

+82
-487
lines changed

3 files changed

+82
-487
lines changed
 

‎libcxx/docs/BuildingLibcxx.rst

+70
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.. _BuildingLibcxx:
12

23
===============
34
Building libc++
@@ -336,3 +337,72 @@ own copy of libsupc++ and this can lead to subtle problems.
336337
$ make install
337338
338339
You can now run clang with -stdlib=libc++.
340+
341+
342+
.. _libcxxrt_ref:
343+
344+
Using libcxxrt on Linux
345+
------------------------
346+
347+
You will need to keep the source tree of `libcxxrt`_ available
348+
on your build machine and your copy of the libcxxrt shared library must
349+
be placed where your linker will find it.
350+
351+
We can now run CMake like:
352+
353+
.. code-block:: bash
354+
355+
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
356+
-DLIBCXX_CXX_ABI=libcxxrt \
357+
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxrt-sources/src \
358+
-DCMAKE_BUILD_TYPE=Release \
359+
-DCMAKE_INSTALL_PREFIX=/usr \
360+
<libc++-source-directory>
361+
$ make cxx
362+
$ make install
363+
364+
Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, as
365+
clang is set up to link for libc++ linked to libsupc++. To get around this
366+
you'll have to set up your linker yourself (or patch clang). For example,
367+
368+
.. code-block:: bash
369+
370+
$ clang++ -stdlib=libc++ helloworld.cpp \
371+
-nodefaultlibs -lc++ -lcxxrt -lm -lc -lgcc_s -lgcc
372+
373+
Alternately, you could just add libcxxrt to your libraries list, which in most
374+
situations will give the same result:
375+
376+
.. code-block:: bash
377+
378+
$ clang++ -stdlib=libc++ helloworld.cpp -lcxxrt
379+
380+
.. _`libcxxrt`: https://github.com/pathscale/libcxxrt/
381+
382+
383+
Using a local ABI library installation
384+
---------------------------------------
385+
386+
.. warning::
387+
This is not recommended in almost all cases.
388+
389+
These instructions should only be used when you can't install your ABI library.
390+
391+
Normally you must link libc++ against a ABI shared library that the
392+
linker can find. If you want to build and test libc++ against an ABI
393+
library not in the linker's path you needq to set
394+
``-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib`` when configuring CMake.
395+
396+
An example build using libc++abi would look like:
397+
398+
.. code-block:: bash
399+
400+
$ CC=clang CXX=clang++ cmake \
401+
-DLIBCXX_CXX_ABI=libc++abi \
402+
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/path/to/libcxxabi/include" \
403+
-DLIBCXX_CXX_ABI_LIBRARY_PATH="/path/to/libcxxabi-build/lib" \
404+
path/to/libcxx
405+
$ make
406+
407+
When testing libc++ LIT will automatically link against the proper ABI
408+
library.

‎libcxx/www/index.html

+12-280
Original file line numberDiff line numberDiff line change
@@ -166,96 +166,18 @@ <h2>Get it and get involved!</h2>
166166
<p>First please review our
167167
<a href="http://llvm.org/docs/DeveloperPolicy.html">Developer's Policy</a>.
168168

169-
<p>
170-
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
171-
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
172-
(getting the bleeding edge), read on. However, be warned that Mac OS
173-
10.7 will not boot without a valid copy of <code>libc++.1.dylib</code> in
174-
<code>/usr/lib</code>.
175-
</p>
176-
177-
<p>To check out the code, use:</p>
178-
179-
<ul>
180-
<li><code>svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx</code></li>
181-
</ul>
182-
183-
<p>
184-
Note that for an in-tree build, you should check out libcxx to
185-
llvm/projects.
186-
</p>
187-
188-
<p>
189-
The following instructions are for building libc++ on FreeBSD, Linux, or Mac
190-
using <a href="http://libcxxabi.llvm.org/">libc++abi</a> as the C++ ABI
191-
library. On Linux, it is also possible to use
192-
<a href="#libsupcxx">libsupc++</a> or <a href="#libcxxrt">libcxxrt</a>.
193-
</p>
194-
195-
<p>In-tree build:</p>
196-
<ul>
197-
<li><code>cd where-you-want-to-live</code></li>
198-
<li>Check out libcxx and <a href="http://libcxxabi.llvm.org/">libcxxabi</a>
199-
into llvm/projects</li>
200-
<li><code>cd where-you-want-to-build</code></li>
201-
<li><code>mkdir build &amp;&amp; cd build</code></li>
202-
<li><code>cmake path/to/llvm # Linux may require -DCMAKE_C_COMPILER=clang
203-
-DCMAKE_CXX_COMPILER=clang++</code></li>
204-
<li><code>make cxx</code></li>
205-
</ul>
206-
207-
<p>Out-of-tree buildc:</p>
208-
<ul>
209-
<li><code>cd where-you-want-to-live</code></li>
210-
<li>Check out libcxx and llvm</li>
211-
<li>If not on a Mac, also check out
212-
<a href="http://libcxxabi.llvm.org/">libcxxabi</a></li>
213-
<li><code>cd where-you-want-to-build</code></li>
214-
<li><code>mkdir build &amp;&amp; cd build</code></li>
215-
<li><code>cmake -DLLVM_PATH=path/to/llvm
216-
-DLIBCXX_CXX_ABI=libcxxabi
217-
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include
218-
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
219-
path/to/libcxx
220-
</code></li>
221-
<li><code>make</code></li>
222-
</ul>
223-
224-
<p>To run the tests:</p>
225-
<ul>
226-
<li><code>make check-libcxx</code></li>
227-
</ul>
228-
229-
<p>If you wish to run a subset of the test suite:</p>
230-
<ul>
231-
<li><code>cd path/to/libcxx/libcxx</code></li>
232-
<li><code>alias lit='python path/to/llvm/utils/lit/lit.py'</code></li>
233-
<li><code>export
234-
LIBCXX_SITE_CONFIG=path/to/build/dir/projects/libcxx/test/lit.site.cfg
235-
</code></li>
236-
<li><code>lit -sv test/re/ # or whichever subset of tests you're interested
237-
in</code></li>
238-
</ul>
239-
<p>The above is currently quite inconvenient. Sorry! We're working on it!</p>
240-
241-
<p>More information on using LIT can be found
242-
<a href="http://llvm.org/docs/CommandGuide/lit.html">here</a>. For more
243-
general information about the LLVM testing infrastructure, see the
244-
<a href="http://llvm.org/docs/TestingGuide.html">LLVM Testing Infrastructure
245-
Guide</a>
246-
</p>
247-
248-
<p>
249-
Shared libraries for libc++ should now be present in llvm/build/lib. Note
250-
that it is safest to use this from its current location rather than
251-
replacing your system's libc++ (if it has one, if not, go right ahead).
252-
</p>
253-
254-
<p>
255-
Mac users, remember to be careful when replacing the system's libc++.
256-
<strong>Your system will not be able to boot without a functioning
257-
libc++.</strong>
258-
</p>
169+
The documentation for building and using libc++ can be found below.
170+
<ul>
171+
<li><a href="http://libcxx.llvm.org/docs/UsingLibcxx.html">
172+
<b>Using libc++</b></a>
173+
Documentation on using the library in your programs</li>
174+
<li><a href="http://libcxx.llvm.org/docs/BuildingLibcxx.html">
175+
<b>Building libc++</b></a>
176+
Documentation on building the library using CMake</li>
177+
<li><a href="http://libcxx.llvm.org/docs/TestingLibcxx.html">
178+
<b>Testing libc++</b></a>
179+
Documentation for developers wishing to test the library</li>
180+
</ul>
259181

260182
<!--=====================================================================-->
261183
<h3>Notes and Known Issues</h3>
@@ -278,65 +200,6 @@ <h3>Notes and Known Issues</h3>
278200
<p>Send discussions to the
279201
<a href="http://lists.llvm.org/mailman/listinfo/cfe-dev">clang mailing list</a>.</p>
280202

281-
<!--=====================================================================-->
282-
<h2>Using libc++ in your programs</h2>
283-
<!--=====================================================================-->
284-
285-
<!--=====================================================================-->
286-
<h3>FreeBSD and Mac OS X</h3>
287-
<!--=====================================================================-->
288-
289-
<p>
290-
To use your system-installed libc++ with clang you can:
291-
</p>
292-
293-
<ul>
294-
<li><code>clang++ -stdlib=libc++ test.cpp</code></li>
295-
<li><code>clang++ -std=c++11 -stdlib=libc++ test.cpp</code></li>
296-
</ul>
297-
298-
<p>
299-
To use your tip-of-trunk libc++ on Mac OS with clang you can:
300-
</p>
301-
302-
<ul>
303-
<li><code>export DYLD_LIBRARY_PATH=path/to/build/lib</code>
304-
<li><code>clang++ -std=c++11 -stdlib=libc++ -nostdinc++
305-
-I&lt;path-to-libcxx&gt;/include -L&lt;path-to-libcxx&gt;/lib
306-
test.cpp</code></li>
307-
</ul>
308-
309-
<!--=====================================================================-->
310-
<h3>Linux</h3>
311-
<!--=====================================================================-->
312-
313-
<p>
314-
You will need to keep the source tree of
315-
<a href="http://libcxxabi.llvm.org">libc++abi</a> available on your build
316-
machine and your copy of the libc++abi shared library must be placed where
317-
your linker will find it.
318-
</p>
319-
320-
<p>
321-
Unfortunately you can't simply run clang with "-stdlib=libc++" at this
322-
point, as clang is set up to link for libc++ linked to libsupc++. To get
323-
around this you'll have to set up your linker yourself (or patch clang).
324-
For example:
325-
</p>
326-
327-
<ul>
328-
<li><code>clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc</code></li>
329-
</ul>
330-
331-
<p>
332-
Alternately, you could just add libc++abi to your libraries list, which in
333-
most situations will give the same result:
334-
</p>
335-
336-
<ul>
337-
<li><code>clang++ -stdlib=libc++ helloworld.cpp -lc++abi</code></li>
338-
</ul>
339-
340203
<!--=====================================================================-->
341204
<h2>Bug reports and patches</h2>
342205
<!--=====================================================================-->
@@ -354,136 +217,6 @@ <h2>Bug reports and patches</h2>
354217
include [libc++] in the subject and add cfe-commits as a subscriber.
355218
</p>
356219

357-
<!--=====================================================================-->
358-
<h2 id="libsupcxx">Build on Linux using CMake and libsupc++.</h2>
359-
<!--=====================================================================-->
360-
361-
<p>
362-
You will need libstdc++ in order to provide libsupc++.
363-
</p>
364-
365-
<p>
366-
Figure out where the libsupc++ headers are on your system. On Ubuntu this
367-
is <code>/usr/include/c++/&lt;version&gt;</code> and
368-
<code>/usr/include/c++/&lt;version&gt;/&lt;target-triple&gt;</code>
369-
</p>
370-
371-
<p>
372-
You can also figure this out by running
373-
<pre>
374-
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
375-
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
376-
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
377-
#include "..." search starts here:
378-
#include &lt;...&gt; search starts here:
379-
/usr/include/c++/4.7
380-
/usr/include/c++/4.7/x86_64-linux-gnu
381-
/usr/include/c++/4.7/backward
382-
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
383-
/usr/local/include
384-
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
385-
/usr/include/x86_64-linux-gnu
386-
/usr/include
387-
End of search list.
388-
</pre>
389-
390-
Note the first two entries happen to be what we are looking for. This
391-
may not be correct on other platforms.
392-
</p>
393-
394-
<p>
395-
We can now run CMake:
396-
<ul>
397-
<li><code>CC=clang CXX=clang++ cmake -G "Unix Makefiles"
398-
-DLIBCXX_CXX_ABI=libstdc++
399-
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/"
400-
-DCMAKE_BUILD_TYPE=Release
401-
-DCMAKE_INSTALL_PREFIX=/usr
402-
&lt;libc++-source-dir&gt;</code></li>
403-
<li>You can also substitute <code>-DLIBCXX_CXX_ABI=libsupc++</code>
404-
above, which will cause the library to be linked to libsupc++ instead
405-
of libstdc++, but this is only recommended if you know that you will
406-
never need to link against libstdc++ in the same executable as libc++.
407-
GCC ships libsupc++ separately but only as a static library. If a
408-
program also needs to link against libstdc++, it will provide its
409-
own copy of libsupc++ and this can lead to subtle problems.
410-
<li><code>make</code></li>
411-
<li><code>sudo make install</code></li>
412-
</ul>
413-
<p>
414-
You can now run clang with -stdlib=libc++.
415-
</p>
416-
</p>
417-
418-
<!--=====================================================================-->
419-
<h2 id="libcxxrt">Build on Linux using CMake and libcxxrt.</h2>
420-
<!--=====================================================================-->
421-
422-
<p>
423-
You will need to keep the source tree of
424-
<a href="https://github.com/pathscale/libcxxrt/">libcxxrt</a> available
425-
on your build machine and your copy of the libcxxrt shared library must
426-
be placed where your linker will find it.
427-
</p>
428-
429-
<p>
430-
We can now run CMake:
431-
<ul>
432-
<li><code>CC=clang CXX=clang++ cmake -G "Unix Makefiles"
433-
-DLIBCXX_CXX_ABI=libcxxrt
434-
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="&lt;libcxxrt-source-dir&gt;/src"
435-
-DCMAKE_BUILD_TYPE=Release
436-
-DCMAKE_INSTALL_PREFIX=/usr
437-
&lt;libc++-source-dir&gt;</code></li>
438-
<li><code>make</code></li>
439-
<li><code>sudo make install</code></li>
440-
</ul>
441-
<p>
442-
Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, as
443-
clang is set up to link for libc++ linked to libsupc++. To get around this
444-
you'll have to set up your linker yourself (or patch clang). For example,
445-
<ul>
446-
<li><code>clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lcxxrt -lm -lc -lgcc_s -lgcc</code></li>
447-
</ul>
448-
Alternately, you could just add libcxxrt to your libraries list, which in most
449-
situations will give the same result:
450-
<ul>
451-
<li><code>clang++ -stdlib=libc++ helloworld.cpp -lcxxrt</code></li>
452-
</ul>
453-
</p>
454-
</p>
455-
456-
<!--=====================================================================-->
457-
<h2 id="local-abi">Using a local ABI library</h2>
458-
<!--=====================================================================-->
459-
<p>
460-
<strong>Note: This is not recommended in almost all cases.</strong><br>
461-
Generally these instructions should only be used when you can't install
462-
your ABI library.
463-
</p>
464-
<p>
465-
Normally you must link libc++ against a ABI shared library that the
466-
linker can find. If you want to build and test libc++ against an ABI
467-
library not in the linker's path you need to set
468-
<code>-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib</code> when
469-
configuring CMake.
470-
</p>
471-
<p>
472-
An example build using libc++abi would look like:
473-
<ul>
474-
<li><code>CC=clang CXX=clang++ cmake
475-
-DLIBCXX_CXX_ABI=libc++abi
476-
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/path/to/libcxxabi/include"
477-
-DLIBCXX_CXX_ABI_LIBRARY_PATH="/path/to/libcxxabi-build/lib"
478-
path/to/libcxx</code></li>
479-
<li><code>make</code></li>
480-
</ul>
481-
</p>
482-
<p>
483-
When testing libc++ LIT will automatically link against the proper ABI
484-
library.
485-
</p>
486-
487220
<!--=====================================================================-->
488221
<h2>Design Documents</h2>
489222
<!--=====================================================================-->
@@ -493,7 +226,6 @@ <h2>Design Documents</h2>
493226
<li><a href="type_traits_design.html"><tt>&lt;type_traits&gt;</tt></a></li>
494227
<li><a href="http://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/">Excellent notes by Marshall Clow</a></li>
495228
<li><a href="debug_mode.html">Status of debug mode</a></li>
496-
<li><a href="lit_usage.html">LIT usage guide</a></li>
497229
</ul>
498230

499231
</div>

‎libcxx/www/lit_usage.html

-207
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.