Skip to content

Fix build system: MSVC static, UserInterface, clangInterpreter linking#563

Open
0xeb wants to merge 1 commit intoroot-project:masterfrom
lallouslab:fix/build-system
Open

Fix build system: MSVC static, UserInterface, clangInterpreter linking#563
0xeb wants to merge 1 commit intoroot-project:masterfrom
lallouslab:fix/build-system

Conversation

@0xeb
Copy link

@0xeb 0xeb commented Mar 23, 2026

Summary

Three build fixes for embedding cling as a static library:

  • MSVC static build dllexport suppression: AddClang.cmake sets CLANG_BUILD_STATIC for clang targets but not cling targets, causing __declspec(dllexport) symbols to leak into consumer DLLs. This adds the same definition for cling targets when building static on MSVC.

  • Build UserInterface unconditionally: clingUserInterface is a runtime dependency of cling.exe, libcling, and embedders, but was gated behind CLING_INCLUDE_TESTS. Building with -DLLVM_INCLUDE_TESTS=OFF silently skipped it, causing link failures.

  • Link clangInterpreter into libcling.so: Needed for ReplCodeCompleter autocomplete support in shared library builds.

Test plan

  • Tested on ARM64 Linux (native), Windows x64 (MSVC /MT static), and MinGW cross-build
  • 34/34 tests pass with these patches applied

Three build fixes for embedding cling as a static library:

1. Suppress dllexport on MSVC static builds: AddClang.cmake sets
   CLANG_BUILD_STATIC for clang targets but not cling targets, causing
   __declspec(dllexport) symbols to leak into consumer DLLs. Add the
   same definition for cling targets when building static on MSVC.

2. Build UserInterface unconditionally: clingUserInterface is a runtime
   dependency of cling.exe, libcling, and embedders, but was gated
   behind CLING_INCLUDE_TESTS. Building with -DLLVM_INCLUDE_TESTS=OFF
   silently skipped it, causing link failures.

3. Link clangInterpreter into libcling.so: needed for
   ReplCodeCompleter autocomplete support in shared library builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant