package/busybox: add patch to silence build errors
PATCH 1/2 package/busybox: add patch to silence build errors
As part of pkg-kconfig, the .config file gets regenerated after fixups.
When Busybox is built with per-package directories enabled, the toolchain is not available for Busybox's makefile to determine compiler capabilities so certain calls will fail and emit errors.
For now, assume the following are true:
Buildroot will not use GCC < 4
Skip a call to cc-ifversion to avoid the following error
/buildroot/output/build/busybox-1.35.0/scripts/gcc-version.sh: line 11: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: No such file or directory
Target system is linux
Skip a call to -dumpmachine to avoid the following error
make[2]: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: Command not found
--- ...ags-assume-GCC-4-and-target-is-linux.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/busybox/0006-Makefile.flags-assume-GCC-4-and-target-is-linux.patch
package/busybox/0006-Makefile.flags-assume-GCC-4-and-target-is-linux.patch new file +50 -0
@@ -0,0 +1,50 @@ +From d384e999e1dff473f2bf084c6a9b9730ad39b878 Mon Sep 17 00:00:00 2001 +From: Vincent Fazio <[email protected]> +Date: Thu, 6 Oct 2022 13:16:34 -0500 +Subject: [PATCH] Makefile.flags: assume GCC >= 4 and target is linux + +As part of pkg-kconfig, the .config file gets regenerated after fixups. + +When Busybox is built with per-package directories enabled, the +toolchain is not available for Busybox's makefile to determine compiler +capabilities so certain calls will fail and emit errors. + +For now, assume the following are true: + +Buildroot will not use GCC < 4 + Skip a call to cc-ifversion to avoid the following error + + /buildroot/output/build/busybox-1.35.0/scripts/gcc-version.sh: line 11: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: No such file or directory + +Target system is linux + Skip a call to -dumpmachine to avoid the following error + + make[2]: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: Command not found + +Signed-off-by: Vincent Fazio <[email protected]> + +diff --git a/Makefile.flags b/Makefile.flags +index c34356230..274527954 100644 +--- a/Makefile.flags ++++ b/Makefile.flags +@@ -45,7 +45,7 @@ CFLAGS += $(call cc-option,-Werror,) + #CFLAGS += $(call cc-ifversion, -eq, 0404, -fno-strict-aliasing) + endif + # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() +-CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) ++CFLAGS += -Wold-style-definition + + ifneq ($(CC),clang) + # "clang-9: warning: optimization flag '-finline-limit=0' is not supported +@@ -184,7 +184,7 @@ LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=% + endif + + ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y) +-ifneq (,$(findstring linux,$(shell $(CC) $(CFLAGS) -dumpmachine))) ++ifneq (,$(findstring linux,linux)) + LDLIBS += resolv + endif + endif +-- +2.25.1 +
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/busybox: redirect errors to /dev/null
When busybox.mk gets read, pkg-conf gets executed to determine the location of relevant libraries.
When Busybox is built with per-package directories enabled, a number of errors related to executing pkg-conf occur because directories have not been synced to provide pkg-confg at the point when it executes.
These errors occur in stages prior configuring the package and are of little consequence so redirect the errors to /dev/null.
--- package/busybox/busybox.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/busybox/busybox.mk +2 -2
@@ -79,10 +79,10 @@ BUSYBOX_DEPENDENCIES = \ # support for NFS mounting with BusyBox ifeq ($(BR2_PACKAGE_LIBTIRPC),y) BUSYBOX_DEPENDENCIES += libtirpc host-pkgconf -BUSYBOX_CFLAGS += "`$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`" +BUSYBOX_CFLAGS += "`$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc 2>/dev/null`" # Don't use LDFLAGS for -ltirpc, because LDFLAGS is used for # the non-final link of modules as well. -BUSYBOX_CFLAGS_busybox += "`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`" +BUSYBOX_CFLAGS_busybox += "`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc 2>/dev/null`" endif # Allows the build system to tweak CFLAGS
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/busybox: redirect errors to /dev/null
Hello Vincent,
Quoted 6 lines · On Fri, 7 Oct 2022 18:50:02 -0500 Vincent Fazio <[email protected]> wrote:
When busybox.mk gets read, pkg-conf gets executed to determine the location of relevant libraries.
When Busybox is built with per-package directories enabled, a number of errors related to executing pkg-conf occur because directories have not been synced to provide pkg-confg at the point when it executes.
I don't get this. If pkg-config is executed before the per-package directories are created... then how can pkg-config find libtirpc?
I just did a build of the following configuration:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_LIBTIRPC=y
# BR2_TARGET_ROOTFS_TAR is not set
and I couldn't see the errors (but perhaps I missed them). Could you provide an example configuration, the details of the error, and a rationale as to why not finding libtirpc is not a problem when we in fact expect to find it?
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [External] - Re: [PATCH 2/2] package/busybox: redirect errors to /dev/null
Hey Tom,
Quoted 16 lines
-----Original Message-----
From: Thomas Petazzoni <[email protected]>
Sent: Tuesday, November 1, 2022 5:42 PM
To: Vincent Fazio <[email protected]>
Cc: [email protected]
Subject: [External] - Re: [Buildroot] [PATCH 2/2] package/busybox: redirect errors to/dev/nullHello Vincent,
Quoted 3 lines · On Fri, 7 Oct 2022 18:50:02 -0500 Vincent Fazio <[email protected]> wrote:
When busybox.mk gets read, pkg-conf gets executed to determine the location of relevant libraries.
Quoted 7 lines
Quoted 3 lines
When Busybox is built with per-package directories enabled, a number of errors related to executing pkg-conf occur because directories have not been synced to provide pkg-confg at the point when it executes.
I don't get this. If pkg-config is executed before the per-package directories are created... then how can pkg-config find libtirpc?
pkg-config gets executed multiple times because the commands that get built up to generate the config file looks like so:
(yes "" | PATH="/mnt/development/buildroot/output/per-package/busybox/host/bin:/mnt/development/buildroot/output/per-package/busybox/host/sbin:/home/vfazio/.pyenv/plugins/pyenv-virtualenv/shims:/home/vfazio/.pyenv/shims:/home/vfazio/.pyenv/bin:/home/vfazio/.local/bin:/home/vfazio/.asdf/shims:/home/vfazio/.asdf/bin:/home/vfazio/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/vfazio/.xes-python-apps/bin" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 "/mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config --cflags libtirpc"" CFLAGS_busybox="/mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config --libs libtirpc"" /usr/bin/remake -j7 -C /mnt/development/buildroot/output/build/busybox-1.35.0 HOSTCC="/usr/bin/gcc" AR="/mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc-ar" NM="/mnt/development/buildr
oot/output/per-package/busybox/host/bin/x86_64-linux-gcc-nm" RANLIB="/mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc-ranlib" CC="/mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc" ARCH=x86_64 PREFIX="/mnt/development/buildroot/output/per-package/busybox/target" EXTRA_LDFLAGS="" CROSS_COMPILE="/mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-" CONFIG_PREFIX="/mnt/development/buildroot/output/per-package/busybox/target" SKIP_STRIP=y oldconfig)
so they get executed prior to the directories being synced.
It works subsequently after sync because those paths are always reevaluated at runtime.
Quoted 14 lines
I just did a build of the following configuration:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_LIBTIRPC=y
#BR2_TARGET_ROOTFS_TARis not set
Quoted 4 lines
and I couldn't see the errors (but perhaps I missed them). Could you provide an example configuration, the details of the error, and a rationale as to why not finding libtirpc is not a problem when we in fact expect to find it?
My configure and build log:
for the pkg-config issues you should see:
/bin/bash: /mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config: No such file or directory /bin/bash: /mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config: No such file or directory /bin/bash: /mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config: No such file or directory /bin/bash: /mnt/development/buildroot/output/per-package/busybox/host/bin/pkg-config: No such file or directory
You'll also see other errors such as:
/mnt/development/buildroot/output/build/busybox-1.35.0/scripts/gcc-version.sh: line 11: /mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: No such file or directory make[2]: /mnt/development/buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: Command not found
but those are covered by the previous patch
Quoted 11 lines
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
- Vincent
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/busybox: redirect errors to /dev/null
In reply to Thomas Petazzoni via buildrootThomas, Vincent, All,
On 2022-11-01 23:41 +0100, Thomas Petazzoni via buildroot spake thusly:
Quoted 8 lines
Hello Vincent,
Quoted 3 lines · On Fri, 7 Oct 2022 18:50:02 -0500 Vincent Fazio <[email protected]> wrote:
When busybox.mk gets read, pkg-conf gets executed to determine the location of relevant libraries.
Quoted 6 lines
Quoted 3 lines
When Busybox is built with per-package directories enabled, a number of errors related to executing pkg-conf occur because directories have not been synced to provide pkg-confg at the point when it executes.
I don't get this. If pkg-config is executed before the per-package directories are created... then how can pkg-config find libtirpc?
We did look at this together with Vincent back then.
The issue is that pkg-config is called as part of BUSYBOX_CFLAGS and BUSYBOX_CFLAGS_busybox, which are part of BUSYBOX_MAKE_ENV, which will eventually be part of the environment when calling one of the kconfig frontends, like 'config' (when applying the configuration), or menuconfig et al.
At that time, only parts of the PPD have been gathered, and not the parts needed to configure and build, so host-pkgconf is not rsynced to the busybox PPD.
Then later on, when we do build, host-pkgconf is rsynced, so we do get the libtirpc CFLAGs and LDFLAGS, and the build does succeed.
It is quite difficult to follow all the trails. Idealy, we'd want to provide a proper rsynced PPD for configurators, maybe, but in this case, it is superfluous, and finding the right spot was... not trivial.
So, with Vincent, we concluded that:
- the error messages are benign
- but hey are confusing
- the simplest solution to get rid of them is to silence the call to pkg-config
[--SNIP--]
Quoted 4 lines
and I couldn't see the errors (but perhaps I missed them). Could you provide an example configuration, the details of the error, and a rationale as to why not finding libtirpc is not a problem when we in fact expect to find it?
BR2_x86_i686=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_I686_UCLIBC_BLEEDING_EDGE=y BR2_PACKAGE_LIBTIRPC=y
$ make clean
$ make busybox-menuconfig
>>> busybox 1.35.0 Patching
[...]
Applying 0005-nslookup-sanitize-all-printed-strings-with-printable.patch using patch:
patching file networking/nslookup.c
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory /bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory /bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory /bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory Using /home/ymorin/dev/buildroot/O/master/build/busybox-1.35.0/.config as base #
# merged configuration written to
# /home/ymorin/dev/buildroot/O/master/build/busybox-1.35.0/.config
# (needs make)
#
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory /bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
[...]
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 "/home/ymorin/dev/buildroot/O/master/host/bin/pkg-config --cflags libtirpc"" CFLAGS_busybox=""/home/ymorin/dev/buildroot/O/master/host/bin/pkg-config --libs libtirpc""
PKG_CONFIG_PATH="" /usr/bin/make
-j9 -C /home/ymorin/dev/buildroot/O/master/build/busybox-1.35.0
HOSTCC="/usr/bin/gcc"
AR="/home/ymorin/dev/buildroot/O/master/host/bin/i686-linux-gcc-ar" NM="/home/ymorin/dev/buildroot/O/master/host/bin/i686-linux-gcc-nm" RANLIB="/home/ymorin/dev/buildroot/O/master/host/bin/i686-linux-gcc-ranlib" CC="/home/ymorin/dev/buildroot/O/master/host/bin/i686-linux-gcc"
ARCH=i386
PREFIX="/home/ymorin/dev/buildroot/O/master/target"
EXTRA_LDFLAGS=""
CROSS_COMPILE="/home/ymorin/dev/buildroot/O/master/host/bin/i686-linux-" CONFIG_PREFIX="/home/ymorin/dev/buildroot/O/master/target"
SKIP_STRIP=y
menuconfig
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
/bin/sh: /home/ymorin/dev/buildroot/O/master/host/bin/pkg-config: No such file or directory
HOSTLD scripts/kconfig/mconf
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/lxdialog.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/msgbox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTLD scripts/kconfig/lxdialog/lxdialog
scripts/kconfig/mconf Config.in
And then again further one...
BTW, notice how CFLAGS are incorrectly quoted:
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 "`/home/ymorin/dev/buildroot/O/master/host/bin/pkg-config --cflags libtirpc`""
^---------------------------------------------------------------------------^That's because of:
20: BUSYBOX_CFLAGS = $(TARGET_CFLAGS)
82: BUSYBOX_CFLAGS += "`$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`"which are then passed as:
91: CFLAGS="$(BUSYBOX_CFLAGS)"
Vincent, could you come to fix that? ;-)
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/busybox: redirect errors to /dev/null
Quoted 11 lines · On Wed, 2 Nov 2022 22:53:55 +0100 "Yann E. MORIN" <[email protected]>…
We did look at this together with Vincent back then.
The issue is that pkg-config is called as part of
BUSYBOX_CFLAGSandBUSYBOX_CFLAGS_busybox, which are part ofBUSYBOX_MAKE_ENV, which will eventually be part of the environment when calling one of the kconfig frontends, like 'config' (when applying the configuration), or menuconfig et al.At that time, only parts of the PPD have been gathered, and not the parts needed to configure and build, so host-pkgconf is not rsynced to the busybox PPD.
But perhaps we should not pass those CFLAGS during the "configurator" step?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines · On Fri, 7 Oct 2022 18:50:01 -0500 Vincent Fazio <[email protected]> wrote:
As part of pkg-kconfig, the .config file gets regenerated after fixups.
When Busybox is built with per-package directories enabled, the toolchain is not available for Busybox's makefile to determine compiler capabilities so certain calls will fail and emit errors.
For now, assume the following are true:
Buildroot will not use GCC < 4
Skip a call to cc-ifversion to avoid the following error
Quoted 8 lines
/buildroot/output/build/busybox-1.35.0/scripts/gcc-version.sh: line 11: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: No such file or directory
Target system is linux
Skip a call to -dumpmachine to avoid the following errormake[2]: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: Command not found
Signed-off-by Vincent Fazio <[email protected]>
Hm, it's a bit annoying to patch Busybox for this, especially with a patch that most likely cannot be accepted upstream because it's really related to Buildroot details.
Do we have a better solution?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas, All,
On 2022-11-01 23:40 +0100, Thomas Petazzoni via buildroot spake thusly:
Quoted 21 lines
Quoted 18 lines · On Fri, 7 Oct 2022 18:50:01 -0500 Vincent Fazio <[email protected]> wrote:
As part of pkg-kconfig, the .config file gets regenerated after fixups.
When Busybox is built with per-package directories enabled, the toolchain is not available for Busybox's makefile to determine compiler capabilities so certain calls will fail and emit errors.
For now, assume the following are true:
Buildroot will not use GCC < 4
Skip a call to cc-ifversion to avoid the following error/buildroot/output/build/busybox-1.35.0/scripts/gcc-version.sh: line 11: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: No such file or directory
Target system is linux
Skip a call to -dumpmachine to avoid the following errormake[2]: /buildroot/output/per-package/busybox/host/bin/x86_64-linux-gcc: Command not found
Quoted 7 lines
Quoted 1 line
Signed-off-by Vincent Fazio <[email protected]>Hm, it's a bit annoying to patch Busybox for this, especially with a patch that most likely cannot be accepted upstream because it's really related to Buildroot details.
Do we have a better solution?
Yes: we should be relatively confident that we can convince busybox that they wil never be built against a gcc < 4 nowadays, no?
scripts/gcc-version.sh is used to get the gcc version. This is in turn used to test whether gcc >= 4.00, in which case -Wold-style-definition is added to CFLAGS.
That is is only one case where this is needed. gcc 4.0.0 was release in 2005-04-20, 17+ years ago now. This is probably the oldest gcc version one may reasnably expect to compile current code aganst. nowadays...
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot