Skip to content

Commit 6b4c4d7

Browse files
[llvm][docs] Improve the formatting of the Common Problems section (#108522)
...and add shared libs as a suggestion. * Mark options, option values and program names as plain text. * Add a blank line between the option and the explanatory text so that it doesn't get printed on the same line. (this seems to be the original intent of the rst source anyway) * Update the phrasing of a couple of the options. * Add BUILD_SHARED_LIBS to suggestions.
1 parent ec00999 commit 6b4c4d7

File tree

2 files changed

+53
-29
lines changed

2 files changed

+53
-29
lines changed

llvm/docs/CMake.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ These variables provide fine control over the build of LLVM and
309309
enabled sub-projects. Nearly all of these variable names begin with
310310
``LLVM_``.
311311

312+
.. _LLVM-related variables BUILD_SHARED_LIBS:
313+
312314
**BUILD_SHARED_LIBS**:BOOL
313315
Flag indicating if each LLVM component (e.g. Support) is built as a shared
314316
library (ON) or as a static library (OFF). Its default value is OFF. On

llvm/docs/GettingStarted.rst

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,67 +1085,89 @@ general questions about LLVM, please consult the `Frequently Asked
10851085
Questions <FAQ.html>`_ page.
10861086

10871087
If you are having problems with limited memory and build time, please try
1088-
building with ninja instead of make. Please consider configuring the
1088+
building with ``ninja`` instead of ``make``. Please consider configuring the
10891089
following options with cmake:
10901090

1091-
* -G Ninja
1091+
* ``-G Ninja``
1092+
10921093
Setting this option will allow you to build with ninja instead of make.
10931094
Building with ninja significantly improves your build time, especially with
10941095
incremental builds, and improves your memory usage.
10951096

1096-
* -DLLVM_USE_LINKER
1097-
Setting this option to lld will significantly reduce linking time for LLVM
1098-
executables on ELF-based platforms, such as Linux. If you are building LLVM
1097+
* ``-DLLVM_USE_LINKER``
1098+
1099+
Setting this option to ``lld`` will significantly reduce linking time for LLVM
1100+
executables, particularly on Linux and Windows. If you are building LLVM
10991101
for the first time and lld is not available to you as a binary package, then
11001102
you may want to use the gold linker as a faster alternative to GNU ld.
11011103

1102-
* -DCMAKE_BUILD_TYPE
1104+
* ``-DCMAKE_BUILD_TYPE``
1105+
11031106
Controls optimization level and debug information of the build. This setting
11041107
can affect RAM and disk usage, see :ref:`CMAKE_BUILD_TYPE <cmake_build_type>`
11051108
for more information.
11061109

1107-
* -DLLVM_ENABLE_ASSERTIONS
1108-
This option defaults to ON for Debug builds and defaults to OFF for Release
1110+
* ``-DLLVM_ENABLE_ASSERTIONS``
1111+
1112+
This option defaults to ``ON`` for Debug builds and defaults to ``OFF`` for Release
11091113
builds. As mentioned in the previous option, using the Release build type and
11101114
enabling assertions may be a good alternative to using the Debug build type.
11111115

1112-
* -DLLVM_PARALLEL_LINK_JOBS
1116+
* ``-DLLVM_PARALLEL_LINK_JOBS``
1117+
11131118
Set this equal to number of jobs you wish to run simultaneously. This is
1114-
similar to the -j option used with make, but only for link jobs. This option
1119+
similar to the ``-j`` option used with ``make``, but only for link jobs. This option
11151120
can only be used with ninja. You may wish to use a very low number of jobs,
11161121
as this will greatly reduce the amount of memory used during the build
1117-
process. If you have limited memory, you may wish to set this to 1.
1122+
process. If you have limited memory, you may wish to set this to ``1``.
1123+
1124+
* ``-DLLVM_TARGETS_TO_BUILD``
11181125

1119-
* -DLLVM_TARGETS_TO_BUILD
11201126
Set this equal to the target you wish to build. You may wish to set this to
1121-
X86; however, you will find a full list of targets within the
1122-
llvm-project/llvm/lib/Target directory.
1127+
only your host architecture. For example ``X86`` if you are using an Intel or
1128+
AMD machine. You will find a full list of targets within the
1129+
`llvm-project/llvm/lib/Target <https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target>`_
1130+
directory.
1131+
1132+
* ``-DLLVM_OPTIMIZED_TABLEGEN``
11231133

1124-
* -DLLVM_OPTIMIZED_TABLEGEN
1125-
Set this to ON to generate a fully optimized tablegen during your build. This
1126-
will significantly improve your build time. This is only useful if you are
1127-
using the Debug build type.
1134+
Set this to ``ON`` to generate a fully optimized TableGen compiler during your
1135+
build, even if that build is a ``Debug`` build. This will significantly improve
1136+
your build time. You should not enable this if your intention is to debug the
1137+
TableGen compiler.
11281138

1129-
* -DLLVM_ENABLE_PROJECTS
1130-
Set this equal to the projects you wish to compile (e.g. clang, lld, etc.) If
1139+
* ``-DLLVM_ENABLE_PROJECTS``
1140+
1141+
Set this equal to the projects you wish to compile (e.g. ``clang``, ``lld``, etc.) If
11311142
compiling more than one project, separate the items with a semicolon. Should
11321143
you run into issues with the semicolon, try surrounding it with single quotes.
11331144

1134-
* -DLLVM_ENABLE_RUNTIMES
1135-
Set this equal to the runtimes you wish to compile (e.g. libcxx, libcxxabi, etc.)
1145+
* ``-DLLVM_ENABLE_RUNTIMES``
1146+
1147+
Set this equal to the runtimes you wish to compile (e.g. ``libcxx``, ``libcxxabi``, etc.)
11361148
If compiling more than one runtime, separate the items with a semicolon. Should
11371149
you run into issues with the semicolon, try surrounding it with single quotes.
11381150

1139-
* -DCLANG_ENABLE_STATIC_ANALYZER
1140-
Set this option to OFF if you do not require the clang static analyzer. This
1151+
* ``-DCLANG_ENABLE_STATIC_ANALYZER``
1152+
1153+
Set this option to ``OFF`` if you do not require the clang static analyzer. This
11411154
should improve your build time slightly.
11421155

1143-
* -DLLVM_USE_SPLIT_DWARF
1144-
Consider setting this to ON if you require a debug build, as this will ease
1156+
* ``-DLLVM_USE_SPLIT_DWARF``
1157+
1158+
Consider setting this to ``ON`` if you require a debug build, as this will ease
11451159
memory pressure on the linker. This will make linking much faster, as the
1146-
binaries will not contain any of the debug information; however, this will
1147-
generate the debug information in the form of a DWARF object file (with the
1148-
extension .dwo). This only applies to host platforms using ELF, such as Linux.
1160+
binaries will not contain any of the debug information. Instead the debug
1161+
information is in a separate DWARF object file (with the extension ``.dwo``).
1162+
This only applies to host platforms using ELF, such as Linux.
1163+
1164+
* ``-DBUILD_SHARED_LIBS``
1165+
1166+
Setting this to ``ON`` will build shared libraries instead of static
1167+
libraries. This will ease memory pressure on the linker. However, this should
1168+
only be used when developing llvm. See
1169+
:ref:`BUILD_SHARED_LIBS <LLVM-related variables BUILD_SHARED_LIBS>`
1170+
for more information.
11491171

11501172
.. _links:
11511173

0 commit comments

Comments
 (0)