[Buildroot] [PATCH 1/1] toolchain-buildroot: only allow BR2_STATIC_LIBS on supported archs
Romain Naour
romain.naour at gmail.com
Sun May 15 20:29:11 UTC 2022
Hello,
Le 11/05/2022 à 20:23, James Hilliard a écrit :
> On Wed, May 11, 2022 at 11:13 AM Arnout Vandecappelle <arnout at mind.be> wrote:
>>
>>
>>
>> On 10/05/2022 21:55, James Hilliard wrote:
>>> On Tue, May 10, 2022 at 1:32 PM Arnout Vandecappelle <arnout at mind.be> wrote:
>>>>
>>>>
>>>>
>>>> On 06/05/2022 07:46, James Hilliard wrote:
>>>>> It is currently possible to select BR2_STATIC_LIBS while
>>>>> BR2_TOOLCHAIN_BUILDROOT is selected even when there are no buildroot
>>>>> toolchains that support BR2_STATIC_LIBS for the selected architecture.
>>>>
>>>> Good catch!
>>>>
>>>>>
>>>>> Add BR2_TOOLCHAIN_BUILDROOT_STATIC_LIBS_ARCH_SUPPORTS so that we can
>>>>> disable the selection of BR2_STATIC_LIBS when using an unsupported
>>>>> architecture.
>>>>>
>>>>> Fixes:
>>>>> - http://autobuild.buildroot.net/results/4da/4da59af8193376ec893321c4c2aaf1d25598502d
>>>>> - http://autobuild.buildroot.net/results/195/1950348218a4f097f078d158977c13f8b0a97d6e
>>>>> - http://autobuild.buildroot.net/results/2f0/2f03f2be32ad9898a990f6f0264d8c8d51991eb1
>>>>>
>>>>> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
>>>>> ---
>>>>> Config.in | 2 +
>>>>> toolchain/toolchain-buildroot/Config.in | 119 ++++++++++++++++++------
>>>>> 2 files changed, 90 insertions(+), 31 deletions(-)
>>>>>
>>>>> diff --git a/Config.in b/Config.in
>>>>> index f0cd6f48ed..5daca3adce 100644
>>>>> --- a/Config.in
>>>>> +++ b/Config.in
>>>>> @@ -601,6 +601,8 @@ choice
>>>>>
>>>>> config BR2_STATIC_LIBS
>>>>> bool "static only"
>>>>> + depends on !BR2_TOOLCHAIN_BUILDROOT || \
>>>>> + BR2_TOOLCHAIN_BUILDROOT_STATIC_LIBS_ARCH_SUPPORTS
>>>>
>>>> However, I don't think this is the right approach.
>>>>
>>>> Instead, I think there should be a blind option
>>>> BR2_TOOLCHAIN_STATIC_LIBS_SUPPORTS that gets selected by toolchain that do
>>>> support static libs (i.e. using uClibc or musl), and remove all the 'depends on
>>>> !STATIC' from the toolchain options.
>>>
>>> I'm not sure that's the best way to handle this, I think normally
>>> users will want to
>>> first select their build type(ie BR2_STATIC_LIBS) and then select the toolchain
>>> out of the ones that support their build type, this is just needed for
>>> preventing
>>> users from selecting a build type that does not have a valid toolchain for some
>>> architectures.
>>>
>>> In menuconfig "build options" is above toolchain selection and the
>>> BR2_TOOLCHAIN_BUILDROOT_STATIC_LIBS_ARCH_SUPPORTS option
>>> is mostly determined by the "target options" which is above "build options".
>>
>> Yeah, I don't think that that's OK. I think everything starting from
>> BR2_ENABLE_DEBUG should instead go into the toolchain menu, or at least below
>> the toolchain menu. And it should be renamed from "build options" to something
>> else (though I don't know what). All those build options are fairly closely
>> related to the toolchain choice. For example stack protector strong is only
>> available in sufficiently recent GCC. And "Target optimizations", which really
>> is a global build options like debug, is already in the toolchain menu.
>>
>> I realize thought that what I'm asking for is a much bigger change, and this
>> patch is a fix so should be somewhat limited in scope.
>
> Yeah, I think probably best to start with something like my patch to ensure we
> identify and prevent selection of invalid configs so that autobuilders
> can identify
> any other remaining invalid combinations, this one gets hit a lot and may be
> making it difficult to identify other less common issues. Tracking
> down and blocking
> the known invalid combinations will make things clearer if we want
> rework the build
> options/toolchain menus down the line as well I think.
I missed this discussion about this issue.
I would suggest to split this patch in two.
Patch 1: introduce BR2_TOOLCHAIN_BUILDROOT_<libc>_ARCH_SUPPORTS refactoring
Patch 2: fix the BR2_STATIC_LIBS dependencies on uclibc-ng or musl
About BR2_TOOLCHAIN_BUILDROOT_<libc>_ARCH_SUPPORTS, it should include only the
list of supported architecture. It shouldn't include header or mmu dependency.
See bpftool for example:
https://git.buildroot.net/buildroot/tree/package/bpftool/Config.in?h=2022.02.1#n10
what about:
config BR2_TOOLCHAIN_BUILDROOT_<libc>_ARCH_SUPPORTS
bool
...
config BR2_TOOLCHAIN_BUILDROOT_<libc>_SUPPORTS
bool
depends on BR2_TOOLCHAIN_BUILDROOT_UCLIBC_ARCH_SUPPORTS
...
The BR2_TOOLCHAIN_BUILDROOT_LIBC check at makefile level can prevent building a
broken configuration in case of mistake in Kconfig level.
http://patchwork.ozlabs.org/project/buildroot/patch/20220515110341.173923-1-romain.naour@gmail.com/
Best regards,
Romain
>
>>
>>
>> What do others think?
>>
>> Regards,
>> Arnout
>>
>>>
>>> I was trying to avoid disabling BR2_STATIC_LIBS purely based on the specific
>>> toolchain selected.
>>>
>>>>
>>>> Regards,
>>>> Arnout
>>>>
>>>>
>>>>> help
>>>>> Build and use only static libraries. No shared libraries will
>>>>> be installed on the target. This potentially increases your
>>>>> diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
>>>>> index be89f68ab5..287253b11f 100644
>>>>> --- a/toolchain/toolchain-buildroot/Config.in
>>>>> +++ b/toolchain/toolchain-buildroot/Config.in
>>>>> @@ -20,6 +20,91 @@ config BR2_TOOLCHAIN_BUILDROOT_VENDOR
>>>>>
>>>>> If you're not sure, just leave the default "buildroot" value.
>>>>>
>>>>> +config BR2_TOOLCHAIN_BUILDROOT_UCLIBC_ARCH_SUPPORTS
>>>>> + bool
>>>>> + default y if BR2_aarch64
>>>>> + default y if BR2_aarch64_be
>>>>> + default y if BR2_arcle
>>>>> + default y if BR2_arceb
>>>>> + default y if BR2_arm
>>>>> + default y if BR2_armeb
>>>>> + default y if BR2_i386
>>>>> + default y if BR2_m68k
>>>>> + default y if BR2_microblaze
>>>>> + default y if BR2_mips
>>>>> + default y if BR2_mipsel
>>>>> + default y if BR2_mips64
>>>>> + default y if BR2_mips64el
>>>>> + default y if BR2_or1k
>>>>> + default y if BR2_powerpc
>>>>> + default y if BR2_RISCV_64
>>>>> + default y if BR2_sh4
>>>>> + default y if BR2_sh4eb
>>>>> + default y if BR2_sparc
>>>>> + default y if BR2_xtensa
>>>>> + default y if BR2_x86_64
>>>>> +
>>>>> +config BR2_TOOLCHAIN_BUILDROOT_GLIBC_ARCH_SUPPORTS
>>>>> + bool
>>>>> + default y if BR2_arm
>>>>> + default y if BR2_armeb
>>>>> + default y if BR2_aarch64
>>>>> + default y if BR2_aarch64_be
>>>>> + default y if BR2_i386
>>>>> + default y if BR2_mips
>>>>> + default y if BR2_mipsel
>>>>> + default y if BR2_mips64
>>>>> + default y if BR2_mips64el
>>>>> + default y if BR2_powerpc
>>>>> + default y if BR2_powerpc64
>>>>> + default y if BR2_powerpc64le
>>>>> + default y if BR2_riscv
>>>>> + default y if BR2_s390x
>>>>> + default y if BR2_sh
>>>>> + default y if BR2_sparc64
>>>>> + default y if BR2_x86_64
>>>>> + default y if BR2_microblaze
>>>>> + default y if BR2_nios2
>>>>> + default y if BR2_arc && BR2_ARC_ATOMIC_EXT
>>>>> + default y if BR2_csky
>>>>> + depends on BR2_USE_MMU
>>>>> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
>>>>> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 || !BR2_powerpc64le
>>>>> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 || !BR2_MIPS_NAN_2008
>>>>> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0 || !BR2_RISCV_64
>>>>> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1 || !BR2_arc
>>>>> + depends on !BR2_powerpc_SPE
>>>>> + depends on BR2_RISCV_ISA_RVA || !BR2_riscv
>>>>> +
>>>>> +config BR2_TOOLCHAIN_BUILDROOT_MUSL_ARCH_SUPPORTS
>>>>> + bool
>>>>> + default y if BR2_aarch64
>>>>> + default y if BR2_arm
>>>>> + default y if BR2_armeb
>>>>> + default y if BR2_i386
>>>>> + default y if BR2_microblaze
>>>>> + default y if BR2_mips
>>>>> + default y if BR2_mipsel
>>>>> + default y if BR2_mips64
>>>>> + default y if BR2_mips64el
>>>>> + default y if BR2_or1k
>>>>> + default y if BR2_powerpc
>>>>> + default y if BR2_powerpc64
>>>>> + default y if BR2_powerpc64le
>>>>> + default y if BR2_RISCV_64
>>>>> + default y if BR2_sh
>>>>> + default y if BR2_x86_64
>>>>> + depends on !BR2_powerpc_SPE # not supported, build breaks
>>>>> + depends on !(BR2_powerpc64 || BR2_powerpc64le) || BR2_POWERPC_CPU_HAS_ALTIVEC
>>>>> + # sh2 nommu is supported by musl, but we don't have support
>>>>> + # for it in Buildroot.
>>>>> + depends on BR2_USE_MMU
>>>>> +
>>>>> +config BR2_TOOLCHAIN_BUILDROOT_STATIC_LIBS_ARCH_SUPPORTS
>>>>> + bool
>>>>> + default y if BR2_TOOLCHAIN_BUILDROOT_UCLIBC_ARCH_SUPPORTS
>>>>> + default y if BR2_TOOLCHAIN_BUILDROOT_MUSL_ARCH_SUPPORTS
>>>>> +
>>>>> choice
>>>>> prompt "C library"
>>>>> default BR2_TOOLCHAIN_BUILDROOT_UCLIBC
>>>>> @@ -27,13 +112,7 @@ choice
>>>>>
>>>>> config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
>>>>> bool "uClibc-ng"
>>>>> - depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle || BR2_arceb || \
>>>>> - BR2_arm || BR2_armeb || \
>>>>> - BR2_i386 || BR2_m68k || BR2_microblaze || \
>>>>> - BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
>>>>> - BR2_or1k || BR2_powerpc || BR2_RISCV_64 || \
>>>>> - BR2_sh4 || BR2_sh4eb || BR2_sparc || BR2_xtensa || \
>>>>> - BR2_x86_64
>>>>> + depends on BR2_TOOLCHAIN_BUILDROOT_UCLIBC_ARCH_SUPPORTS
>>>>> select BR2_TOOLCHAIN_USES_UCLIBC
>>>>> help
>>>>> This option selects uClibc-ng as the C library for the
>>>>> @@ -43,22 +122,8 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
>>>>>
>>>>> config BR2_TOOLCHAIN_BUILDROOT_GLIBC
>>>>> bool "glibc"
>>>>> - depends on BR2_arm || BR2_armeb || BR2_aarch64 || \
>>>>> - BR2_aarch64_be || BR2_i386 || BR2_mips || \
>>>>> - BR2_mipsel || BR2_mips64 || BR2_mips64el|| \
>>>>> - BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \
>>>>> - BR2_riscv || BR2_s390x || BR2_sh || \
>>>>> - BR2_sparc64 || BR2_x86_64 || BR2_microblaze || \
>>>>> - BR2_nios2 || (BR2_arc && BR2_ARC_ATOMIC_EXT) || BR2_csky
>>>>> - depends on BR2_USE_MMU
>>>>> + depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC_ARCH_SUPPORTS
>>>>> depends on !BR2_STATIC_LIBS
>>>>> - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
>>>>> - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 || !BR2_powerpc64le
>>>>> - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 || !BR2_MIPS_NAN_2008
>>>>> - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0 || !BR2_RISCV_64
>>>>> - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1 || !BR2_arc
>>>>> - depends on !BR2_powerpc_SPE
>>>>> - depends on BR2_RISCV_ISA_RVA || !BR2_riscv
>>>>> select BR2_TOOLCHAIN_USES_GLIBC
>>>>> help
>>>>> This option selects glibc as the C library for the
>>>>> @@ -82,15 +147,7 @@ comment "glibc on MIPS w/ NAN2008 needs a toolchain w/ headers >= 4.5"
>>>>>
>>>>> config BR2_TOOLCHAIN_BUILDROOT_MUSL
>>>>> bool "musl"
>>>>> - depends on BR2_aarch64 || BR2_arm || BR2_armeb || BR2_i386 || \
>>>>> - BR2_microblaze || BR2_mips || BR2_mipsel || BR2_mips64 || \
>>>>> - BR2_mips64el || BR2_or1k || BR2_powerpc || BR2_powerpc64 || \
>>>>> - BR2_powerpc64le || BR2_RISCV_64 || BR2_sh || BR2_x86_64
>>>>> - depends on !BR2_powerpc_SPE # not supported, build breaks
>>>>> - depends on !(BR2_powerpc64 || BR2_powerpc64le) || BR2_POWERPC_CPU_HAS_ALTIVEC
>>>>> - # sh2 nommu is supported by musl, but we don't have support
>>>>> - # for it in Buildroot.
>>>>> - depends on BR2_USE_MMU
>>>>> + depends on BR2_TOOLCHAIN_BUILDROOT_MUSL_ARCH_SUPPORTS
>>>>> select BR2_TOOLCHAIN_USES_MUSL
>>>>> help
>>>>> This option selects musl as the C library for the
More information about the buildroot
mailing list