public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: "Kuber, Esteban" <ekuber@amazon.com>,
	Randy MacLeod <randy.macleod@windriver.com>,
	Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Cc: "steven@stevenwalter.org" <steven@stevenwalter.org>,
	 "johan.anderholm@gmail.com" <johan.anderholm@gmail.com>,
	"derek@asterius.io" <derek@asterius.io>,
	 "cardoe@cardoe.com" <cardoe@cardoe.com>,
	"dev@codyps.com" <dev@codyps.com>,
	"tylerwhall@gmail.com" <tylerwhall@gmail.com>,
	Khem Raj <raj.khem@gmail.com>,
	 "vinay.kumar@blackfigtech.com" <vinay.kumar@blackfigtech.com>,
	"saul.wold@windriver.com" <saul.wold@windriver.com>,
	"martin.jansa@gmail.com" <martin.jansa@gmail.com>,
	 "paul@pbarker.dev" <paul@pbarker.dev>,
	Trevor Gamblin <trevor.gamblin@windriver.com>,
	 "anbelski@linux.microsoft.com" <anbelski@linux.microsoft.com>,
	Vinay Kumar <vinay.m.engg@gmail.com>,
	 Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"Orling, Timothy T" <timothy.t.orling@intel.com>,
	"Elberger, Richard" <elberger@amazon.com>
Subject: Re: [OE-core] [v4] [RFC] Merge meta-rust to oe-core - Aug 19 update
Date: Wed, 01 Sep 2021 10:15:02 +0100	[thread overview]
Message-ID: <06e6b6542cb7097e7da11338a43073ca8f2e89d8.camel@linuxfoundation.org> (raw)
In-Reply-To: <16A0A6483A22DE64.7229@lists.openembedded.org>

On Wed, 2021-09-01 at 09:44 +0100, Richard Purdie via lists.openembedded.org
wrote:
> Hi Esteban,
> 
> On Fri, 2021-08-27 at 15:18 +0000, Kuber, Esteban wrote:
> > On 2021/8/27, 2:03 AM, "Richard Purdie" <richard.purdie@linuxfoundation.org> wrote:
> >     > and:
> >     >
> >     > 2. a reproducible build failure on CentOS-7:
> >     >
> >     >     https://autobuilder.yoctoproject.org/typhoon/#/builders/115/builds/597
> >     >
> >     > where, we see:
> >     >     = note: /bin/sh: /lib64/libc.so.6: version `GLIBC_2.33' \
> >     >     not found (required by \
> >     >     /home/pokybuild/yocto-worker/reproducible-centos/build/\
> >     >     build-st/reproducibleB/tmp/work/x86_64-linux/cargo-native/\
> >     >     1.54.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so.5)
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >     error: linking with `\
> >     >     /home/pokybuild/yocto-worker/reproducible-centos/build/\
> >     >     build-st/reproducibleB/tmp/work/x86_64-linux/cargo-native/\
> >     >     1.54.0-r0/wrapper/target-rust-ccld` failed: exit status: 1
> >    
> > 
> >     I had a quick look at this. It reproduces if you build cargo-native on a centos7
> >     machine with our M2 buildtools tarball in the environment of the build.
> > 
> >     Adding the uninative relocation hack to the cargo snapshot binary with:
> > 
> >      do_cargo_setup_snapshot () {
> >             ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
> >     +       # Need to use uninative's loader if enabled/present since the library paths
> >     +       # are used internally by rust and result in symbol mismatches if we don't
> >     +       if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
> >     +               patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER}
> >     +       fi
> >      }
> > 
> >     didn't help.
> > 
> >     Running the command it mentions failing by hand in the same toolchain enabled
> >     shell works. It therefore seems likely that something rust is putting into the
> >     environment is breaking things. What that is, I don't know, I'm out of time to
> >     debug further.
> > 
> > I'm looking at what that could be. If I can't give you the actual list (from the
> > code), I can give you a patch to print out to stderr *everything* that rustc is
> > setting during builds. We currently have a `-v` verbose  flag in cargo that
> > gives out the full command with wich rustc in invoked, but as you say, the
> > problem is likely the environment variables at play.
> 
> With some further debugging as I mentioned in my other reply, it is the
> LD_LIBRARY_PATH setting which is confusing things. Probably as a result of:
> 
> https://doc.rust-lang.org/cargo/reference/environment-variables.html#dynamic-library-paths
> 
> >     It looks to me like it is using the ld from the host instead of the buildtools
> >     tarball. I did change tmp/work/x86_64-linux/cargo-native/1.54.0-
> >     r0/wrapper/target-rust-ccld to a full path to gcc and messed with PATH to ensure
> >     it would find "our" ld first but that didn't help.
> > 
> > This is making me wonder, could it be that we are defaulting to a linker that is
> > not supplied in the buildtools tar.gz? That would explain why it ends up picking
> > up the system's even when changing the $PATH.
> 
> It is a bit more subtle than that. The ccld script has /bin/sh as the
> interpreter which uses the host libc and host libtinfo. The LD_LIBRARY_PATH
> injected by cargo causes it to find the libtinfo in the recipe-sysroot-native
> which is incompatible with it and things then fail :(.
> 
> > 
> >     In the error output is some:
> > 
> >     Usage: which [options] [--] COMMAND [...]
> >     Write the full path of COMMAND(s) to standard output.
> > 
> >     suggesting some which call might not be compatible with centos7?
> > 
> >     Cheers,
> > 
> >     Richard
> > 
> > One clarification I would like to have is, is this the *first* time you are 
> > trying to build rustc in this configuration, or is this a *recent* problem 
> > introduced in 1.54? Just want to make sure that my understanding that we are 
> > dealing with the former is correct.
> 
> This is the first time we've tried this as far as I know.
> 
> It is a horrible mix of different host tools and libcs from uninative,
> buildtools and the host all conflicting when LD_LIBRARY_PATH is set :(.
> 
> I'm not sure how to go about resolving this.

I noticed some code in cargo. I think the code is where the sysroot path is
injected. Since rust figures out its own paths to everything it is a little
surprising this is needed and the comment suggests the author had similar
thoughts. I therefore tried the following patch:

Index: cargo/src/cargo/core/compiler/compilation.rs
===================================================================
--- cargo.orig/src/cargo/core/compiler/compilation.rs
+++ cargo/src/cargo/core/compiler/compilation.rs
@@ -273,13 +273,6 @@ impl<'cfg> Compilation<'cfg> {
             ));
             search_path.push(self.deps_output[&kind].clone());
             search_path.push(self.root_output[&kind].clone());
-            // For build-std, we don't want to accidentally pull in any shared
-            // libs from the sysroot that ships with rustc. This may not be
-            // required (at least I cannot craft a situation where it
-            // matters), but is here to be safe.
-            if self.config.cli_unstable().build_std.is_none() {
-                search_path.push(self.sysroot_target_libdir[&kind].clone());
-            }
         }
 
         let dylib_path = paths::dylib_path();

however since I think we're running a prebuilt binary rather than the one we're
building, this does work. I'm therefore not sure how we can fix this. Is this
code something upstream might consider removing?

Cheers,

Richard



  parent reply	other threads:[~2021-09-01  9:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  0:22 [v3] [RFC] Merge meta-rust to oe-core Randy MacLeod
2021-08-11 13:14 ` Randy MacLeod
2021-08-11 15:18   ` Randy MacLeod
2021-08-13 15:19   ` [OE-core] [v4] " Vinay Kumar
2021-08-13 15:22     ` Vinay Kumar
2021-08-17 14:52       ` Randy MacLeod
     [not found]       ` <169C1FA457B99CA0.23238@lists.openembedded.org>
2021-08-20 10:06         ` [OE-core] [v4] [RFC] Merge meta-rust to oe-core - Aug 19 update Randy MacLeod
2021-08-21  2:48           ` Randy MacLeod
2021-08-21  8:46             ` Richard Purdie
     [not found]           ` <169D3274AAECC435.19323@lists.openembedded.org>
2021-08-22  3:12             ` Randy MacLeod
2021-08-22 11:19               ` Richard Purdie
2021-08-22 12:45                 ` Randy MacLeod
2021-08-23  9:21                   ` Richard Purdie
2021-08-24 16:48                     ` Randy MacLeod
     [not found]                     ` <169E4C0C80951608.1595@lists.openembedded.org>
2021-08-27  4:05                       ` Randy MacLeod
2021-08-27  9:03                         ` Richard Purdie
     [not found]                           ` <7A95231E-0879-46D6-8653-85338E9BDDFA@amazon.com>
2021-09-01  8:44                             ` Richard Purdie
     [not found]                             ` <16A0A6483A22DE64.7229@lists.openembedded.org>
2021-09-01  9:15                               ` Richard Purdie [this message]
     [not found]                         ` <169F1E62C63E8EDC.31425@lists.openembedded.org>
2021-08-27 12:04                           ` Richard Purdie
     [not found]                           ` <169F2844BF9C5B85.31425@lists.openembedded.org>
2021-09-01  8:38                             ` Richard Purdie
2021-08-27 14:31                         ` Armin Kuster
2021-08-27 20:09                         ` Tim Orling
     [not found]               ` <169D9CED4738B0BB.18298@lists.openembedded.org>
2021-08-22 12:38                 ` Richard Purdie

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=06e6b6542cb7097e7da11338a43073ca8f2e89d8.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=anbelski@linux.microsoft.com \
    --cc=cardoe@cardoe.com \
    --cc=derek@asterius.io \
    --cc=dev@codyps.com \
    --cc=ekuber@amazon.com \
    --cc=elberger@amazon.com \
    --cc=johan.anderholm@gmail.com \
    --cc=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul@pbarker.dev \
    --cc=raj.khem@gmail.com \
    --cc=randy.macleod@windriver.com \
    --cc=saul.wold@windriver.com \
    --cc=steven@stevenwalter.org \
    --cc=timothy.t.orling@intel.com \
    --cc=trevor.gamblin@windriver.com \
    --cc=tylerwhall@gmail.com \
    --cc=vinay.kumar@blackfigtech.com \
    --cc=vinay.m.engg@gmail.com \
    /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