From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
shuah@kernel.org, ndesaulniers@google.com, kafai@fb.com,
songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com,
kpsingh@kernel.org, quentin@isovalent.com, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH bpf-next v2 1/6] tools: Help cross-building with clang
Date: Mon, 31 Jan 2022 14:10:30 +0000 [thread overview]
Message-ID: <Yfft1sqfXGTAjwJ8@myrica> (raw)
In-Reply-To: <YfSUAPnZX/wP8U+p@archlinux-ax161>
Hi Nathan,
On Fri, Jan 28, 2022 at 06:10:24PM -0700, Nathan Chancellor wrote:
> > diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
> > index 071312f5eb92..b0be5f40a3f1 100644
> > --- a/tools/scripts/Makefile.include
> > +++ b/tools/scripts/Makefile.include
> > @@ -87,7 +87,18 @@ LLVM_STRIP ?= llvm-strip
> >
> > ifeq ($(CC_NO_CLANG), 1)
> > EXTRA_WARNINGS += -Wstrict-aliasing=3
> > -endif
> > +
> > +else ifneq ($(CROSS_COMPILE),)
> > +CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
> > +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc))
>
> Apologies for noticing this so late, I only ran into this recently.
>
> This line causes a warning when running 'make clean' when
> '$(CROSS_COMPILE)gcc' does not exist in PATH. For example:
>
> $ make -skj"$(nproc)" ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- LLVM=1 LLVM_IAS=0 clean
> which: no powerpc-linux-gnu-gcc in ($PATH)
>
> I only have powerpc-linux-gnu binutils in my PATH, not GCC, as I am only
> working with clang.
>
> This happens because of the 'resolve_btfids_clean target', which always
> runs when running the 'clean' target on an in-tree build (since
> $(objtree) = $(srctree)).
>
> I tried looking into the best way to fix this but I am not at all
> familiar with the tools/ build system; would you mind taking a look?
> I see some machinery at the top of tools/bpf/Makefile for avoiding
> running some commands under certain commands but I am unsure how to
> shuffle that around to make everything work.
I think it's simpler than that, we should just suppress the errors from
'which'. It's fine that $(CROSS_COMPILE)gcc doesn't exist and
$(GCC_TOOLCHAIN_DIR) is empty, but 'which' should keep quiet about it.
I did test this patch with cross-build and no gcc, but Debian's 'which' is
quiet by default so I missed the error. I'll send a fix shortly.
Thanks,
Jean
next prev parent reply other threads:[~2022-01-31 14:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 16:38 [PATCH bpf-next v2 0/6] tools/bpf: Enable cross-building with clang Jean-Philippe Brucker
2021-12-16 16:38 ` [PATCH bpf-next v2 1/6] tools: Help " Jean-Philippe Brucker
2021-12-16 19:16 ` Nick Desaulniers
2022-01-29 1:10 ` Nathan Chancellor
2022-01-31 14:10 ` Jean-Philippe Brucker [this message]
2022-01-31 17:04 ` Nathan Chancellor
2021-12-16 16:38 ` [PATCH bpf-next v2 2/6] tools/resolve_btfids: Support cross-building the kernel " Jean-Philippe Brucker
2021-12-16 16:38 ` [PATCH bpf-next v2 3/6] tools/libbpf: Enable cross-building " Jean-Philippe Brucker
2021-12-16 16:38 ` [PATCH bpf-next v2 4/6] bpftool: " Jean-Philippe Brucker
2021-12-16 16:38 ` [PATCH bpf-next v2 5/6] tools/runqslower: " Jean-Philippe Brucker
2021-12-16 16:38 ` [PATCH bpf-next v2 6/6] selftests/bpf: " Jean-Philippe Brucker
2021-12-16 20:32 ` [PATCH bpf-next v2 0/6] tools/bpf: " patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yfft1sqfXGTAjwJ8@myrica \
--to=jean-philippe@linaro.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=quentin@isovalent.com \
--cc=shuah@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).