Bug 271821 - devel/llvm16: broken CMake suport in -lite flavor
Summary: devel/llvm16: broken CMake suport in -lite flavor
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-04 16:22 UTC by Jan Beich
Modified: 2024-02-09 00:07 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2023-06-04 16:22:50 UTC
I'd like to use llvm16-lite in RPCS3 CI but CMake references a backend only exposed in shared library. find_package(LLVM 16.0) is enough to reproduce.

Found via https://cirrus-ci.com/task/6573386822844416
For easier testing use the port:

$ make clean all -C emulators/rpcs3
[...]
CMake Error at /usr/local/llvm16/lib/cmake/llvm/LLVMExports.cmake:996 (message):
  The imported target "LLVMDemangle" references the file

     "/usr/local/llvm16/lib/libLLVMDemangle.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/local/llvm16/lib/cmake/llvm/LLVMExports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/llvm16/lib/cmake/llvm/LLVMConfig.cmake:252 (include)
  3rdparty/llvm.cmake:54 (find_package)
  3rdparty/CMakeLists.txt:331 (include)

with the following patch

diff --git a/Mk/Uses/llvm.mk b/Mk/Uses/llvm.mk
index 931ad99156f8..2f7cc26a30a1 100644
--- a/Mk/Uses/llvm.mk
+++ b/Mk/Uses/llvm.mk
@@ -96,7 +96,11 @@ _LLVM_MK_SUFFIX_${_ver}?=	${_ver}
 .  endfor
 
 # === define variables to depend on and export ===
+.if ${_LLVM_MK_VERSION} >= 15
+_LLVM_MK_PORT=		devel/llvm${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION}}@lite
+.else
 _LLVM_MK_PORT=		devel/llvm${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION}}
+.endif
 _LLVM_MK_LIBLLVM=	libLLVM-${_LLVM_MK_VERSION}.so
 _LLVM_MK_PATH=		llvm-config${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION}}
 _LLVM_MK_PREFIX=	${PREFIX}/llvm${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION}}
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-30 19:46:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9e99ad2987fb946cace87af74011743f0e2d0106

commit 9e99ad2987fb946cace87af74011743f0e2d0106
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-01-30 19:46:08 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-01-30 19:46:08 +0000

    devel/llvm-devel: update to 18.1.0rc1

    Update from 17 to 18 and connect to build.

    Upstream has changed versioning so release branches bump the minor
    version to 1 to differentiate them from the pre-branch development
    version.

    I've moved the .cmake files into STATIC_LIBS as they aren't useful
    without .a files.  This removes from from the lite flavor (which will
    likely be replaced with subpackages.) [0]

    PR:             271821 [0]

 devel/llvm18/Makefile                              |  18 +-
 devel/llvm18/Makefile.COMMANDS                     |  14 +-
 devel/llvm18/Makefile.MAN1SRCS                     |   1 -
 devel/llvm18/distinfo                              |  10 +-
 .../files/patch-backport-158f4f30adb4 (gone)       | 211 -------
 .../files/patch-backport-3ed9e9e3ace6 (gone)       | 342 -----------
 .../files/patch-clang_lib_Headers_CMakeLists.txt   |  19 +-
 devel/llvm18/pkg-plist                             | 678 ++++++++++++++++-----
 8 files changed, 569 insertions(+), 724 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-02-09 00:07:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=345b4848d9df3a380c7877f5a348b2b2ccf46310

commit 345b4848d9df3a380c7877f5a348b2b2ccf46310
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-02-08 23:40:05 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-02-09 00:06:22 +0000

    devel/llvm17: aarch64 KASAN and lite flavor fixs

    As in the base system, backport:
    f577bfb99528 - [sanitizer][msan] fix AArch64 vararg support for KMSAN

    Expand STATIC_LIBS (part of the lite flavor) to include cmake bits.
    They aren't usable without the .a files they reference.

    PR:             271821

 devel/llvm17/Makefile                              |   4 +-
 .../llvm17/files/patch-backport-f577bfb99528 (new) | 126 ++++++++++++++++++++
 devel/llvm17/pkg-plist                             | 130 ++++++++++-----------
 3 files changed, 194 insertions(+), 66 deletions(-)