Tracking issue: https://github.com/llvm/llvm-project/issues/201242 Migration guide docs: https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines RFC: https://discourse.llvm.org/t/rfc-make-myst-markdown-the-llvm-docs-format-rip-rest/90840 This was prepared with rst2myst plus LLM-assisted cleanup. I paged through all the generated HTML looking for migration artifacts, and all of the differences I could find appear to be formatting error corrections. Please spot check my work and approve if it looks good.
2.6 KiB
(building_docs)=
Building the Documentation
This page explains how to build the LLVM-libc HTML documentation locally so you can preview changes before submitting a patch.
Prerequisites
The LLVM documentation build uses Sphinx. The key packages required are:
sphinx— the documentation generatorfuro— the theme used by LLVM-libcmyst-parser— Markdown support alongside RSTsphinx-reredirects— handles page redirect entries inconf.py
On Debian/Ubuntu, all required packages are available via apt:
sudo apt-get install python3-sphinx python3-myst-parser \
python3-sphinx-reredirects furo
On other systems, install everything from the shared requirements file:
pip install -r llvm/docs/requirements.txt
CMake Configuration
Enable the Sphinx documentation build by adding these flags to your CMake invocation:
cmake ../runtimes \
-DLLVM_ENABLE_RUNTIMES="libc" \
-DLLVM_ENABLE_SPHINX=ON \
-DLIBC_INCLUDE_DOCS=ON \
...
The LLVM_ENABLE_SPHINX=ON flag enables Sphinx globally for all LLVM
subprojects. LIBC_INCLUDE_DOCS=ON is specific to libc and tells CMake to
register the libc doc targets.
Building
Once configured, build the HTML docs with:
ninja docs-libc-html
The output is written to <build-dir>/tools/libc/docs/html/. Open
index.html in a browser to view the site.
Header Status Pages (Auto-generated)
The per-header implementation status pages under docs/headers/ are
not hand-written RST. They are generated at build time by
libc/utils/docgen/docgen.py, which:
- Reads YAML function definitions from
libc/src/<header>/*.yaml. - Scans
libc/src/<header>/for.cppimplementation files. - Checks
libc/include/llvm-libc-macros/for macro#defineentries. - Emits an RST
list-tableshowing each symbol's implementation status, C standard section, and POSIX link.
If you add a new function and regenerate, these pages update automatically.
Do not hand-edit the generated RST files in docs/headers/ — your
changes will be overwritten the next time the docs are built.
Troubleshooting
Extension error: Could not import extension myst_parser- On Debian/Ubuntu:
sudo apt-get install python3-myst-parser. Otherwise:pip install -r llvm/docs/requirements.txt. WARNING: document isn't included in any toctree- A new RST/Markdown file needs a
toctreeentry. Add it to the appropriateindex.rstor its parent toctree. Extension error: No module named 'sphinx_reredirects'- Same fix:
pip install -r llvm/docs/requirements.txt.