<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15586</bug_id>
          
          <creation_ts>2024-09-04 07:12:13 +0000</creation_ts>
          <short_desc>meson.cross file missing from SDKs installed without sudo</short_desc>
          <delta_ts>2024-10-12 01:49:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Toni Lammi">toni.lammi</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99606</commentid>
    <comment_count>0</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2024-09-04 07:12:13 +0000</bug_when>
    <thetext>Meson&apos;s cross files are not placed in the SDK if the SDK is extracted to a path
that does not require sudo.

This can be easily reproduced by installing
https://downloads.yoctoproject.org/releases/yocto/yocto-5.0.3/toolchain/x86_64/poky-glibc-x86_64-core-image-sato-core2-32-qemux86-toolchain-5.0.3.sh
to two different paths where one requires root permissions for installation
and the other one does not, e.g. /foo and ~/.local/foo.
This can be verified with &quot;find &lt;path&gt;/sysroots -name *.cross 2&gt;/dev/null&quot;.

I replicated this with kirkstone with both poky and a custom distro
and with scarthgap with the above toolchain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99618</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-09-05 15:26:53 +0000</bug_when>
    <thetext>Toni, 

Thanks for the fairly detailed report. It&apos;s good to see people listing the branch used! ;-)

It seems odd and certainly there shouldn&apos;t be anything in the SDK that changes if run under sudo. If there is, it&apos;s a regression.

Can you document what your host distro is, in case that&apos;s something unusual or important. I know that Fedora 40 has some interesting new security policies for example.

Qi, 

Can you please test / debug this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99619</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2024-09-06 02:21:55 +0000</bug_when>
    <thetext>(In reply to Randy MacLeod from comment #1)
&gt; Toni, 
&gt; 
&gt; Thanks for the fairly detailed report. It&apos;s good to see people listing the
&gt; branch used! ;-)
&gt; 
&gt; It seems odd and certainly there shouldn&apos;t be anything in the SDK that
&gt; changes if run under sudo. If there is, it&apos;s a regression.
&gt; 
&gt; Can you document what your host distro is, in case that&apos;s something unusual
&gt; or important. I know that Fedora 40 has some interesting new security
&gt; policies for example.
&gt; 
&gt; Qi, 
&gt; 
&gt; Can you please test / debug this issue?

I can do it in October if there&apos;s nobody else looking into this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99620</commentid>
    <comment_count>3</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2024-09-06 04:32:31 +0000</bug_when>
    <thetext>&gt; Can you document what your host distro is, in case that&apos;s something
&gt; unusual or important. I know that Fedora 40 has some interesting
&gt; new security policies for example.

The host distro is Manjaro Linux.

I reran the installer within a Ubuntu 22.04 container and the cross file is where it should.

I guess this is not an issue then since Manjaro is not a supported distro? Though I&apos;m wondering if this will bite the supported distros later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99626</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-09-09 14:38:57 +0000</bug_when>
    <thetext>Thanks Qi.

Toni, I&apos;ve lowered the importance of the defect to medium since 
it seems to only be happening on an unsupported distro. 
We&apos;ll see what Qi finds out when he works on this in a few weeks. 

I&apos;m also concerned that we&apos;ll eventually encounter this problem on 
a future supported distro so investigating and fixing the issue and 
adding a test case that compares set of files installed with and 
without sudo seems like a good idea to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99791</commentid>
    <comment_count>5</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2024-10-09 02:29:49 +0000</bug_when>
    <thetext>(In reply to Toni Lammi from comment #3)
&gt; &gt; Can you document what your host distro is, in case that&apos;s something
&gt; &gt; unusual or important. I know that Fedora 40 has some interesting
&gt; &gt; new security policies for example.
&gt; 
&gt; The host distro is Manjaro Linux.
&gt; 
&gt; I reran the installer within a Ubuntu 22.04 container and the cross file is
&gt; where it should.
&gt; 
&gt; I guess this is not an issue then since Manjaro is not a supported distro?
&gt; Though I&apos;m wondering if this will bite the supported distros later.

Hi Toni,

If you still have the environment, you can check if meson-setup.py is under post-relocate-setup.d/ directory. The cross files should be setup by this script. Maybe you can run this script manually to see if things work.

Regards,
Qi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99792</commentid>
    <comment_count>6</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2024-10-09 04:46:36 +0000</bug_when>
    <thetext>&gt; If you still have the environment, you can check if meson-setup.py is under 
&gt; post-relocate-setup.d/ directory. The cross files should be setup by this
&gt; script. Maybe you can run this script manually to see if things work.

That fixes the issue. I also found the real cause for this when testing this.

The reason for missing meson.cross is that my user account has LD_LIBRARY_PATH set. This results in print

```
=================================================
You are about to install the SDK to &quot;/home/user/sdk-test&quot;. Proceed [Y/n]? Y
Extracting SDK.............................................................................................done
Setting it up...done
Your environment is misconfigured, you probably need to &apos;unset LD_LIBRARY_PATH&apos;
but please check why this was set in the first place and that it&apos;s safe to unset.
The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set.
For more references see:
  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
  http://xahlee.info/UnixResource_dir/_/ldpath.html
/home/user/sdk-test/post-relocate-setup.sh: Failed to source /home/user/sdk-test/environment-setup-armv8a-&lt;distro&gt; with status 1
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/user/sdk-test/environment-setup-armv8a-&lt;distro&gt;
```

I wonder if the error here could be a bit clearer? At least the first time I missed the whole message. Also the script exits with 0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99793</commentid>
    <comment_count>7</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2024-10-09 08:58:59 +0000</bug_when>
    <thetext>(In reply to Toni Lammi from comment #6)
&gt; &gt; If you still have the environment, you can check if meson-setup.py is under 
&gt; &gt; post-relocate-setup.d/ directory. The cross files should be setup by this
&gt; &gt; script. Maybe you can run this script manually to see if things work.
&gt; 
&gt; That fixes the issue. I also found the real cause for this when testing this.
&gt; 
&gt; The reason for missing meson.cross is that my user account has
&gt; LD_LIBRARY_PATH set. This results in print
&gt; 
&gt; ```
&gt; =================================================
&gt; You are about to install the SDK to &quot;/home/user/sdk-test&quot;. Proceed [Y/n]? Y
&gt; Extracting
&gt; SDK..........................................................................
&gt; ...................done
&gt; Setting it up...done
&gt; Your environment is misconfigured, you probably need to &apos;unset
&gt; LD_LIBRARY_PATH&apos;
&gt; but please check why this was set in the first place and that it&apos;s safe to
&gt; unset.
&gt; The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set.
&gt; For more references see:
&gt;   http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
&gt;   http://xahlee.info/UnixResource_dir/_/ldpath.html
&gt; /home/user/sdk-test/post-relocate-setup.sh: Failed to source
&gt; /home/user/sdk-test/environment-setup-armv8a-&lt;distro&gt; with status 1
&gt; SDK has been successfully set up and is ready to be used.
&gt; Each time you wish to use the SDK in a new shell session, you need to source
&gt; the environment setup script e.g.
&gt;  $ . /home/user/sdk-test/environment-setup-armv8a-&lt;distro&gt;
&gt; ```
&gt; 
&gt; I wonder if the error here could be a bit clearer? At least the first time I
&gt; missed the whole message. Also the script exits with 0.

Got it. Thanks for the detailed info.
I&apos;ve sent out a patch to oe-core.
https://lists.openembedded.org/g/openembedded-core/message/205342</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99847</commentid>
    <comment_count>8</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2024-10-12 01:48:36 +0000</bug_when>
    <thetext>Merged:

commit a24875260426249ead98b4ea3a1566b45f929905
Author: Chen Qi &lt;Qi.Chen@windriver.com&gt;
Date:   Wed Oct 9 01:56:47 2024 -0700

    toolchain-shar-extract.sh: exit when post-relocate-setup.sh fails
    
    When LD_LIBRARY_PATH is set, post-relocate-setup.sh will fail and
    exit properly. But such failure is ignored and the SDK installation
    will continue and tell user that things succeed. This is misleading.
    So exit immediately if post-relocate-setup.sh fails.
    
    Fixes [Yocto #15586]
    
    (From OE-Core rev: c8e2dcc1f71aa33cc6e56dfdebebbe7ef010c944)
    
    Signed-off-by: Chen Qi &lt;Qi.Chen@windriver.com&gt;
    Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99848</commentid>
    <comment_count>9</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2024-10-12 01:49:08 +0000</bug_when>
    <thetext>Issue resolved.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>