Bug 254173 - pkgbase: installing FreeBSD-clang clang and FreeBSD-lld doesn't pull all dependencies necessary to actually compile and link programs
Summary: pkgbase: installing FreeBSD-clang clang and FreeBSD-lld doesn't pull all depe...
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: dfr
URL:
Keywords: pkgbase
Depends on:
Blocks:
 
Reported: 2021-03-09 21:54 UTC by Mina Galić
Modified: 2023-11-14 00:11 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mina Galić freebsd_triage 2021-03-09 21:54:28 UTC
pkg -r /isolates/clang-dependendy-bug/root -r FreeBSD-base FreeBSD-clang FreeBSD-utilities FreeBSD-lld

…

sudo pkg -r /isolates/clang-dependendy-bug/root info
FreeBSD-clang-14.snap20210306210736 Clang Utilities
FreeBSD-clibs-14.snap20210306210736 Core C Libraries
FreeBSD-libarchive-14.snap20210306210736 libarchive package
FreeBSD-libbegemot-14.snap20210306210736 libbegemot package
FreeBSD-libbsdxml-14.snap20210306210736 libbsdxml package
FreeBSD-libbsm-14.snap20210306210736 libbsm package
FreeBSD-libbz2-14.snap20210306210736 libbz2 package
FreeBSD-libdwarf-14.snap20210306210736 libdwarf package
FreeBSD-libefivar-14.snap20210306210736 libefivar package
FreeBSD-libevent1-14.snap20210306210736 libevent1 package
FreeBSD-libexecinfo-14.snap20210306210736 libexecinfo package
FreeBSD-libldns-14.snap20210306210736 libldns package
FreeBSD-liblzma-14.snap20210306210736 liblzma package
FreeBSD-libmagic-14.snap20210306210736 libmagic package
FreeBSD-libnetmap-14.snap20210306210736 libnetmap package
FreeBSD-libopie-14.snap20210306210736 libopie package
FreeBSD-libregex-14.snap20210306210736 libregex package
FreeBSD-libsmb-14.snap20210306210736 libsmb package
FreeBSD-libsqlite3-14.snap20210306210736 libsqlite3 package
FreeBSD-libucl-14.snap20210306210736 libucl package
FreeBSD-lld-14.snap20210306210736 lld package
FreeBSD-runtime-14.snap20210306210736 FreeBSD Base System
FreeBSD-utilities-14.snap20210306210736 Non-vital programs and librairies

meena@beastix /u/src (main)> sudo chroot /isolates/clang-dependendy-bug/root
root@beastix:/ # cd
root@beastix:~ # cat pls-compile.c
int main(){return 0;}

oot@beastix:~ # make pls-compile
cc -O2 -pipe  pls-compile.c  -o pls-compile
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lc
ld: error: unable to find library -lgcc
ld: error: unable to find library -lgcc_s
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /root


okay! let's add dependencies…

sudo pkg -r /isolates/clang-dependendy-bug/root install FreeBSD-libcompiler_rt

same error.
install FreeBSD-libcompiler_rt-dev

same error.

install  FreeBSD-clibs-dev:

root@beastix:~ # make pls-compile
cc -O2 -pipe  pls-compile.c  -o pls-compile
ld: error: cannot open /usr/lib/libc_nonshared.a: No such file or directory
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.

now we're getting somewhere!!

root@beastix:~ # make pls-compile
cc -O2 -pipe  pls-compile.c  -o pls-compile
root@beastix:~ # ./pls-compile
root@beastix:~ # echo $?
0
root@beastix:~ #

I honestly don't know which angle to attack this from, but this makes it really hard to build jails with pkgbase.
Comment 1 dfr 2022-09-11 07:47:48 UTC
The libc_nonshared.a file is in FreeBSD-utilities-dev - it should be in FreeBSD-clibs-dev.

There are other problems - some headers are in clib-dev, some in runtime-dev and some in utiltities-dev. Some headers from runtime-dev (e.g. ctype.h) depend on headers in utilities-dev (e.g. xlocale/_ctype.h)
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-11-01 10:18:29 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7631f9153b7d24279210869eb1fbe2e4a1763b2

commit c7631f9153b7d24279210869eb1fbe2e4a1763b2
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2022-11-01 10:14:29 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2022-11-01 10:17:07 +0000

    libc_nonshared: Move to clibs package

    Its needed by libc.a which lives in clibs.

    PR:     254173

 lib/libc_nonshared/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-12-16 03:32:51 UTC
Triage: assignment to the committer of c7631f9153b7d24279210869eb1fbe2e4a1763b2
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-09-12 12:24:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=78847e1e592789dc85bddf4d2f1d9a8ce4614ff1

commit 78847e1e592789dc85bddf4d2f1d9a8ce4614ff1
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2023-09-11 08:38:46 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2023-09-12 12:22:21 +0000

    pkgbase: Move headers and libs out of runtime and utilities

    Headers from src/include were in the runtime-dev package but
    subdirectories of src/include ended up in utilities-dev by default.
    Neither package is a good choice - the headers in src/include are not
    useful without the libraries contained in clibs-dev.

    This moves the standard C headers to clibs-dev (C++ headers are already
    in this package). While working on this, I found that various clang
    libraries and headers were also bundled into utilities-dev by default
    so these are also moved to clang-dev.

    I also added a FreeBSD-build-essential meta package to make it simple to
    install all the toolchain parts.

    PR:             254173
    Reviewed byb:   manu
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D41815

 include/Makefile                 | 2 +-
 include/Makefile.inc (new)       | 2 ++
 lib/clang/Makefile.inc           | 1 +
 lib/csu/Makefile.inc             | 1 +
 lib/libclang_rt/Makefile.inc     | 1 +
 release/packages/generate-ucl.sh | 3 +++
 6 files changed, 9 insertions(+), 1 deletion(-)
Comment 5 dfr 2023-09-12 13:12:15 UTC
Note: I forgot to remove the paragraph about adding a build-essential metapackage :(
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-09-17 12:21:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4ff9d270893af757b4348398c887e630d71edf6e

commit 4ff9d270893af757b4348398c887e630d71edf6e
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2023-09-17 10:06:01 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2023-09-17 12:21:06 +0000

    pkgbase: Add instructions for upgrading past 78847e1

    The pkg solver gets confused by the file moves and refuses to upgrade
    without manually upgrading FreeBSD-utilities and FreeBSD-utilities-dev
    first.

    PR:             254173, 273859
    MFC after:      1 week
    Reviewed by:    Mina Galić <freebsd@igalic.co>
    Differential Revision: https://reviews.freebsd.org/D41892

 UPDATING | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-10-20 14:14:53 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2eab6bc3c08f8f2238a24df336fcaa019592dca0

commit 2eab6bc3c08f8f2238a24df336fcaa019592dca0
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2023-09-17 10:06:01 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2023-10-20 12:16:47 +0000

    pkgbase: Add instructions for upgrading past 78847e1

    The pkg solver gets confused by the file moves and refuses to upgrade
    without manually upgrading FreeBSD-utilities and FreeBSD-utilities-dev
    first.

    PR:             254173, 273859
    MFC after:      1 week
    Reviewed by:    Mina Galić <freebsd@igalic.co>
    Differential Revision: https://reviews.freebsd.org/D41892

    (cherry picked from commit 4ff9d270893af757b4348398c887e630d71edf6e)

 UPDATING | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-11-12 11:31:30 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e968616046a32e4ac7b98b2aa7935c3a64f66ada

commit e968616046a32e4ac7b98b2aa7935c3a64f66ada
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2023-09-11 08:38:46 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2023-11-12 10:37:16 +0000

    pkgbase: Move headers and libs out of runtime and utilities

    Headers from src/include were in the runtime-dev package but
    subdirectories of src/include ended up in utilities-dev by default.
    Neither package is a good choice - the headers in src/include are not
    useful without the libraries contained in clibs-dev.

    This moves the standard C headers to clibs-dev (C++ headers are already
    in this package). While working on this, I found that various clang
    libraries and headers were also bundled into utilities-dev by default
    so these are also moved to clang-dev.

    I also added a FreeBSD-build-essential meta package to make it simple to
    install all the toolchain parts.

    PR:             254173
    Reviewed byb:   manu
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D41815

    (cherry picked from commit 78847e1e592789dc85bddf4d2f1d9a8ce4614ff1)

 include/Makefile                 | 2 +-
 include/Makefile.inc (new)       | 2 ++
 lib/clang/Makefile.inc           | 1 +
 lib/csu/Makefile.inc             | 1 +
 lib/libclang_rt/Makefile.inc     | 1 +
 release/packages/generate-ucl.sh | 3 +++
 6 files changed, 9 insertions(+), 1 deletion(-)
Comment 9 crest 2023-11-14 00:11:51 UTC
This is a similar problem to moving files between packages. Could both be improved by defining meta-packages that depend on the packages required to provide a feature-set e.g. FreeBSD-self-host, FreeBSD-symbols, FreeBSD-default-kernel, FreeBSD-jail?