The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: kbuild: check the minimum compiler version in Kconfig
@ 2022-11-16 21:48 Florian Fainelli
  2022-11-16 22:48 ` Nick Desaulniers
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2022-11-16 21:48 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kernel@vger.kernel.org, Nick Desaulniers
  Cc: Paul Gortmaker, Nathan Chancellor, ojeda, sedat.dilek

Hi Masahiro, Nick,

The compiler version check performed with 
aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum 
compiler version in Kconfig") can be defeated and prevent running the 
*config targets if specifying LLVM=1 on the command line, in that way:

BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images 
LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C 
/local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom 
HOSTCC="/usr/bin/gcc" 
HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache 
/usr/bin/gcc -O2 
-I/local/users/fainelli/buildroot-llvm/output/arm64/host/include 
-DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib 
-Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib" 
ARCH=arm64 
INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target 
CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-" 
WERROR=0 
DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod 
INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
   UPD     scripts/kconfig/mconf-cfg
   HOSTCC  scripts/kconfig/mconf.o
   HOSTCC  scripts/kconfig/lxdialog/checklist.o
   HOSTCC  scripts/kconfig/lxdialog/inputbox.o
   HOSTCC  scripts/kconfig/lxdialog/menubox.o
   HOSTCC  scripts/kconfig/lxdialog/textbox.o
   HOSTCC  scripts/kconfig/lxdialog/util.o
   HOSTCC  scripts/kconfig/lxdialog/yesno.o
   HOSTLD  scripts/kconfig/mconf
***
*** Compiler is too old.
***   Your Clang version:    10.0.0
***   Minimum Clang version: 10.0.1
***
scripts/Kconfig.include:44: Sorry, this compiler is not supported.

Here, the compiler check is actually checking the host compiler clang 
version installed on my Ubuntu 20.04 system, as opposed to the cross 
compiler clang version that is being used.

It is not clear to me how to best address that, short of not specifying 
LLVM=1 on the kernel *config targets, but IMHO there is still an actual 
issue where we do not check the compiler that we would want to check.

Thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 21:48 kbuild: check the minimum compiler version in Kconfig Florian Fainelli
@ 2022-11-16 22:48 ` Nick Desaulniers
  2022-11-16 22:56   ` Florian Fainelli
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2022-11-16 22:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Masahiro Yamada, linux-kernel@vger.kernel.org, Paul Gortmaker,
	Nathan Chancellor, ojeda, sedat.dilek

On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> Hi Masahiro, Nick,
>
> The compiler version check performed with
> aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
> compiler version in Kconfig") can be defeated and prevent running the
> *config targets if specifying LLVM=1 on the command line, in that way:
>
> BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
> LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
> /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
> HOSTCC="/usr/bin/gcc"
> HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
> /usr/bin/gcc -O2
> -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
> -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
> -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
> ARCH=arm64
> INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
> CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
> WERROR=0
> DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
> INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
>    UPD     scripts/kconfig/mconf-cfg
>    HOSTCC  scripts/kconfig/mconf.o
>    HOSTCC  scripts/kconfig/lxdialog/checklist.o
>    HOSTCC  scripts/kconfig/lxdialog/inputbox.o
>    HOSTCC  scripts/kconfig/lxdialog/menubox.o
>    HOSTCC  scripts/kconfig/lxdialog/textbox.o
>    HOSTCC  scripts/kconfig/lxdialog/util.o
>    HOSTCC  scripts/kconfig/lxdialog/yesno.o
>    HOSTLD  scripts/kconfig/mconf
> ***
> *** Compiler is too old.
> ***   Your Clang version:    10.0.0
> ***   Minimum Clang version: 10.0.1
> ***
> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
>
> Here, the compiler check is actually checking the host compiler clang
> version installed on my Ubuntu 20.04 system, as opposed to the cross
> compiler clang version that is being used.

LLVM=1 will use `clang` as found by your $PATH.  Where did you express
to make what the "cross compiler clang version" is? (And why do you
set HOSTCC three times)

>
> It is not clear to me how to best address that, short of not specifying
> LLVM=1 on the kernel *config targets, but IMHO there is still an actual
> issue where we do not check the compiler that we would want to check.
>
> Thanks!
> --
> Florian



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 22:48 ` Nick Desaulniers
@ 2022-11-16 22:56   ` Florian Fainelli
  2022-11-16 23:10     ` Nick Desaulniers
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2022-11-16 22:56 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Masahiro Yamada, linux-kernel@vger.kernel.org, Paul Gortmaker,
	Nathan Chancellor, ojeda, sedat.dilek

On 11/16/22 14:48, Nick Desaulniers wrote:
> On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>
>> Hi Masahiro, Nick,
>>
>> The compiler version check performed with
>> aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
>> compiler version in Kconfig") can be defeated and prevent running the
>> *config targets if specifying LLVM=1 on the command line, in that way:
>>
>> BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
>> LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
>> /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
>> HOSTCC="/usr/bin/gcc"
>> HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
>> /usr/bin/gcc -O2
>> -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
>> -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
>> -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
>> ARCH=arm64
>> INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
>> CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
>> WERROR=0
>> DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
>> INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
>>     UPD     scripts/kconfig/mconf-cfg
>>     HOSTCC  scripts/kconfig/mconf.o
>>     HOSTCC  scripts/kconfig/lxdialog/checklist.o
>>     HOSTCC  scripts/kconfig/lxdialog/inputbox.o
>>     HOSTCC  scripts/kconfig/lxdialog/menubox.o
>>     HOSTCC  scripts/kconfig/lxdialog/textbox.o
>>     HOSTCC  scripts/kconfig/lxdialog/util.o
>>     HOSTCC  scripts/kconfig/lxdialog/yesno.o
>>     HOSTLD  scripts/kconfig/mconf
>> ***
>> *** Compiler is too old.
>> ***   Your Clang version:    10.0.0
>> ***   Minimum Clang version: 10.0.1
>> ***
>> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
>>
>> Here, the compiler check is actually checking the host compiler clang
>> version installed on my Ubuntu 20.04 system, as opposed to the cross
>> compiler clang version that is being used.
> 
> LLVM=1 will use `clang` as found by your $PATH.  Where did you express
> to make what the "cross compiler clang version" is? (And why do you
> set HOSTCC three times)

We are setting CROSS_COMPILE to express the cross compiler clang prefix 
to use.

Setting HOSTCC three times is done by buildroot, it does it through make 
flags, and then variables passed to make etc. clearly we could change 
that, but that's out of scope is not it?
-- 
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 22:56   ` Florian Fainelli
@ 2022-11-16 23:10     ` Nick Desaulniers
  2022-11-16 23:11       ` Nick Desaulniers
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2022-11-16 23:10 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Masahiro Yamada, linux-kernel@vger.kernel.org, Paul Gortmaker,
	Nathan Chancellor, ojeda, sedat.dilek, clang-built-linux,
	Manoj Gupta

On Wed, Nov 16, 2022 at 2:56 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 11/16/22 14:48, Nick Desaulniers wrote:
> > On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> >>
> >> Hi Masahiro, Nick,
> >>
> >> The compiler version check performed with
> >> aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
> >> compiler version in Kconfig") can be defeated and prevent running the
> >> *config targets if specifying LLVM=1 on the command line, in that way:
> >>
> >> BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
> >> LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
> >> /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
> >> HOSTCC="/usr/bin/gcc"
> >> HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
> >> /usr/bin/gcc -O2
> >> -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
> >> -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
> >> -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
> >> ARCH=arm64
> >> INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
> >> CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
> >> WERROR=0
> >> DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
> >> INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
> >>     UPD     scripts/kconfig/mconf-cfg
> >>     HOSTCC  scripts/kconfig/mconf.o
> >>     HOSTCC  scripts/kconfig/lxdialog/checklist.o
> >>     HOSTCC  scripts/kconfig/lxdialog/inputbox.o
> >>     HOSTCC  scripts/kconfig/lxdialog/menubox.o
> >>     HOSTCC  scripts/kconfig/lxdialog/textbox.o
> >>     HOSTCC  scripts/kconfig/lxdialog/util.o
> >>     HOSTCC  scripts/kconfig/lxdialog/yesno.o
> >>     HOSTLD  scripts/kconfig/mconf
> >> ***
> >> *** Compiler is too old.
> >> ***   Your Clang version:    10.0.0
> >> ***   Minimum Clang version: 10.0.1
> >> ***
> >> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> >>
> >> Here, the compiler check is actually checking the host compiler clang
> >> version installed on my Ubuntu 20.04 system, as opposed to the cross
> >> compiler clang version that is being used.
> >
> > LLVM=1 will use `clang` as found by your $PATH.  Where did you express
> > to make what the "cross compiler clang version" is? (And why do you
> > set HOSTCC three times)
>
> We are setting CROSS_COMPILE to express the cross compiler clang prefix
> to use.

Can you try setting CLANG_PREFIX rather than CROSS_COMPILE (to the same value)?

CLANG_PREFIX=/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-


>
> Setting HOSTCC three times is done by buildroot, it does it through make
> flags, and then variables passed to make etc. clearly we could change
> that, but that's out of scope is not it?
> --
> Florian
>


--
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 23:10     ` Nick Desaulniers
@ 2022-11-16 23:11       ` Nick Desaulniers
  2022-11-16 23:16         ` Florian Fainelli
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2022-11-16 23:11 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Masahiro Yamada, linux-kernel@vger.kernel.org, Paul Gortmaker,
	Nathan Chancellor, ojeda, sedat.dilek, clang-built-linux,
	Manoj Gupta

On Wed, Nov 16, 2022 at 3:10 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Wed, Nov 16, 2022 at 2:56 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> >
> > On 11/16/22 14:48, Nick Desaulniers wrote:
> > > On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> > >>
> > >> Hi Masahiro, Nick,
> > >>
> > >> The compiler version check performed with
> > >> aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
> > >> compiler version in Kconfig") can be defeated and prevent running the
> > >> *config targets if specifying LLVM=1 on the command line, in that way:
> > >>
> > >> BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
> > >> LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
> > >> /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
> > >> HOSTCC="/usr/bin/gcc"
> > >> HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
> > >> /usr/bin/gcc -O2
> > >> -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
> > >> -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
> > >> -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
> > >> ARCH=arm64
> > >> INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
> > >> CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
> > >> WERROR=0
> > >> DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
> > >> INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
> > >>     UPD     scripts/kconfig/mconf-cfg
> > >>     HOSTCC  scripts/kconfig/mconf.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/checklist.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/inputbox.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/menubox.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/textbox.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/util.o
> > >>     HOSTCC  scripts/kconfig/lxdialog/yesno.o
> > >>     HOSTLD  scripts/kconfig/mconf
> > >> ***
> > >> *** Compiler is too old.
> > >> ***   Your Clang version:    10.0.0
> > >> ***   Minimum Clang version: 10.0.1
> > >> ***
> > >> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> > >>
> > >> Here, the compiler check is actually checking the host compiler clang
> > >> version installed on my Ubuntu 20.04 system, as opposed to the cross
> > >> compiler clang version that is being used.
> > >
> > > LLVM=1 will use `clang` as found by your $PATH.  Where did you express
> > > to make what the "cross compiler clang version" is? (And why do you
> > > set HOSTCC three times)
> >
> > We are setting CROSS_COMPILE to express the cross compiler clang prefix
> > to use.
>
> Can you try setting CLANG_PREFIX rather than CROSS_COMPILE (to the same value)?
>
> CLANG_PREFIX=/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-

sorry, I meant LLVM_PREFIX

>
>
> >
> > Setting HOSTCC three times is done by buildroot, it does it through make
> > flags, and then variables passed to make etc. clearly we could change
> > that, but that's out of scope is not it?
> > --
> > Florian
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 23:11       ` Nick Desaulniers
@ 2022-11-16 23:16         ` Florian Fainelli
  2022-11-16 23:24           ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2022-11-16 23:16 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Masahiro Yamada, linux-kernel@vger.kernel.org, Paul Gortmaker,
	Nathan Chancellor, ojeda, sedat.dilek, clang-built-linux,
	Manoj Gupta

On 11/16/22 15:11, Nick Desaulniers wrote:
> On Wed, Nov 16, 2022 at 3:10 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
>>
>> On Wed, Nov 16, 2022 at 2:56 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>
>>> On 11/16/22 14:48, Nick Desaulniers wrote:
>>>> On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>>>
>>>>> Hi Masahiro, Nick,
>>>>>
>>>>> The compiler version check performed with
>>>>> aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
>>>>> compiler version in Kconfig") can be defeated and prevent running the
>>>>> *config targets if specifying LLVM=1 on the command line, in that way:
>>>>>
>>>>> BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
>>>>> LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
>>>>> /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
>>>>> HOSTCC="/usr/bin/gcc"
>>>>> HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
>>>>> /usr/bin/gcc -O2
>>>>> -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
>>>>> -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
>>>>> -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
>>>>> ARCH=arm64
>>>>> INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
>>>>> CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
>>>>> WERROR=0
>>>>> DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
>>>>> INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
>>>>>      UPD     scripts/kconfig/mconf-cfg
>>>>>      HOSTCC  scripts/kconfig/mconf.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/checklist.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/inputbox.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/menubox.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/textbox.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/util.o
>>>>>      HOSTCC  scripts/kconfig/lxdialog/yesno.o
>>>>>      HOSTLD  scripts/kconfig/mconf
>>>>> ***
>>>>> *** Compiler is too old.
>>>>> ***   Your Clang version:    10.0.0
>>>>> ***   Minimum Clang version: 10.0.1
>>>>> ***
>>>>> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
>>>>>
>>>>> Here, the compiler check is actually checking the host compiler clang
>>>>> version installed on my Ubuntu 20.04 system, as opposed to the cross
>>>>> compiler clang version that is being used.
>>>>
>>>> LLVM=1 will use `clang` as found by your $PATH.  Where did you express
>>>> to make what the "cross compiler clang version" is? (And why do you
>>>> set HOSTCC three times)
>>>
>>> We are setting CROSS_COMPILE to express the cross compiler clang prefix
>>> to use.
>>
>> Can you try setting CLANG_PREFIX rather than CROSS_COMPILE (to the same value)?
>>
>> CLANG_PREFIX=/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-
> 
> sorry, I meant LLVM_PREFIX

Same results unfortunately.
-- 
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kbuild: check the minimum compiler version in Kconfig
  2022-11-16 23:16         ` Florian Fainelli
@ 2022-11-16 23:24           ` Nathan Chancellor
  0 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2022-11-16 23:24 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Nick Desaulniers, Masahiro Yamada, linux-kernel@vger.kernel.org,
	Paul Gortmaker, Nathan Chancellor, ojeda, sedat.dilek,
	clang-built-linux, Manoj Gupta

On Wed, Nov 16, 2022 at 03:16:32PM -0800, Florian Fainelli wrote:
> On 11/16/22 15:11, Nick Desaulniers wrote:
> > On Wed, Nov 16, 2022 at 3:10 PM Nick Desaulniers
> > <ndesaulniers@google.com> wrote:
> > > 
> > > On Wed, Nov 16, 2022 at 2:56 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> > > > 
> > > > On 11/16/22 14:48, Nick Desaulniers wrote:
> > > > > On Wed, Nov 16, 2022 at 1:48 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> > > > > > 
> > > > > > Hi Masahiro, Nick,
> > > > > > 
> > > > > > The compiler version check performed with
> > > > > > aec6c60a01d3a3170242d6a99372a388e1136dc6 ("kbuild: check the minimum
> > > > > > compiler version in Kconfig") can be defeated and prevent running the
> > > > > > *config targets if specifying LLVM=1 on the command line, in that way:
> > > > > > 
> > > > > > BR_BINARIES_DIR=/local/users/fainelli/buildroot-llvm/output/arm64/images
> > > > > > LLVM=1 LLVM_IAS=1 PKG_CONFIG_PATH="" /usr/bin/make -j49 -C
> > > > > > /local/users/fainelli/buildroot-llvm/output/arm64/build/linux-custom
> > > > > > HOSTCC="/usr/bin/gcc"
> > > > > > HOSTCC="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/ccache
> > > > > > /usr/bin/gcc -O2
> > > > > > -I/local/users/fainelli/buildroot-llvm/output/arm64/host/include
> > > > > > -DNDEBUG -L/local/users/fainelli/buildroot-llvm/output/arm64/host/lib
> > > > > > -Wl,-rpath,/local/users/fainelli/buildroot-llvm/output/arm64/host/lib"
> > > > > > ARCH=arm64
> > > > > > INSTALL_MOD_PATH=/local/users/fainelli/buildroot-llvm/output/arm64/target
> > > > > > CROSS_COMPILE="/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-"
> > > > > > WERROR=0
> > > > > > DEPMOD=/local/users/fainelli/buildroot-llvm/output/arm64/host/sbin/depmod
> > > > > > INSTALL_MOD_STRIP=1 HOSTCC="/usr/bin/gcc" menuconfig
> > > > > >      UPD     scripts/kconfig/mconf-cfg
> > > > > >      HOSTCC  scripts/kconfig/mconf.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/checklist.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/inputbox.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/menubox.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/textbox.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/util.o
> > > > > >      HOSTCC  scripts/kconfig/lxdialog/yesno.o
> > > > > >      HOSTLD  scripts/kconfig/mconf
> > > > > > ***
> > > > > > *** Compiler is too old.
> > > > > > ***   Your Clang version:    10.0.0
> > > > > > ***   Minimum Clang version: 10.0.1
> > > > > > ***
> > > > > > scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> > > > > > 
> > > > > > Here, the compiler check is actually checking the host compiler clang
> > > > > > version installed on my Ubuntu 20.04 system, as opposed to the cross
> > > > > > compiler clang version that is being used.
> > > > > 
> > > > > LLVM=1 will use `clang` as found by your $PATH.  Where did you express
> > > > > to make what the "cross compiler clang version" is? (And why do you
> > > > > set HOSTCC three times)
> > > > 
> > > > We are setting CROSS_COMPILE to express the cross compiler clang prefix
> > > > to use.
> > > 
> > > Can you try setting CLANG_PREFIX rather than CROSS_COMPILE (to the same value)?
> > > 
> > > CLANG_PREFIX=/local/users/fainelli/buildroot-llvm/output/arm64/host/bin/aarch64-linux-
> > 
> > sorry, I meant LLVM_PREFIX
> 
> Same results unfortunately.

What kernel version is this?

If you are not using PATH to control which binaries are being used, you
can use

    $ make LLVM=.../

to use .../clang, .../ld.lld, etc (the trailing slash is critical for
this), which will behave similar to CROSS_COMPILE for GCC. When building
with LLVM, CROSS_COMPILE only controls the target triple and it is
unnecessary when using all LLVM tools. That LLVM behavior is relatively
new, see commit e9c281928c24 ("kbuild: Make $(LLVM) more flexible").

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-16 23:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-16 21:48 kbuild: check the minimum compiler version in Kconfig Florian Fainelli
2022-11-16 22:48 ` Nick Desaulniers
2022-11-16 22:56   ` Florian Fainelli
2022-11-16 23:10     ` Nick Desaulniers
2022-11-16 23:11       ` Nick Desaulniers
2022-11-16 23:16         ` Florian Fainelli
2022-11-16 23:24           ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox