1

I just setup a x86-64 environment on arm64 M1 Mac Mini with the Ubuntu Docker image. I've installed relevant softwares such as the GCC AArch64 cross compiler, and user-mode QEMU.

I know this setup works on Windows Subsystem for Linux (also the Ubuntu distribution), except for the SPARC-64 emulation is failing. But when doing this on M1 Mac using Docker, QEMU reports:

mmap stack: Cannot allocate memory

Here's the source code of the program:

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Hello World!\n");
    return 0;
}

Which I've compiled with the command:

aarch64-linux-gnu-gcc \
    -Xlinker -dynamic-linker \
    /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 \
    hello-world.c -o hello-world

And executed with:

qemu-aarch64 ./hello-world
DannyNiu
  • 1,313
  • 8
  • 27

0 Answers0