public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Yang Xu (徐扬)" <Yang.Xu@mediatek.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Cc: "alex.kanavin@gmail.com" <alex.kanavin@gmail.com>
Subject: Re: [PATCH v3] openssl: set package level PERL5LIB
Date: Tue, 25 Apr 2023 06:04:34 +0000	[thread overview]
Message-ID: <380e6b364ca282645ec2e5102e1550767f8966d0.camel@mediatek.com> (raw)
In-Reply-To: <20230421033801.28653-1-yang.xu@mediatek.com>

Dear Sirs,

Sorry, please NOT accept this patch because I found it will break its
own sstate cache.

I will found other solution for this openssl/perl co-work issue.

On Fri, 2023-04-21 at 03:38 +0000, yang.xu@mediatek.com wrote:
> From: Yang Xu <yang.xu@mediatek.com>
> 
> Build openssl with shared state cache may meet problem under below
> conditions:
> 1. sstate cache generated by another user on same machine
> 2. inappropriate PERL5LIB setting
> 3. openssl build from scratch but perl using cache
> 
> When build openssl from scratch with perl using cache, it will be
> aborted at do_configure stage,
> error message is like "Can't locate Text/Template.pm at
> /home/A/[build path]/[perl module path]/Text/Template.pm : Permission
> Denied".
> 
> The simplified environment and scenarios is:
> 1) User A, his home directory is /home/A, generate one sstate cache
> under /home/A.
> 2) This sstate cache moved to /home/Public, act as shared sstate
> cache
> 3) User B, his home directory is /home/B, using sstate cache in
> /home/Public and build yocto.
> 4) User B has no permission to access /home/A.
> 
> Some information about perl behavior:
> 1. perl will hardcode buildtime path in @INC in binary (module search
> directories)
> 2. when "use MODULE", perl will search @INC from begin to end until
> it found MODULE.
> 3. when perl search module through directories in @INC
>      3.1 if [directory]/MODULE.pm is not exist, search in next
> directory in @INC.
>      3.2 if [directory]/MODULE.pm has no permission to access, perl
> will ABORT.
> 
> While build openssl from from scratch with perl using cache, @INC
> directory order is:
> 1.<PERL5LIB>
> 2.<default module path in ${WORKDIR}/recipe-sysroot-native>
> 3.<hardcode module path in binary, which include /home/A/XXX/YYY>
> 4.<module found by FindBin, module Text-Template can be found by it>
> 
> Without appropriate PERL5LIB setting, perl can't find
> Text/Template.pm in
> <PERL5LIB>, and it also can't find it in <default module path>.
> 
> Then perl search Text/Template.pm in <hardcode module path in
> binary>,
> *if /home/A is not existed, perl will search in <module found by
> FindBin> and found Text/Template.pm finally. (OK case)
> *if /home/A is existed but has no permission access, perl will ABORT
> immediately. (NG case)
> 
> So this patch does some fixup for NG case:
> 1) set appropriate PERL5LIB to make perl can found Text/Tempalte.pm
> at highest priority folder <PERL5LIB>.
> 2) add other perl module directories needed by openssl build in
> PERL5LIB
> 3) set PERL5LIB as package environment variable
> 
> Signed-off-by: Yang Xu <yang.xu@mediatek.com>
> ---
>  meta/recipes-connectivity/openssl/openssl_3.1.0.bb | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-connectivity/openssl/openssl_3.1.0.bb
> b/meta/recipes-connectivity/openssl/openssl_3.1.0.bb
> index b319c66044..613451f265 100644
> --- a/meta/recipes-connectivity/openssl/openssl_3.1.0.bb
> +++ b/meta/recipes-connectivity/openssl/openssl_3.1.0.bb
> @@ -54,6 +54,10 @@ CFLAGS:append:class-nativesdk = "
> -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/bu
>  # The default is to trust upstream choices.
>  DEPRECATED_CRYPTO_FLAGS ?= ""
>  
> +# Set package level PERL5LIB
> +PERL5LIB = "${S}/external/perl/Text-Template-
> 1.56/lib/:${S}/crypto/perlasm"
> +export PERL5LIB
> +
>  do_configure () {
>  	# When we upgrade glibc but not uninative we see obtuse
> failures in openssl. Make
>  	# the issue really clear that perl isn't functional due to
> symbol mismatch issues.
> @@ -138,7 +142,7 @@ do_configure () {
>  	fi
>  	# WARNING: do not set compiler/linker flags (-I/-D etc.) in
> EXTRA_OECONF, as they will fully replace the
>  	# environment variables set by bitbake. Adjust the environment
> variables instead.
> -	HASHBANGPERL="/usr/bin/env perl" PERL=perl
> PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
> +	HASHBANGPERL="/usr/bin/env perl" PERL=perl \
>  	perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS}
> ${DEPRECATED_CRYPTO_FLAGS} --prefix=$useprefix --
> openssldir=${libdir}/ssl-3 --libdir=${libdir} $target
>  	perl ${B}/configdata.pm --dump
>  }

      reply	other threads:[~2023-04-25  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  3:38 [PATCH v3] openssl: set package level PERL5LIB yang.xu
2023-04-25  6:04 ` Yang Xu (徐扬) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=380e6b364ca282645ec2e5102e1550767f8966d0.camel@mediatek.com \
    --to=yang.xu@mediatek.com \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox