From mboxrd@z Thu Jan  1 00:00:00 1970
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: qemu-user-static build of other architectures
Date: Sun, 27 Nov 2022 12:09:23 +0000
Message-ID: <B62ACB3E-9439-4EDA-BAEE-F95283B3100D@ipfire.org>
In-Reply-To: <d11ff8c3-ddc2-4a4b-a689-933f70a7e38d@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1663753657111287780=="
List-Id: <development.lists.ipfire.org>

--===============1663753657111287780==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hello Adolf,

> On 26 Nov 2022, at 22:24, Adolf Belka <adolf.belka(a)ipfire.org> wrote:
>=20
> Hi All,
>=20
> I tried to run a aarch64 build of samba so that I could get the correct roo=
tfile but I had a few problems.
>=20
> I installed qemu-user-static on Arch Linux but when I tried to run the gett=
oolchain command I got an error message about not finding the binfmt_misc hel=
per.
>=20
> Figured out that I needed to also install qemu-user-static-binfmt as well. =
Then the error message changed to the fact that it could not find /usr/bin/qe=
mu-aarch64-static but it was in that directory.
>=20
> Eventually used the find static command from ./make.sh and found that on Ar=
ch Linux it does not have "statically linked" but "static-pie linked". Changi=
ng the ./make.sh find static command to look for "static-pie linked" then all=
owed the build for aarch64 to proceed.

It is required that QEMU is statically linked.

The reason for that is that we copy the binary into the build environment whe=
re it has no access to any libraries of the host - and to make those availabl=
e, they need to be compiled into the binary.

PIE does not have anything to do with a statically linked binary (well kind o=
f, but I wouldn=E2=80=99t know why that is relevant in this context).

So what did you change exactly for this to work on your system? make.sh would=
 normally automatically try to find the correct binary.

> Of course having changed ./make.sh means that it now shows up as a modified=
 file in the git status. I will look at changing the find static command to l=
ook for either "statically linked" or "static-pie linked" and submit it as a =
patch for consideration.

> Regards,
>=20
> Adolf.
>=20

-Michael

--===============1663753657111287780==--