jart / cosmopolitan

build-once run-anywhere c library
ISC License
17.84k stars 612 forks source link

Rasberry PI 4: gcc: error: unrecognized command line option ‘-mno-red-zone’; did you mean ‘-fno-regmove’? #55

Closed Gys closed 3 years ago

Gys commented 3 years ago

I have a Raspberry Pi 4 with 4Gb memory and tried the 'Getting Started' code from the readme:

wget https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-0.2.zip
unzip cosmopolitan-amalgamation-0.2.zip
printf 'main() { printf("hello world\\n"); }\n' >hello.c
gcc -g -O -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
  -o hello.com.dbg hello.c -fuse-ld=bfd -Wl,-T,ape.lds \
  -include cosmopolitan.h crt.o ape.o cosmopolitan.a

The gcc line gives the error gcc: error: unrecognized command line option ‘-mno-red-zone’; did you mean ‘-fno-regmove’?

The gcc -v output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)

Any ideas?

XapaJIaMnu commented 3 years ago

AFAIK, this only works on x86 platforms, raspbery pie is ARM.

Gys commented 3 years ago

Ok, I did not realize the example is x86 only.

elimisteve commented 3 years ago

@Gys Apparently Cosmopolitan binaries can even run on ARM if you have qemu installed! See https://github.com/jart/cosmopolitan/issues/73