vsimon/webrtcbuilds

Cross-compiling to ARM64 uses incorrect sysroot - resulting binary invalid

Closed this issue · 3 comments

Hello. This is probably not a problem with your scripts, but I am unsure where else to turn. My environment is Ubuntu 18.04, cross-compiling to ARM64, my first attempt informs me I must install the sysroot, which is expected, but it specifies the wrong sysroot. It directs me to install the amd64 sysroot, as illustrated:

$ ./build.sh -b branch-heads/71 -t android -c arm64 -n Release
...
Missing sysroot (//build/linux/debian_sid_amd64-sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=amd64

Paths I've taken at this point:

Option 1. Install the amd64 sysroot and let the build complete.

The build succeeds, but the resultant library is not a valid target for Android. Inspecting it, it is clear that it contains a mix of amd64 and arm64 objects. Sysroot objects are in amd64 format:

File: libwebrtc_full.a(cxa_default_handlers.o)
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Advanced Micro Devices X86-64

Whereas library-level objects in the same file are arm64:

File: libwebrtc_full.a(mediastream.o)
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           AArch64

Option 2. Install the arm64 sysroot (and remote the amd64 sysroot), and try the build.

This sysroot is not accepted and I get the missing sysroot error above.

Can you advise how to engage the correct sysroot when cross compiling to ARM64, or perhaps could direct me to the appropriate channel or forum for this kind of issue? Any help is appreciated.

Thank you!

Or perhaps I can exclude the sysroot objects entirely? Could that be a valid approach?

Oh, looks like I wasn't re-fetching sources for the Android platform (I'd commented that line in the script to expedite rebuilds). I'll try that.

I think the issue is elsewhere. Closing this.