Subject: Re: bug#39817: Using cross compiled .go from amd64 to powerpc64 segfaults

From: Chris Marusich <[email-masked]>
Date: Thu, 21 May 2020 00:06:35 -0700

Hi,

dftxbs3e <[email-masked]> writes:

> I built GNU Guix's `bootstrap-tarballs` package which includes Guile 2.2
> with `guix build --target=powerpc64-linux-gnu bootstrap-tarballs` and
> when I run that compiled Guile on powerpc64, it crashes.
>
> I tried replacing the .go files with natively built ones and it works,
> with the same cross compiled copy of the GNU Guile binaries.
>
> I used this GNU Guix's tree:
>
> https://gitlab.com/lle-bout/guix - commit
> f47e761a10675b05b07107035d5024618267a3ad
>
> And bootstrap binaries are:
>
> https://gitlab.com/lle-bout/guix-bootstrap/-/commit/8e464405c0ba76b29e11c3b60af4d6ea9c83c188
>
> After that copy of GNU Guix is built, to experience the crash you can
> run on a powerpc64 machine:
>
> ./pre-inst-env guix build hello
>
> And it will try to run the bootstrap GNU Guile after some time and segfault.

What was the architecture of the system on which you ran the command
"guix build --target=powerpc64-linux-gnu bootstrap-tarballs"?  That may
help me reproduce the issue.

Can you remind me why bootstrap-tarballs uses Guile 2.2?  Is there any
possibility we can use Guile 3 instead?  Maybe doing so could work
around this problem.  Or maybe I'm just confused.  :-)

It sounds like you're saying that one could reproduce this issue by
doing the following:

- Do a "guix pull" to install Guix commit
  f47e761a10675b05b07107035d5024618267a3ad (from your repo).

- Use this newly pulled Guix to build the bootstrap binaries:

    guix build --target=powerpc64-linux-gnu bootstrap-tarballs

- This should produce the same binaries that are found here:

  https://gitlab.com/lle-bout/guix-bootstrap/-/commit/8e464405c0ba76b29e11c3b60af4d6ea9c83c188

- Update the Guix source so that Guix will use those newly built
  bootstrap binaries (it looks like you did this in commit
  bb7d8f3b2ec469c6b3f460e4731871e8e2314dc4 in your repo).

- On a POWER9 machine, get the new Guix source (e.g., commit
  bb7d8f3b2ec469c6b3f460e4731871e8e2314dc4 from your repo), and build
  Guix from source using the foreign distribution's native libraries
  (i.e., build Guix without using Guix, since it isn't available yet on
  POWER9).

- Once you've built Guix in your local checkout, run "./pre-inst-env
  guix build hello" to observe the crash.

Is that basically right?

I will try to reproduce this and poke at it a bit.  Please let me know
if I have misunderstood anything.

-- 
Chris