Installing Clang for QDoc

QDoc uses Clang when parsing C++ files as well as function signatures in \fn commands. Clang is part of the LLVM Compiler Infrastructure Project. Therefore, if you are going to build QDoc from source, you need to install LLVM 6.0 or greater first. You can find the required pre-built binaries here.

Set Clang location automatically

The Qt build system uses the tool llvm-config to discover the location of LLVM on your system, and relies on the path to llvm-config being in the PATH environment variable to do so. llvm-config is commonly installed with LLVM and Clang on Linux systems, and also on macOS if LLVM is installed using Brew.

On Windows, the installation binaries provided by LLVM do not include llvm-config. You may still have it on your system, if you have built LLVM yourself from source. If that is the case, and you want to let the build system find Clang automatically, add the path to llvm-config to your PATH environment variable. For example:

C:\> set PATH=%PATH%;C:\[build directory]\bin\Release"

Make sure to set the path to your LLVM build directory. The llvm-config executable is located in bin\Release or bin\Debug, reflecting the build version.

Specify Clang location manually

If llvm-config is not in your PATH environment variable, or not installed on your system, you can still build QDoc, by manually setting the environment variable LLVM_INSTALL_DIR to point to the directory where LLVM is installed. This directory should be the top level directory. For example, on a Linux or macOS system with LLVM installed to /usr/llvm:

$ export LLVM_INSTALL_DIR=/usr/llvm

On a Windows system with LLVM installed to C:\Program Files\LLVM:

C:\> set LLVM_INSTALL_DIR=C:\Program Files\LLVM

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.