Bug 255894

Summary: devel/llvm-devel: create a static libs flavor
Product: Ports & Packages Reporter: Derek Schrock <dereks>
Component: Individual Port(s)Assignee: Brooks Davis <brooks>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (brooks)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Derek Schrock 2021-05-15 05:23:16 UTC
When trying to build include-what-you-use master branch (combined with llvm's main ex: llvm-devel) llvm cmake files attempt to use static libs which fails since static libs option is disabled (rm'ed post install).

...CMake Error at /usr/local/llvm-devel/lib/cmake/llvm/LLVMExports.cmake:1413 (message):
  The imported target "LLVMDemangle" references the file

     "/usr/local/llvm-devel/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/llvm-devel/lib/cmake/llvm/LLVMExports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/llvm-devel/lib/cmake/llvm/LLVMConfig.cmake:285 (include)
  CMakeLists.txt:19 (find_package)
...


It appears llvm-devel doesn't have a build option to not build static libs so the ports option is just deleting the files.  So I believe that's the case:

  * The installation package was faulty and contained

Should the static libs not be an option?  Or should additional modifications be applied to the cmake files?

Is it possible to have a new flavor that would create a package that only contains the static libs being deleted?

Assuming this option will be a part of devel/llvm13 when the time comes it would break devel/include-what-you-use since the option is disabled.
Comment 1 Derek Schrock 2021-05-16 16:31:42 UTC
In stead of a flavor I think a subpakage is more inline here.

https://reviews.freebsd.org/D16457
Comment 2 Brooks Davis freebsd_committer freebsd_triage 2021-05-17 23:43:00 UTC
Thanks for the report!

For now I'll plan to re-enable the STATIC_LIBS option by default in the next update. I'd turned it off in hopes that nothing actually required it since it's very big. I wonder if there's a more correct way to turn it off that results in a LLVMExports.cmake that causes a dynamic link to libLLVM instead.

Eventually we'll get sub-packages and this can be part of a -dev package.

JFYI, changes to llvm-devel often flow down to llvm## ports once they are tested, but infrastructure differences mean that llvm13 will be a copy of llvm12 rather than llvm-devel.
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-05-20 21:47:26 UTC
A commit in branch main references this bug:

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

commit a459b93bae5a13e939a1de8879e8bcd35be1c7b0
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-05-20 21:32:50 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-05-20 21:46:06 +0000

    devel/llvm-devel: new snapshot 2021-05-18

    Enable STATIC_LIBS by default to allow tools such as
    devel/include-what-you-use to link. [0]

    Install i386 sanitizers if they are built on amd64 (this happens if
    lib32 libraries are installed.)

    PR:             255894 [0]

 devel/llvm-devel/Makefile          |  71 ++++++++-------
 devel/llvm-devel/Makefile.COMMANDS |   4 +
 devel/llvm-devel/Makefile.snapshot |   4 +-
 devel/llvm-devel/distinfo          |   6 +-
 devel/llvm-devel/pkg-plist         | 171 ++++++++++++++++++++++++++++---------
 5 files changed, 179 insertions(+), 77 deletions(-)
Comment 4 Derek Schrock 2021-05-22 04:00:46 UTC
Confirmed iwyu from source main branch builds with devel/llvm-devel