Thursday, March 19, 2026

[fix] devel/llvm/21: llvm-confg --libs fix

Currently llvm 21 llvm-config --libs gives a bad result that is unusable.

m2$ /usr/local/llvm21/bin/llvm-config --libs
-lLLVM-
m2$ /usr/local/llvm20/bin/llvm-config --libs
-lLLVM
m2$ /usr/local/llvm19/bin/llvm-config --libs
-lLLVM

Note the dash after the LLVM lib name. It looks like a chunk of the patch
to llvm-config.cpp is missing. Copying forward the chunk from llvm 20 to
21 fixes it:

m2$ /usr/local/llvm21/bin/llvm-config --libs
-lLLVM

tested on aarch64. okay?

Also note 22 looks like it needs the same fix but it not yet hooked
up to the build.

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/21/Makefile,v
diff -u -p -u -r1.17 Makefile
--- Makefile 23 Feb 2026 18:57:00 -0000 1.17
+++ Makefile 19 Mar 2026 18:42:40 -0000
@@ -5,7 +5,7 @@ LLVM_MAJOR = 21
LLVM_VERSION = ${LLVM_MAJOR}.1.8
LLVM_PKGSPEC = >=21,<22

-REVISION-main = 2
+REVISION-main = 3
REVISION-lldb = 1
REVISION-libcxx = 1
REVISION-python = 2
Index: patches/patch-llvm_tools_llvm-config_llvm-config_cpp
===================================================================
RCS file: /cvs/ports/devel/llvm/21/patches/patch-llvm_tools_llvm-config_llvm-config_cpp,v
diff -u -p -u -r1.1.1.1 patch-llvm_tools_llvm-config_llvm-config_cpp
--- patches/patch-llvm_tools_llvm-config_llvm-config_cpp 4 Sep 2025 12:32:33 -0000 1.1.1.1
+++ patches/patch-llvm_tools_llvm-config_llvm-config_cpp 19 Mar 2026 18:42:40 -0000
@@ -14,6 +14,15 @@ Index: llvm/tools/llvm-config/llvm-confi
} else {
// default to the unix values:
SharedExt = "so";
+@@ -426,7 +432,7 @@ int main(int argc, char **argv) {
+
+ bool DyLibExists = false;
+ const std::string DyLibName =
+- (SharedPrefix + "LLVM-" + SharedVersionedExt).str();
++ (SharedPrefix + "LLVM" + SharedVersionedExt).str();
+
+ // If LLVM_LINK_DYLIB is ON, the single shared library will be returned
+ // for "--libs", etc, if they exist. This behaviour can be overridden with
@@ -437,7 +443,12 @@ int main(int argc, char **argv) {
std::string path((SharedDir + DirSep + DyLibName).str());
if (DirSep == "\\")

No comments:

Post a Comment