<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/123316>123316</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [lldb-docs] Remove dependency between 'lldb-python-doc-package' and 'lldb-python'?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hwhsu1231
      </td>
    </tr>
</table>

<pre>
    ## Question

Is it necessary for the `lldb-python-doc-package` target to depend on the `lldb-python` target?

## What happened...

Hello, LLVM Maintenance Team.

Recently, I attempted to build the documentation for the LLVM project. During the process, I noticed that building the LLDB documentation consumes a significant amount of time.

To minimize the time spent on the build, I opted to use `clangdev` installed via Conda to skip the step of building the Clang project from sources. Below are the commands I used for `llvmorg-19.1.6` tag and the complete log output:

<details><summary>Click to expand the commands</summary>

```bash
git clone --branch=llvmorg-19.1.6 --depth=1 https://github.com/llvm/llvm-project.git llvm-19.1.6
cd llvm-19.1.6
conda create --prefix ./.venv --yes
conda activate ./.venv
conda install gcc gxx binutils ninja clangdev=19.1.6 python=3.12 doxygen graphviz perl swig --channel conda-forge --yes
export LANG=en_US.UTF-8
export PYTHONNOUSERSITE=1
pip install -r llvm/docs/requirements.txt
export CMAKE_PROGRAM_PATH=$(pwd)/.venv/bin
export CMAKE_INCLUDE_PATH=$(pwd)/.venv/include
export CMAKE_LIBRARY_PATH=$(pwd)/.venv/lib
export CMAKE_INSTALL_PREFIX=$(pwd)/.venv
cmake -B ./build -S ./llvm -G Ninja -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_PROJECTS="clang;lldb" -D LLVM_ENABLE_SPHINX=ON -D LLDB_TEST_COMPILER=clang
cmake --build ./build --target docs-lldb-html --parallel 4
^C
```

</details>

[log-build-19.1.6-lldb-docs.txt](https://github.com/user-attachments/files/18452772/log-build-19.1.6-lldb-docs.txt)

>From the log output, we can see that nearly **4,700** steps are required to complete the final build of the `docs-lldb-html` target:

```bash
(/home/hwhsu1231/Repo/testing/llvm-19.1.6/.venv) hwhsu1231@vb-kubuntu:~/Repo/testing/llvm-19.1.6$ cmake --build ./build --target docs-lldb-html --parallel 4
[15/4754] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Base64.cpp.o^C
(/home/hwhsu1231/Repo/testing/llvm-19.1.6/.venv) hwhsu1231@vb-kubuntu:~/Repo/testing/llvm-19.1.6$
```

The reason seems to lie in the following code (the `lldb-python` target must be built before building the `lldb-python-doc-package` target):

https://github.com/llvm/llvm-project/blob/7ec139ad4bc09857ab2b93926feef0d110071668/lldb/docs/CMakeLists.txt#L37

## Experiment

To verify my hypothesis, I conducted the following 2 experiments:

### Experiment 1

First, when building the LLDB documentation for the `llvmorg-18.1.8` tag, it did not take as much time. This is because, at that point, `lldb-python-doc-package` did not depend on `lldb-python`:

https://github.com/llvm/llvm-project/blob/3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff/lldb/docs/CMakeLists.txt#L30

<details><summary>Click to expand the commands</summary>

```bash
git clone --branch=llvmorg-18.1.8 --depth=1 https://github.com/llvm/llvm-project.git llvm-18.1.8
cd llvm-18.1.8
conda create --prefix ./.venv --yes
conda activate ./.venv
conda install gcc gxx binutils ninja clangdev=18.1.8 python=3.12 doxygen graphviz perl swig --channel conda-forge --yes
export LANG=en_US.UTF-8
export PYTHONNOUSERSITE=1
pip install -r llvm/docs/requirements.txt
export CMAKE_PROGRAM_PATH=$(pwd)/.venv/bin
export CMAKE_INCLUDE_PATH=$(pwd)/.venv/include
export CMAKE_LIBRARY_PATH=$(pwd)/.venv/lib
export CMAKE_INSTALL_PREFIX=$(pwd)/.venv
cmake -B ./build -S ./llvm -G Ninja -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_PROJECTS="clang;lldb" -D LLVM_ENABLE_SPHINX=ON -D LLDB_TEST_COMPILER=clang
cmake --build ./build --target docs-lldb-html --parallel 4
firefox build/tools/lldb/docs/html/index.html
```

</details>

[log-exp1-build-18.1.8-lldb-docs.txt](https://github.com/user-attachments/files/18452812/log-exp1-build-18.1.8-lldb-docs.txt)

### Experiment 2

Next, before building the LLDB documentation for the `llvmorg-19.1.6` tag, I removed the `lldb-python` dependency target using the `sed` command:

<details><summary>Click to expand the commands</summary>

```bash
git clone --branch=llvmorg-19.1.6 --depth=1 https://github.com/llvm/llvm-project.git llvm-19.1.6
cd llvm-19.1.6
conda create --prefix ./.venv --yes
conda activate ./.venv
conda install gcc gxx binutils ninja clangdev=19.1.6 python=3.12 doxygen graphviz perl swig --channel conda-forge --yes
export LANG=en_US.UTF-8
export PYTHONNOUSERSITE=1
pip install -r llvm/docs/requirements.txt
export CMAKE_PROGRAM_PATH=$(pwd)/.venv/bin
export CMAKE_INCLUDE_PATH=$(pwd)/.venv/include
export CMAKE_LIBRARY_PATH=$(pwd)/.venv/lib
export CMAKE_INSTALL_PREFIX=$(pwd)/.venv
sed -i 's/add_dependencies(lldb-python-doc-package swig_wrapper_python lldb-python)/add_dependencies(lldb-python-doc-package swig_wrapper_python)/' ./lldb/docs/CMakeLists.txt
cmake -B ./build -S ./llvm -G Ninja -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_PROJECTS="clang;lldb" -D LLVM_ENABLE_SPHINX=ON -D LLDB_TEST_COMPILER=clang
cmake --build ./build --target docs-lldb-html --parallel 4
firefox build/tools/lldb/docs/html/index.html
```

</details>

[log-exp2-build-19.1.6-lldb-docs.txt](https://github.com/user-attachments/files/18452815/log-exp2-build-19.1.6-lldb-docs.txt)

As a result, we can see that no critical errors occurred, and the build process required only 5 steps to complete.

## Conclusion

If building the `lldb-python` target does not affect the LLDB documentation build, I would suggest removing the `lldb-python` dependency from the `lldb-python-doc-package` target in LLDB. This change should significantly reduce the time required to build the LLDB documentation.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWU1z2zjS_jXwpYssEpRE6eCDPid-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