[all-commits] [llvm/llvm-project] c9c1ed: [lldb] Add an option to build liblldb statically (...
Anutosh Bhat via All-commits
all-commits at lists.llvm.org
Wed Sep 16 11:52:02 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c9c1ed7e41b245d15ee339b51696c546d5dc6d18
https://github.com/llvm/llvm-project/commit/c9c1ed7e41b245d15ee339b51696c546d5dc6d18
Author: Anutosh Bhat <andersonbhat491 at gmail.com>
Date: 2026-09-17 (Thu, 17 Sep 2026)
Changed paths:
M lldb/cmake/modules/AddLLDB.cmake
M lldb/cmake/modules/LLDBConfig.cmake
M lldb/source/API/CMakeLists.txt
Log Message:
-----------
[lldb] Add an option to build liblldb statically (#223210)
This builds on the Emscripten host and platform work from the previous
patches.
`liblldb` is currently always created as a shared library. That makes
sense for the normal LLDB installation, but it is restrictive for
embedders where dynamic libraries are unavailable, expensive to load or
simply not the preferred deployment model.
My immediate use case is bringing LLDB into
[WasmBolt](https://github.com/anutosh491/WasmBolt) (try
[here](https://anutosh21.github.io/WasmBolt/)). Loading the complete
`liblldb` WebAssembly side module dynamically has significant startup
overhead. A static build lets the browser application link the required
LLDB components and plugins into its main module during CI, after which
startup is much faster and the linker can remove unreachable code.
The use case is not specific to Emscripten, so this patch adds the
platform-independent `LLDB_BUILD_STATIC_LIBLLDB` option while preserving
the existing shared-library default.
The patch:
- builds `liblldb` as a static library when explicitly requested;
- installs the resulting archive;
- skips shared-library version and export-list processing;
- propagates `LLDB_STATIC` so Windows consumers do not use `dllimport`;
- rejects the incompatible combination with `LLDB_BUILD_FRAMEWORK`.
In my Emscripten 6 experiment, the statically linked final module is
around 74 MB, while the shared `liblldb` side module alone was around 98
MB and considerably more expensive to load.
Tested by:
- building and installing `liblldb.a` natively on macOS;
- building `liblldb.a` with Emscripten 6;
- linking the complete Emscripten `lldb.wasm` executable against the
static target;
- confirming that the default configuration still generates shared
`liblldb`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list