Add BR2_TOOLCHAIN_HAS_FTS config option
PATCH 1/1 Add BR2_TOOLCHAIN_HAS_FTS config option
Currently there are a few packages in buildroot that are set to not be selectable unless the user wishes to use glibc specifically because the package uses fts.h.
uClibc actually does have a fts implimentation, and it's selectable in uclib-menuconfig. However; this has two issues with it:
1) Most users wouldn't know that there is even a uClibc-menuconfig
2) Even if the user does select fts support in uClibc-menuconfig, the packages that would now compile and work would still not be selectable because they explicitly require BR2_TOOLCHAIN_USES_GLIBC.
This patch does the following:
- Create a BR2_TOOLCHAIN_HAS_FTS configuration option in uclibc/Config.in and automatically set the kconfig during the configure stage.
- when glibc is selected, BR2_TOOLCHAIN_HAS_FTS is now selected.
This will allow for packages that require glibc only because of fts.h to now depend on BR2_TOOLCHAIN_HAS_FTS instead of BR2_TOOLCHAIN_USES_GLIBC.
--- package/glibc/Config.in | 1 + package/uclibc/Config.in | 8 ++++++++ package/uclibc/uclibc.mk | 10 ++++++++++ 3 files changed, 19 insertions(+)
package/glibc/Config.in +1 -0
@@ -5,5 +5,6 @@ config BR2_PACKAGE_GLIBC default y select BR2_PACKAGE_LINUX_HEADERS select BR2_TOOLCHAIN_HAS_SSP + select BR2_TOOLCHAIN_HAS_FTS endif
package/uclibc/Config.in +6 -0
@@ -79,6 +79,12 @@ config BR2_TOOLCHAIN_BUILDROOT_USE_SSP See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt for details. +config BR2_TOOLCHAIN_HAS_FTS + bool "Support the fts interface." + help + The fts functions are provided for traversing UNIX file + hierarchies. This adds around 7.5k to the build. + config BR2_UCLIBC_INSTALL_UTILS bool "Compile and install uClibc utilities" default y
package/uclibc/uclibc.mk +10 -0
@@ -356,6 +356,15 @@ endef endif # +# fts +# +ifeq ($(BR2_TOOLCHAIN_HAS_FTS),y) +UCLIBC_FTS_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FTS,$(@D)/.config) +else +UCLIBC_FTS_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_FTS,$(@D)/.config) +endif + +# # wchar #
@@ -419,6 +428,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS $(UCLIBC_LOCALE_CONFIG) $(UCLIBC_WCHAR_CONFIG) $(UCLIBC_SHARED_LIBS_CONFIG) + $(UCLIBC_FTS_CONFIG) endef define UCLIBC_BUILD_CMDS
Signature · 1 line
2.9.4
PATCH 2/2 selinux packages: change glibc check to fts check
As per the previous patch, now that fts support can be checked, the selinux libraries and packages can check if the toolchain has fts support instead of explicitly requiring glibc.
--- package/checkpolicy/Config.in | 6 +++--- package/libselinux/Config.in | 8 ++++---- package/libsemanage/Config.in | 8 ++++---- package/policycoreutils/Config.in | 12 ++++++------ package/refpolicy/Config.in | 6 +++--- package/setools/Config.in | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-)
package/checkpolicy/Config.in +3 -3
@@ -2,7 +2,7 @@ config BR2_PACKAGE_CHECKPOLICY bool "checkpolicy" depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux depends on !BR2_STATIC_LIBS # libselinux - depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux + depends on BR2_TOOLCHAIN_HAS_FTS # libselinux depends on !BR2_arc # libselinux select BR2_PACKAGE_LIBSELINUX select BR2_PACKAGE_FLEX
@@ -15,7 +15,7 @@ config BR2_PACKAGE_CHECKPOLICY http://selinuxproject.org/page/Main_Page -comment "checkpolicy needs a glibc toolchain w/ threads, dynamic library" +comment "checkpolicy needs a toolchain w/ threads, dynamic library, fts" depends on !BR2_arc depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \ - !BR2_TOOLCHAIN_USES_GLIBC + !BR2_TOOLCHAIN_HAS_FTS
package/libselinux/Config.in +4 -4
@@ -2,8 +2,8 @@ config BR2_PACKAGE_LIBSELINUX bool "libselinux" depends on BR2_TOOLCHAIN_HAS_THREADS depends on !BR2_STATIC_LIBS - # Uses <fts.h>, not available in musl or uClibc - depends on BR2_TOOLCHAIN_USES_GLIBC + # Uses <fts.h>, not available in musl + depends on BR2_TOOLCHAIN_HAS_FTS # Toolchain issue: "fixup not contained within frag" depends on !BR2_arc select BR2_PACKAGE_LIBSEPOL
@@ -19,7 +19,7 @@ config BR2_PACKAGE_LIBSELINUX http://selinuxproject.org/page/Main_Page -comment "libselinux needs a glibc toolchain w/ threads, dynamic library" +comment "libselinux needs a toolchain w/ threads, dynamic library, fts" depends on !BR2_arc depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \ - !BR2_TOOLCHAIN_USES_GLIBC + !BR2_TOOLCHAIN_HAS_FTS
package/libsemanage/Config.in +4 -4
@@ -3,10 +3,10 @@ config BR2_PACKAGE_LIBSEMANAGE depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS depends on BR2_TOOLCHAIN_HAS_THREADS depends on !BR2_STATIC_LIBS - # - libselinux needs fts.h (not available in uClibc/musl) + # - libselinux needs fts.h (not available in musl) # - libsemanage itself needs getpwent_r() not available in musl # - audit is not available on musl - depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_TOOLCHAIN_HAS_FTS depends on !BR2_arc select BR2_PACKAGE_AUDIT select BR2_PACKAGE_LIBSELINUX
@@ -23,8 +23,8 @@ config BR2_PACKAGE_LIBSEMANAGE http://selinuxproject.org/page/Main_Page -comment "libsemanage needs a glibc toolchain w/ threads, dynamic library" +comment "libsemanage needs a toolchain w/ threads, dynamic library, fts" depends on !BR2_arc depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \ - !BR2_TOOLCHAIN_USES_GLIBC + !BR2_TOOLCHAIN_HAS_FTS
package/policycoreutils/Config.in +6 -6
@@ -1,7 +1,7 @@ -comment "policycoreutils needs a glibc toolchain w/ threads, dynamic library" +comment "policycoreutils needs a toolchain w/ threads, dynamic library, fts" depends on !BR2_arc depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS - depends on !BR2_TOOLCHAIN_USES_GLIBC || \ + depends on !BR2_TOOLCHAIN_HAS_FTS || \ !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS config BR2_PACKAGE_POLICYCOREUTILS
@@ -10,7 +10,7 @@ config BR2_PACKAGE_POLICYCOREUTILS depends on BR2_TOOLCHAIN_HAS_THREADS # libsemanage depends on !BR2_STATIC_LIBS #libsemanage depends on !BR2_arc # libsemanage - depends on BR2_TOOLCHAIN_USES_GLIBC # libsemanage + depends on BR2_TOOLCHAIN_HAS_FTS # libsemanage select BR2_PACKAGE_LIBSEMANAGE select BR2_PACKAGE_LIBCAP_NG help
@@ -51,7 +51,7 @@ config BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW depends on BR2_USE_MMU # python3, sepolgen depends on BR2_TOOLCHAIN_HAS_THREADS # python3, sepolgen, checkpolicy depends on !BR2_STATIC_LIBS # python3, sepolgen - depends on BR2_TOOLCHAIN_USES_GLIBC # checkpolicy + depends on BR2_TOOLCHAIN_HAS_FTS # checkpolicy depends on !BR2_arc # checkpolicy select BR2_PACKAGE_SEPOLGEN select BR2_PACKAGE_CHECKPOLICY
@@ -59,11 +59,11 @@ config BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW help Enable audit2allow to be built -comment "audit2allow needs a glibc toolchain w/ wchar, threads, dynamic library" +comment "audit2allow needs a toolchain w/ wchar, threads, dynamic library, fts" depends on BR2_USE_MMU depends on !BR2_arc depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \ - BR2_STATIC_LIBS + BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_FTS config BR2_PACKAGE_POLICYCOREUTILS_RESTORECOND bool "restorecond"
package/refpolicy/Config.in +3 -3
@@ -1,7 +1,7 @@ config BR2_PACKAGE_REFPOLICY bool "refpolicy" depends on BR2_TOOLCHAIN_HAS_THREADS # policycoreutils - depends on BR2_TOOLCHAIN_USES_GLIBC # policycoreutils + depends on BR2_TOOLCHAIN_HAS_FTS # policycoreutils depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS # policycoreutils depends on !BR2_STATIC_LIBS # policycoreutils depends on !BR2_arc # policycoreutils
@@ -28,11 +28,11 @@ config BR2_PACKAGE_REFPOLICY https://github.com/TresysTechnology/refpolicy -comment "refpolicy needs a glibc toolchain w/ threads, dynamic library" +comment "refpolicy needs a toolchain w/ threads, dynamic library, fts" depends on !BR2_arc depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \ - !BR2_TOOLCHAIN_USES_GLIBC + !BR2_TOOLCHAIN_HAS_FTS if BR2_PACKAGE_REFPOLICY
package/setools/Config.in +3 -3
@@ -4,7 +4,7 @@ config BR2_PACKAGE_SETOOLS depends on !BR2_STATIC_LIBS depends on BR2_INSTALL_LIBSTDCPP depends on BR2_USE_WCHAR - depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux + depends on BR2_TOOLCHAIN_HAS_FTS # libselinux # bfin: infamous _ symbol prefix issue # nios2: triggers some toolchain issue "No symbol version # section for versioned symbol"
@@ -29,8 +29,8 @@ config BR2_PACKAGE_SETOOLS https://github.com/TresysTechnology/setools3/wiki -comment "setools needs a glibc toolchain w/ threads, C++, wchar, dynamic library" +comment "setools needs a toolchain w/ threads, C++, wchar, dynamic library, fts" depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS \ || !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP \ - || !BR2_TOOLCHAIN_USES_GLIBC + || !BR2_TOOLCHAIN_HAS_FTS depends on !BR2_nios2 && !BR2_bfin && !BR2_arc
Signature · 1 line
2.9.4
PATCH 1/1 Add BR2_TOOLCHAIN_HAS_FTS config option
In reply to Adam DuskettHello,
Quoted 14 lines · Adam Duskett
Currently there are a few packages in buildroot that are set to not be selectable unless the user wishes to use glibc specifically because the package uses
fts.h.uClibc actually does have a fts implimentation, and it's selectable in uclib-menuconfig. However; this has two issues with it:
1) Most users wouldn't know that there is even a uClibc-menuconfig
2) Even if the user does select fts support in uClibc-menuconfig, the packages that would now compile and work would still not be selectable because they explicitly requireBR2_TOOLCHAIN_USES_GLIBC.This patch does the following:
Quoted 8 lines
- Create a
BR2_TOOLCHAIN_HAS_FTSconfiguration option in uclibc/Config.in and automatically set the kconfig during the configure stage.
- when glibc is selected,BR2_TOOLCHAIN_HAS_FTSis now selected.This will allow for packages that require glibc only because of
fts.hto now depend onBR2_TOOLCHAIN_HAS_FTSinstead ofBR2_TOOLCHAIN_USES_GLIBC.Signed-off-by Adam Duskett <[email protected]>
What is the size impact of enabling FTS by default in uClibc-ng ?
Adding such an option is more complicated. Here you're doing it for the internal toolchain backend. But then the external toolchain backend would need the same option, and check whether the toolchain really has FTS support, etc. It's not that simple to add new options for uClibc, so we try to avoid doing that.
What about instead migrating the SELinux stuff away from the BSD-style fts() interface to the POSIX compliant nftw() interface ?
It would IMO make a lot more sense.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 Add BR2_TOOLCHAIN_HAS_FTS config option
Hello;
Quoted 21 lines · Thomas Petazzoni
Hello,
Quoted 18 lines · Adam Duskett
Currently there are a few packages in buildroot that are set to not be selectable unless the user wishes to use glibc specifically because the package uses
fts.h.uClibc actually does have a fts implimentation, and it's selectable in uclib-menuconfig. However; this has two issues with it:
1) Most users wouldn't know that there is even a uClibc-menuconfig
2) Even if the user does select fts support in uClibc-menuconfig, the packages that would now compile and work would still not be selectable because they explicitly requireBR2_TOOLCHAIN_USES_GLIBC.This patch does the following:
- Create a
BR2_TOOLCHAIN_HAS_FTSconfiguration option in uclibc/Config.in and automatically set the kconfig during the configure stage.
- when glibc is selected,BR2_TOOLCHAIN_HAS_FTSis now selected.
Quoted 7 lines
Quoted 4 lines
This will allow for packages that require glibc only because of
fts.hto now depend onBR2_TOOLCHAIN_HAS_FTSinstead ofBR2_TOOLCHAIN_USES_GLIBC.Signed-off-by Adam Duskett <[email protected]>What is the size impact of enabling FTS by default in uClibc-ng ?
Around 7.5Kb. This might not be a bad way to go.
Quoted 11 lines
Adding such an option is more complicated. Here you're doing it for the internal toolchain backend. But then the external toolchain backend would need the same option, and check whether the toolchain really has FTS support, etc. It's not that simple to add new options for uClibc, so we try to avoid doing that.
What about instead migrating the SELinux stuff away from the BSD-style
fts()interface to the POSIX compliantnftw()interface ?It would IMO make a lot more sense.
I read your post on the mailing list, and I took a look at the libselinux code. It would not be trivial. Over 150 references, several functions would have to be completely rewritten, etc etc.
It seems like the SELinux developers are against doing it themselves, and I don't have the time to learn how to port fts reliant code to nftw, nor test it, and then submit an upstream patch. I would love to, but time is not on my side these days.
Quoted 7 lines
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Thanks!
Adam
PATCH 1/1 Add BR2_TOOLCHAIN_HAS_FTS config option
In reply to Adam DuskettHi,
Adam Duskett wrote,
Quoted 6 lines
Currently there are a few packages in buildroot that are set to not be selectable unless the user wishes to use glibc specifically because the package uses
fts.h.uClibc actually does have a fts implimentation, and it's selectable in uclib-menuconfig. However; this has two issues with it:
Can we just enable fts by default?
That was something I was going to suggest anyway :=) People requiring a really small uClibc-ng system, will use a custom uClibc-ng config.
We shouldn't add a new option, we already removed most of them.
best regards
Waldemar