aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-14 13:48:44 +0000
committer_ov4 <ov4@ov4.org>2026-10-14 13:48:44 +0000
commit5a2061171e18d0593d1b30a7f0f6be94d3f13ac7 (patch)
treea5fb78d01a7862b5c2e6fa6f3f30736df8232234
parentc8fd3419031c2921c4c0acdb63da619162744802 (diff)
fix(build): drop unused dylibs from macOS embedded compiler
Omit unused dynamic libraries inherited from LLVM's support interface, including Homebrew Z3, while retaining the nightly runtime dependency check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
-rw-r--r--AGENTS/ARCH.md3
-rw-r--r--CMakeLists.txt3
2 files changed, 6 insertions, 0 deletions
diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md
index 2fa02bd..85df6cb 100644
--- a/AGENTS/ARCH.md
+++ b/AGENTS/ARCH.md
@@ -117,6 +117,9 @@ EMBEDDED requires static LLVM archives. `cmake/EmbeddedLLVM.cmake` also selects
static compression/terminal support archives when LLVM uses them. Linux Clang
builds link the C++ runtime statically; MinGW uses `-static`. The tested Debian
LLVM 23 executable has only libc, libm and the system loader as dynamic dependencies.
+macOS EMBEDDED links with `-dead_strip_dylibs` to omit unused dylibs inherited
+from LLVM's support interface, including Homebrew's Z3. Keep the nightly package's
+non-system dependency check; required dylibs are not removed by this option.
Windows EMBEDDED is untested.
Windows build instructions retain MSYS2 MINGW64. Its LLVM/Clang package names
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ef5039..76b76a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,9 @@ if(CPSC_RUN_MODE STREQUAL "EMBEDDED")
target_sources(cpsc PRIVATE tools/driver/EmbeddedRunner.cc)
if(MINGW)
target_link_options(cpsc PRIVATE -static)
+ elseif(APPLE)
+ # LLVM's support interface can include unused Homebrew dylibs such as Z3.
+ target_link_options(cpsc PRIVATE -Wl,-dead_strip_dylibs)
elseif(UNIX AND NOT APPLE)
target_link_options(cpsc PRIVATE -static-libstdc++ -static-libgcc -Wl,--as-needed)
endif()