From 5a2061171e18d0593d1b30a7f0f6be94d3f13ac7 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 14 Oct 2026 13:48:44 +0000 Subject: 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 --- AGENTS/ARCH.md | 3 +++ CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) 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() -- cgit v1.3.1-4-g156e