Bug 263913 - bsd.sys.mk spams with "-fuse-ld= is not supported" during cleandir
Summary: bsd.sys.mk spams with "-fuse-ld= is not supported" during cleandir
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-11 06:36 UTC by Piotr Pawel Stefaniak
Modified: 2022-05-26 00:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Pawel Stefaniak freebsd_committer 2022-05-11 06:36:30 UTC
I silenced it with this:

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index fefad7996ee..7a1e3547244 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -317,6 +317,8 @@ CFLAGS+=    ERROR-tried-to-rebuild-during-make-install
 .endif
 .endif

+# If COMPILER_TYPE == "none", we are doing a make obj/cleandir/cleanobj
+.if ${COMPILER_TYPE} != "none"
 # Please keep this if in sync with kern.mk
 .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
 # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
@@ -337,6 +339,7 @@ LDFLAGS+=   -fuse-ld=${LD:[1]:S/^ld.//1W}
 .endif
 .endif
 .endif
+.endif

 # Tell bmake not to mistake standard targets for things to be searched for
 # or expect to ever be up-to-date.
Comment 1 Piotr Pawel Stefaniak freebsd_committer 2022-05-11 06:38:04 UTC
The branch is stable/13 and the command is make -sj8 CROSS_TOOLCHAIN=llvm13 WITHOUT_TOOLCHAIN=yes buildworld buildkernel
Comment 2 Ed Maste freebsd_committer 2022-05-11 17:13:47 UTC
I had a similar sort of situation in PR260099, but agree checking COMPILER_TYPE is probably the right thing here.

This might be a bit simpler:

emaste@nazar:~/src/freebsd-git/main $ git diff
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index f09987ecd962..221e8b028479 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -326,7 +326,7 @@ LDFLAGS+=   --ld-path=${LD:[1]:S/^ld.//1W}
 .else
 LDFLAGS+=      -fuse-ld=${LD:[1]:S/^ld.//1W}
 .endif
-.else
+.elif ${COMPILER_TYPE} == "gcc"
 # GCC does not support an absolute path for -fuse-ld so we just print this
 # warning instead and let the user add the required symlinks.
 # However, we can avoid this warning if -B is set appropriately (e.g. for
Comment 3 Piotr Pawel Stefaniak freebsd_committer 2022-05-11 20:35:03 UTC
FWIW LGTM.
Comment 4 commit-hook freebsd_committer 2022-05-12 15:00:04 UTC
A commit in branch main references this bug:

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

commit 4143e4fb197bec8cad4cdf129c86d45b0e942fd9
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-05-12 14:49:30 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-05-12 14:59:06 +0000

    Hide -fuse-ld= not supported message for non-build targets

    In some build configurations a warning about (an absolute path for)
    -fuse-ld= not being supported by GCC was emitted during cleandir or
    other non-build make targets.

    For these non-build targets COMPILER_TYPE is set to "none" but we
    treated the .else case for COMPILER_TYPE==clang as implying gcc.
    Check instead for COMPILER_TYPE==gcc.

    PR:             263913
    Reported by:    pstef
    Reviewed by:    pstef
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation

 share/mk/bsd.sys.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer 2022-05-26 00:29:03 UTC
A commit in branch stable/13 references this bug:

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

commit 936d52c10e2fa6d2c106b51842986dce3424be6e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-05-12 14:49:30 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-05-26 00:28:21 +0000

    Hide -fuse-ld= not supported message for non-build targets

    In some build configurations a warning about (an absolute path for)
    -fuse-ld= not being supported by GCC was emitted during cleandir or
    other non-build make targets.

    For these non-build targets COMPILER_TYPE is set to "none" but we
    treated the .else case for COMPILER_TYPE==clang as implying gcc.
    Check instead for COMPILER_TYPE==gcc.

    PR:             263913
    Reported by:    pstef
    Reviewed by:    pstef
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 4143e4fb197bec8cad4cdf129c86d45b0e942fd9)

 share/mk/bsd.sys.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)