can't cross compile on arch linux

Hi, I'm trying to learn arm development with my laptop, which is hosted a x86_64 OS. I downloaded arm gcc toolchain x86_64 version.

But when I compile, it throws me an error: 

./gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -c boot.S -o boot.o
aarch64-none-elf-gcc: fatal error: cannot execute '/home/joey/Projects/pi/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/11.2.1/../../../../aarch64-none-elf/bin/as': execv: Exec format error
compilation terminated.

`file` gcc gives me:

./gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6062e5a5acafaae05ce5896fe9c3632adc069589, not stripped
and `uname -m` gives me:
uname -m
x86_64

can someone help me? I don't think it relate code, because I tried `hello world` and it just simply not working.

Parents
  • Can't reproduce on x86_64 Ubuntu 20.04 using a int main () {return 0;} program. What OS are you using btw?

    What I get from the two `file` commands is:

    ~/Downloads/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf$ file ./aarch64-none-elf/bin/as
    ./aarch64-none-elf/bin/as: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6614458c7f81106bd4b7c3b2bf1d399ffdd78112, not stripped

    ~/Downloads/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf$ file ./bin/aarch64-none-elf-gcc
    ./bin/aarch64-none-elf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6062e5a5acafaae05ce5896fe9c3632adc069589, not stripped

    Which all looks OK...

Reply
  • Can't reproduce on x86_64 Ubuntu 20.04 using a int main () {return 0;} program. What OS are you using btw?

    What I get from the two `file` commands is:

    ~/Downloads/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf$ file ./aarch64-none-elf/bin/as
    ./aarch64-none-elf/bin/as: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6614458c7f81106bd4b7c3b2bf1d399ffdd78112, not stripped

    ~/Downloads/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf$ file ./bin/aarch64-none-elf-gcc
    ./bin/aarch64-none-elf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6062e5a5acafaae05ce5896fe9c3632adc069589, not stripped

    Which all looks OK...

Children
No data