On Tue, 2026-09-22 at 11:23 +0200, Markus Volk wrote:
> ExtUtils::MakeMaker makes the generated Makefile depend on Config.pm and
> config.h from the perl it was configured against. do_prepare_recipe_sysroot
> stages those files fresh on every run, so their mtime can end up newer than
> a Makefile written by a do_configure that is still valid. make then
> regenerates the Makefile, prints "Please rerun the make command" and exits
> non-zero, which fails do_compile or do_install. Run make a second time in
> that case, which is what MakeMaker asks for; a run that fails for any other
> reason fails again. Also drop a stale Makefile before Makefile.PL runs, so
> a configure in a used work directory does not start from old settings.
> 
> Reproduced with liburi-perl by touching Config.pm and config.h in the
> recipe sysroot and forcing do_install: it failed before the change and
> succeeds after it.
> 
> AI-Generated: Uses Claude Code (Claude Opus 5)
> Signed-off-by: Markus Volk <[email protected]>

Hi Markus,

The commit summary here is an excellent example of Claudish. I'm not
really sure what it means... It could do with re-writing.

> ---
>  meta/classes-recipe/cpan.bbclass | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes-recipe/cpan.bbclass 
> b/meta/classes-recipe/cpan.bbclass
> index dbf44da9d2..0f7384786f 100644
> --- a/meta/classes-recipe/cpan.bbclass
> +++ b/meta/classes-recipe/cpan.bbclass
> @@ -23,6 +23,10 @@ export PERLHOSTLIB = 
> "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/"
>  export PERLHOSTARCHLIB = 
> "${STAGING_LIBDIR_NATIVE}/perl5/${@get_perl_version(d)}/${@get_perl_hostarch(d)}/"
>  
>  cpan_do_configure () {
> +     # A Makefile left behind by an earlier configure run would be used with 
> the
> +     # settings it was generated with, so start from the Makefile.PL every 
> time.
> +     rm -f Makefile

I'm not really familiar with cpan packages - are we sure that none
include a Makefile?

> +
>       yes '' | perl ${EXTRA_PERLFLAGS} Makefile.PL INSTALLDIRS=vendor 
> NO_PERLLOCAL=1 NO_PACKLIST=1 PERL=$(which perl) ${EXTRA_CPANFLAGS}
>  
>       # Makefile.PLs can exit with success without generating a
> @@ -57,12 +61,17 @@ do_configure:append:class-nativesdk() {
>             -e 's:LD_RUN_PATH ?= ?"?[^"]*"?::g'
>  }
>  
> +# ExtUtils::MakeMaker regenerates the Makefile when the staged perl has 
> become
> +# newer than it, and then exits asking for make to be rerun. Do that instead 
> of
> +# failing the task; a run that fails for any other reason fails again.
>  cpan_do_compile () {
> -     oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"
> +     oe_runmake_call PASTHRU_INC="${CFLAGS}" LD="${CCLD}" || \
> +             oe_runmake PASTHRU_INC="${CFLAGS}" LD="${CCLD}"

Are we sure this won't mask other issues? The staged perl becoming newer
than the generated Makefile should be a rare occurance, perhaps we can
check for that before calling make and handle it explicitly?

>  }
>  
>  cpan_do_install () {
> -     oe_runmake DESTDIR="${D}" install_vendor
> +     oe_runmake_call DESTDIR="${D}" install_vendor || \
> +             oe_runmake DESTDIR="${D}" install_vendor

We don't want surprise rebuilds during do_install.

>       for PERLSCRIPT in `grep -rIEl '#! *${bindir}/perl-native.*/perl' ${D}`; 
> do
>               sed -i -e 's|${bindir}/perl-native.*/perl|/usr/bin/env 
> nativeperl|' $PERLSCRIPT
>       done

Best regards,

-- 
Paul Barker

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246637): 
https://lists.openembedded.org/g/openembedded-core/message/246637
Mute This Topic: https://lists.openembedded.org/mt/121371712/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to