Bug 280863 - devel/libclc: incorrect reference to llvm15 in BUILD_DEPENDS
Summary: devel/libclc: incorrect reference to llvm15 in BUILD_DEPENDS
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
: 280997 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-08-16 12:38 UTC by Dmitry Afanasiev
Modified: 2024-09-02 18:05 UTC (History)
5 users (show)

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


Attachments
Makefile.patch (551 bytes, patch)
2024-08-16 12:38 UTC, Dmitry Afanasiev
no flags Details | Diff
Fix build dependency and honor LLVM_DEFAULT (873 bytes, patch)
2024-08-20 19:47 UTC, Jung-uk Kim
no flags Details | Diff
Flavorize devel/libclc (10.72 KB, patch)
2024-08-22 09:29 UTC, Emmanuel Vadot
no flags Details | Diff
Flavorize devel/libclc (10.76 KB, patch)
2024-08-22 13:54 UTC, Emmanuel Vadot
no flags Details | Diff
Flavorize devel/libclc (39.75 KB, patch)
2024-08-23 09:52 UTC, Emmanuel Vadot
no flags Details | Diff
Flavorize devel/libclc (39.79 KB, patch)
2024-08-26 11:51 UTC, Emmanuel Vadot
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Afanasiev 2024-08-16 12:38:59 UTC
Created attachment 252822 [details]
Makefile.patch

When using FLAVOR=lite for devel/llvm15 package devel/libclc fails to check dependencies and tries to install llvm15 again:

root@desktop:/usr/ports/devel/libclc# pkg info | grep  llvm15-lite
llvm15-lite-15.0.7_10          LLVM and Clang
root@desktop:/usr/ports/devel/libclc# make
===>  License LLVM accepted by the user
===>   libclc-15.0.4 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by libclc-15.0.4 for building
===>  Extracting for libclc-15.0.4
=> SHA256 Checksum OK for libclc-15.0.4.src.tar.xz.
===>  Patching for libclc-15.0.4
===>  Applying FreeBSD patches for libclc-15.0.4 from /usr/ports/devel/libclc/files
===>   libclc-15.0.4 depends on package: llvm15>=15.0 - not found
===>  License BSD3CLAUSE LLVM MIT PD REGEX LLVM2 accepted by the user
===>   llvm15-lite-15.0.7_10 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by llvm15-lite-15.0.7_10 for building
===>  Extracting for llvm15-lite-15.0.7_10

When BUILD_DEPENDS changed as described in a patch package builds successfully.
Comment 1 Dmitry Afanasiev 2024-08-16 12:59:30 UTC
Maybe www/chromium style should be used:
LLVM_DEFAULT=           15
BUILD_DEPENDS+=         clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-16 16:44:12 UTC
Could this work: USES+=llvm:15 ?
Comment 3 Jung-uk Kim freebsd_committer freebsd_triage 2024-08-20 19:47:47 UTC
Created attachment 252960 [details]
Fix build dependency and honor LLVM_DEFAULT

I think this patch should do.
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2024-08-20 20:07:14 UTC
BTW, lang/clover has LLVM:max=16 but I think it should be removed.  I haven't tried devel/llvm17 but it worked fine for me with devel/llvm18.  I will create a new PR if 17 and 19 work.
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2024-08-20 20:10:22 UTC
(In reply to Jung-uk Kim from comment #4)
Sorry, I missed Bug 280943.  I will update the PR if 17 and 19 work.
Comment 6 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-21 05:50:55 UTC
(In reply to Jung-uk Kim from comment #3)

I think it should yes, can someone test this for me ? (My build box is busy currently).
Comment 7 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-21 06:21:42 UTC
Note that I'm working on a flavored version of libclc which should be better.
Hoping to finish today.
Comment 8 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 09:29:59 UTC
Created attachment 253004 [details]
Flavorize devel/libclc
Comment 9 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 09:30:16 UTC
Currently testing my patch.
Comment 10 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-22 10:47:19 UTC
(In reply to Emmanuel Vadot from comment #8)
> BUILD_DEPENDS=	llvm${FLAVOR:S/llvm//}>=0:devel/${FLAVOR} \
Why not:
> USES=	llvm:${FLAVOR:S/llvm//},build,noexport
or without "noexport"?
Comment 11 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-22 13:30:35 UTC
*** Bug 280997 has been marked as a duplicate of this bug. ***
Comment 12 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 13:54:12 UTC
Created attachment 253017 [details]
Flavorize devel/libclc
Comment 13 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 13:54:24 UTC
(In reply to Vladimir Druzenko from comment #10)

Done
Comment 14 Jung-uk Kim freebsd_committer freebsd_triage 2024-08-22 16:46:07 UTC
(In reply to Emmanuel Vadot from comment #7)
Please feel free to update Bug 280957 while you are at it. :-)
Comment 15 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 17:42:34 UTC
(In reply to Jung-uk Kim from comment #14)

I can address this at the same time, just give me some time to at least compile clover with different libclc/llvm :)
Comment 16 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-22 18:32:23 UTC
So for some reason my patch doesn't work, it keeps finding (and using) the wrong llvm
-- The CXX compiler identification is Clang 18.1.8
-- The C compiler identification is Clang 18.1.8
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/llvm18/bin/clang++ - skipped
-- Detecting CXX compile features  
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/llvm18/bin/clang - skipped
-- Detecting C compile features 
-- Detecting C compile features - done
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.1")
-- Found zstd: /usr/local/lib/libzstd.so
-- Linker detection: LLD
LLVM version: 17.0.6                                           
clang: /usr/local/llvm17/bin/clang
llvm-as: /usr/local/llvm17/bin/llvm-as
llvm-link: /usr/local/llvm17/bin/llvm-link
opt: /usr/local/llvm17/bin/opt
llvm-spirv: /usr/local/llvm17/bin/llvm-spirv

I'll have another look at it tomorrow.
Comment 17 Jung-uk Kim freebsd_committer freebsd_triage 2024-08-22 18:41:34 UTC
(In reply to Emmanuel Vadot from comment #16)
Try CMAKE_ARGS+= -DLLVM_CONFIG="${LLVM_CONFIG}" as I did in my patch.
Comment 18 Vladimir Druzenko freebsd_committer freebsd_triage 2024-08-22 19:18:06 UTC
(In reply to Emmanuel Vadot from comment #16)
It's bug in upstream - install for example llvm14 together with llvm17 and it'll "find" llvm14.
"CMAKE_ARGS+=-DLLVM_CONFIG=${LLVM_CONFIG}" doesn't help.
Comment 19 Jan Beich freebsd_committer freebsd_triage 2024-08-22 22:36:57 UTC
Comment on attachment 253017 [details]
Flavorize devel/libclc

> CONFLICTS+=	libclc-${flavor}

Flavors can be co-installable if installed under LLVM_DIR (aka ${LOCALBASE}/llvm*) like spirv-llvm-translator. libclc is part of LLVM upstream, so have a "blessed version" doesn't make sense and may become a problem if libclc grows more consumers.

Note, LLVM_CONFIG can be replaced with LLVM_DIR which prevents CMake from looking elsewhere.
Comment 20 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-23 06:29:30 UTC
(In reply to Jung-uk Kim from comment #17)

That dooesn't change things for some version of llvm.
llvm15 flavor and llvm17 flavors works as expected, but llvm16 and llvm18 fallbacks to llvm17, I guess there is a problem with those for libclc, just need to find what.
Comment 21 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-23 06:29:58 UTC
(In reply to Jan Beich from comment #19)

Yeah I'll work on this after finding why some llvm version makes libclc not happy.
Comment 22 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-23 09:52:56 UTC
Created attachment 253034 [details]
Flavorize devel/libclc

Flavors are now installable in //
Works fine in a clean env (i.e. poudriere) for the llvm problem but doesn't in a non-clean env (i.e. make from ports dir with all llvm installed).
Comment 23 Emmanuel Vadot freebsd_committer freebsd_triage 2024-08-26 11:51:50 UTC
Created attachment 253104 [details]
Flavorize devel/libclc

Problem fixed by specifing CMAKE_PREFIX_PATH.
Comment 24 commit-hook freebsd_committer freebsd_triage 2024-08-27 16:32:08 UTC
A commit in branch main references this bug:

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

commit c01e7d09ade35c40645935cbeef38cf28cb487d1
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-08-22 09:05:56 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-08-27 16:29:44 +0000

    devel/libclc: Flavorize the port

    Defines some flavors for llvm15 to llvm18 for libclc.
    This will allow users to use a different LLVM_DEFAULT without having
    to rely on the default one (llvm15 for now).

    PR:             280863
    Sponsored by:   Beckhoff Automation GmbH & Co. KG

 devel/libclc/Makefile              |  30 +-
 devel/libclc/distinfo (gone)       |   3 -
 devel/libclc/distinfo.llvm15 (new) |   3 +
 devel/libclc/distinfo.llvm16 (new) |   3 +
 devel/libclc/distinfo.llvm17 (new) |   3 +
 devel/libclc/distinfo.llvm18 (new) |   3 +
 devel/libclc/pkg-plist             | 744 ++++++++++++++++++++-----------------
 graphics/mesa-devel/Makefile       |   4 +-
 graphics/mesa-dri/Makefile         |   5 +-
 lang/clover/Makefile               |   4 +-
 10 files changed, 444 insertions(+), 358 deletions(-)