Skip to content

meson: add llvm_extra_link_args for building against a system LLVM#169

Closed
cyyever wants to merge 1 commit into
3Shain:mainfrom
cyyever:homebrew-system-llvm
Closed

meson: add llvm_extra_link_args for building against a system LLVM#169
cyyever wants to merge 1 commit into
3Shain:mainfrom
cyyever:homebrew-system-llvm

Conversation

@cyyever

@cyyever cyyever commented Jun 14, 2026

Copy link
Copy Markdown

Problem

src/airconv/meson.build's hardcoded llvm_deps list assumes LLVM was built with -DLLVM_ENABLE_ZSTD=Off (as in docs/DEVELOPMENT.md). When building against a distro/Homebrew LLVM that is built with zstd — e.g. brew install llvm@15 on macOS — its static libs reference ZSTD_* symbols, and the link fails:

Undefined symbols for architecture x86_64:
  "_ZSTD_isError", referenced from: ... libLLVMSupport.a
ld: symbol(s) not found for architecture x86_64

This hits both airconv (native) and winemetal.so. llvm-config --system-libs doesn't report zstd for the Homebrew build, so it can't be discovered automatically.

Change

Add an llvm_extra_link_args array option (default empty), appended to llvm_deps. This lets you build against a system LLVM without compiling LLVM from source:

meson setup ... \
  -Dnative_llvm_path=$(brew --prefix llvm@15) \
  -Dllvm_extra_link_args=/opt/homebrew/opt/zstd/lib/libzstd.dylib,-lz

Default empty → no behaviour change for the documented LLVM build.

Testing

Built win64 (PE dlls + x86_64 unixlib) against Homebrew llvm@15 on macOS 26 (Apple M2) with the option set; airconv and winemetal.so link cleanly and DXMT renders a Unity 2022 D3D11 game at feature level 11.1.

DXMT's hardcoded llvm_deps assumes an LLVM built with
-DLLVM_ENABLE_ZSTD=Off (per docs/DEVELOPMENT.md). When linking against a
distro/Homebrew LLVM that *is* built with zstd (e.g. `brew install
llvm@15`), its static libs reference ZSTD_* symbols and the link fails
with "Undefined symbols ... _ZSTD_isError" for airconv and winemetal.so.

Add an `llvm_extra_link_args` array option, appended to llvm_deps, so the
extra system libs can be supplied without building LLVM from source, e.g.:

  meson setup ... \
    -Dllvm_extra_link_args=/opt/homebrew/opt/zstd/lib/libzstd.dylib,-lz

Defaults to empty (no behaviour change for the documented LLVM build).
@cyyever cyyever closed this Jun 24, 2026
@cyyever cyyever deleted the homebrew-system-llvm branch June 24, 2026 06:29
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