diff mbox series

scons: Pass MAXLINELENGTH to scons invocation

Message ID 20230130050342.130715-1-raj.khem@gmail.com
State Accepted, archived
Commit 29558f6218f4676b459f2c78f82d245339d51c8c
Headers show
Series scons: Pass MAXLINELENGTH to scons invocation | expand

Commit Message

Khem Raj Jan. 30, 2023, 5:03 a.m. UTC
This helps in overcoming a problem when using scons with ccache enabled.
When commands get longer, then it resorts to using response files to do
the operations e.g. @/tmp/tmp96j6icra.lnk when this response file is
inboked by compiler it works ok, however, this does not when ccache is
used to invoke the complilation. We see errors e.g.

ccache @/tmp/tmppsyij_0v.lnk
ccache: error: execute_noreturn of @/tmp/tmppsyij_0v.lnk failed: No such file or directory

Using MAXLINELENGTH setting ensures that we can use ARG_MAX to extend
the length of commandline and hence avoid using response files. This
issue is also reported in mongodb [1]

[1] https://jira.mongodb.org/browse/SERVER-38389

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes-recipe/scons.bbclass | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Martin Jansa Feb. 2, 2023, 8:11 a.m. UTC | #1
Can we pass this through some variable (maybe even as default
EXTRA_OESCONS)?

Some recipes seem to use older scons which don't support this and fail with:
Unknown variables: MAXLINELENGTH
ERROR: scons build execution failed.

I've seen this with arm-compute-library-22.08

On Mon, Jan 30, 2023 at 6:03 AM Khem Raj <raj.khem@gmail.com> wrote:

> This helps in overcoming a problem when using scons with ccache enabled.
> When commands get longer, then it resorts to using response files to do
> the operations e.g. @/tmp/tmp96j6icra.lnk when this response file is
> inboked by compiler it works ok, however, this does not when ccache is
> used to invoke the complilation. We see errors e.g.
>
> ccache @/tmp/tmppsyij_0v.lnk
> ccache: error: execute_noreturn of @/tmp/tmppsyij_0v.lnk failed: No such
> file or directory
>
> Using MAXLINELENGTH setting ensures that we can use ARG_MAX to extend
> the length of commandline and hence avoid using response files. This
> issue is also reported in mongodb [1]
>
> [1] https://jira.mongodb.org/browse/SERVER-38389
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes-recipe/scons.bbclass | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes-recipe/scons.bbclass
> b/meta/classes-recipe/scons.bbclass
> index 5f0d4a910b..d510c12b9b 100644
> --- a/meta/classes-recipe/scons.bbclass
> +++ b/meta/classes-recipe/scons.bbclass
> @@ -9,11 +9,12 @@ inherit python3native
>  DEPENDS += "python3-scons-native"
>
>  EXTRA_OESCONS ?= ""
> -
> +# This value below is derived from $(getconf ARG_MAX)
> +SCONS_MAXLINELENGTH ?= "2097152"
>  do_configure() {
>         if [ -n "${CONFIGURESTAMPFILE}" -a "${S}" = "${B}" ]; then
>                 if [ -e "${CONFIGURESTAMPFILE}" -a "`cat
> ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ];
> then
> -                       ${STAGING_BINDIR_NATIVE}/scons --directory=${S}
> --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
> +                       ${STAGING_BINDIR_NATIVE}/scons --directory=${S}
> --clean PREFIX=${prefix} MAXLINELENGTH=${SCONS_MAXLINELENGTH}
> prefix=${prefix} ${EXTRA_OESCONS}
>                 fi
>
>                 mkdir -p `dirname ${CONFIGURESTAMPFILE}`
> @@ -22,13 +23,17 @@ do_configure() {
>  }
>
>  scons_do_compile() {
> -       ${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE}
> PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
> +       ${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE}
> PREFIX=${prefix} prefix=${prefix} MAXLINELENGTH=${SCONS_MAXLINELENGTH}
> ${EXTRA_OESCONS} || \
>         die "scons build execution failed."
>  }
>
>  scons_do_install() {
> -       ${STAGING_BINDIR_NATIVE}/scons --directory=${S}
> install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix}
> ${EXTRA_OESCONS} install || \
> +       ${STAGING_BINDIR_NATIVE}/scons --directory=${S}
> install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix}
> MAXLINELENGTH=${SCONS_MAXLINELENGTH} ${EXTRA_OESCONS} install || \
>         die "scons install execution failed."
>  }
>
> +do_configure[vardepsexclude] = "SCONS_MAXLINELENGTH"
> +do_compile[vardepsexclude] = "SCONS_MAXLINELENGTH"
> +do_install[vardepsexclude] = "SCONS_MAXLINELENGTH"
> +
>  EXPORT_FUNCTIONS do_compile do_install
> --
> 2.39.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#176479):
> https://lists.openembedded.org/g/openembedded-core/message/176479
> Mute This Topic: https://lists.openembedded.org/mt/96622121/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> Martin.Jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/scons.bbclass b/meta/classes-recipe/scons.bbclass
index 5f0d4a910b..d510c12b9b 100644
--- a/meta/classes-recipe/scons.bbclass
+++ b/meta/classes-recipe/scons.bbclass
@@ -9,11 +9,12 @@  inherit python3native
 DEPENDS += "python3-scons-native"
 
 EXTRA_OESCONS ?= ""
-
+# This value below is derived from $(getconf ARG_MAX)
+SCONS_MAXLINELENGTH ?= "2097152"
 do_configure() {
 	if [ -n "${CONFIGURESTAMPFILE}" -a "${S}" = "${B}" ]; then
 		if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
-			${STAGING_BINDIR_NATIVE}/scons --directory=${S} --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
+			${STAGING_BINDIR_NATIVE}/scons --directory=${S} --clean PREFIX=${prefix} MAXLINELENGTH=${SCONS_MAXLINELENGTH} prefix=${prefix} ${EXTRA_OESCONS}
 		fi
 
 		mkdir -p `dirname ${CONFIGURESTAMPFILE}`
@@ -22,13 +23,17 @@  do_configure() {
 }
 
 scons_do_compile() {
-	${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
+	${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} MAXLINELENGTH=${SCONS_MAXLINELENGTH} ${EXTRA_OESCONS} || \
 	die "scons build execution failed."
 }
 
 scons_do_install() {
-	${STAGING_BINDIR_NATIVE}/scons --directory=${S} install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
+	${STAGING_BINDIR_NATIVE}/scons --directory=${S} install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} MAXLINELENGTH=${SCONS_MAXLINELENGTH} ${EXTRA_OESCONS} install || \
 	die "scons install execution failed."
 }
 
+do_configure[vardepsexclude] = "SCONS_MAXLINELENGTH"
+do_compile[vardepsexclude] = "SCONS_MAXLINELENGTH"
+do_install[vardepsexclude] = "SCONS_MAXLINELENGTH"
+
 EXPORT_FUNCTIONS do_compile do_install