Skip to content

Commit c607d7d

Browse files
carlocabBrewTestBot
authored andcommitted
llvm: fix llvm-config
`llvm-config` relies on a versioned `libLLVM` (e.g. `libLLVM-12`), but their build system does not install one for some reason. With the symlink: ❯ llvm-config --libs -lLLVM-12 Without: ❯ llvm-config --libs -lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver ... -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMTableGen -lLLVMSupport -lLLVMDemangle This deviates from the intended behaviour, as seen on Linux, where `llvm-config --libs` returns the output shown above with the symlink. Attempting to link against the libraries shown by `llvm-config` without this fix is also leads to build failures due to missing symbols. This will also allow Julia to use brewed `llvm` instead of a vendored one. (#76527) Closes #76798. Closes #76646. Signed-off-by: Mike McQuaid <[email protected]> Signed-off-by: BrewTestBot <[email protected]>
1 parent e1bbe44 commit c607d7d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Formula/llvm.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Llvm < Formula
55
sha256 "9ed1688943a4402d7c904cc4515798cdb20080066efa010fe7e1f2551b423628"
66
# The LLVM Project is under the Apache License v2.0 with LLVM Exceptions
77
license "Apache-2.0" => { with: "LLVM-exception" }
8+
revision 1
89
head "https://github.com/llvm/llvm-project.git", branch: "main"
910

1011
livecheck do
@@ -141,6 +142,11 @@ def install
141142
system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed?
142143
end
143144

145+
on_macos do
146+
# Install versioned symlink, or else `llvm-config` doesn't work properly
147+
lib.install_symlink "libLLVM.dylib" => "libLLVM-#{version.major}.dylib" unless build.head?
148+
end
149+
144150
# Install LLVM Python bindings
145151
# Clang Python bindings are installed by CMake
146152
(lib/site_packages).install llvmpath/"bindings/python/llvm"
@@ -158,6 +164,9 @@ def caveats
158164

159165
test do
160166
assert_equal prefix.to_s, shell_output("#{bin}/llvm-config --prefix").chomp
167+
assert_equal "-lLLVM-#{version.major}", shell_output("#{bin}/llvm-config --libs").chomp
168+
assert_equal (lib/shared_library("libLLVM-#{version.major}")).to_s,
169+
shell_output("#{bin}/llvm-config --libfiles").chomp
161170

162171
(testpath/"omptest.c").write <<~EOS
163172
#include <stdlib.h>

0 commit comments

Comments
 (0)