Page MenuHomePhabricator

Hafnium fails to build on arm64 hosts
Closed, ResolvedPublic


Building hafnium on arm64 hosts isn't possible out of the box:

./prebuilts/linux-x64/gn/gn: 1: ELF: not found
./prebuilts/linux-x64/gn/gn: 2: @: not found
./prebuilts/linux-x64/gn/gn: 1: Syntax error: end of file unexpected (expecting ")"

The Makefile sets PREBUILTS to .../linux-x64, so tries to run x86-64 binaries on an arm64 host.

If I edit the Makefile to use linux-aarch64, then the build fails as there is no gn binary.

After setting GN and NINJA to external binaries, the build still fails as x86 is hard-coded in build/image/

DTC_ROOT = os.path.join(HF_ROOT, "prebuilts", "linux-x64", "dtc")

I have DTC binaries, so that's fine. If I patch to use relative paths it will find those.

|   File "/yocto/ross/build/tmp/work/tc0-poky-linux/hafnium/2.4+gitAUTOINC+fe7f737ec2-r0/git/prebuilts/linux-x64/clang/bin/clang", line 162, in invoke_compiler
|     os.execv(self.argv0, self.execargs)
| OSError: [Errno 8] Exec format error

I'm sorry, Hafnium embeds its own copies of clang and gcc?

Event Timeline

rossburton updated the task description. (Show Details)Mar 22 2021, 4:51 PM
rossburton updated the task description. (Show Details)Mar 22 2021, 5:14 PM

Yes, we include a prebuilt toolchain so that the builds are reproducible. It's a copy of the Android prebuilt toolchain (from, which I'm afraid doesn't seem to include aarch64 binaries at the moment.

That's a very interesting definition of reproducible.

Is it possible to use the host toolchain instead?

That's not currently supported.

odeprez closed this task as Resolved.Jan 19 2022, 2:15 PM
odeprez claimed this task.
odeprez added a subscriber: odeprez.