c - sorry, unimplemented: Thumb-1 ‘hard-float’ VFP ABI - arm-linux-gnueabihf-gcc - targeting armv6 - Stack Overflow
Example code (people seem to require it no matter what the question is):
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
The actual problem I have is I am trying to cross compile for armv6 (Raspberry PI Zero V1) from Ubuntu x86 64bit (WSL). The project I am trying to compile is Node.js, but I can reproduce the error with the simple file above.
To set the architecture I have tried both -march=armv6+fp
(my CPU does have a HW floating point compute) and also the more specific -mcpu=arm1176jzf-s
. I am forcing these for compilation because otherwise the arm-linux-gnueabihf-gcc
defaults to target armv7, which won't work on my raspberry.
This is my test script for compiling. test.c
refers to the code above.
OUT_PATH=./test.o
C_FILE_PATH=./test.c
# I don't know what this is, I got it from verbose output of my failing build
RAW_FILE_PATH=./test.raw
arm-linux-gnueabihf-gcc -march=armv6+fp -o $OUT_PATH $C_FILE_PATH -pthread -Wall -Wextra -Wno-unused-parameter -Wa,--noexecstack -Wall -O3 -pthread -Wall -O3 -Wno-missing-field-initializers -Wno-old-style-declaration -O3 -fno-omit-frame-pointer -MMD -MF $RAW_FILE_PATH -c
This is my full output:
ME@COMPUTER:/mnt/e/test-armv6-compile$ ./compile.sh
In file included from /usr/arm-linux-gnueabihf/include/stdio.h:976,
from ./test.c:1:
/usr/arm-linux-gnueabihf/include/bits/stdio.h: In function ‘getchar’:
/usr/arm-linux-gnueabihf/include/bits/stdio.h:48:1: sorry, unimplemented: Thumb-1 ‘hard-float’ VFP ABI
48 | {
| ^
Output of arm-linux-gnueabihf-gcc -v
:
ME@COMPUTER:/mnt/e/test-armv6-compile$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc-cross/arm-linux-gnueabihf/13/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a+fp --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)
I find it odd that the HW floating point was not supported by the compiler at all, since I have used gcc to target android ARMs with no issue. What is my mistake? How can I compile the sample above to run on ARMv6?
Example code (people seem to require it no matter what the question is):
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
The actual problem I have is I am trying to cross compile for armv6 (Raspberry PI Zero V1) from Ubuntu x86 64bit (WSL). The project I am trying to compile is Node.js, but I can reproduce the error with the simple file above.
To set the architecture I have tried both -march=armv6+fp
(my CPU does have a HW floating point compute) and also the more specific -mcpu=arm1176jzf-s
. I am forcing these for compilation because otherwise the arm-linux-gnueabihf-gcc
defaults to target armv7, which won't work on my raspberry.
This is my test script for compiling. test.c
refers to the code above.
OUT_PATH=./test.o
C_FILE_PATH=./test.c
# I don't know what this is, I got it from verbose output of my failing build
RAW_FILE_PATH=./test.raw
arm-linux-gnueabihf-gcc -march=armv6+fp -o $OUT_PATH $C_FILE_PATH -pthread -Wall -Wextra -Wno-unused-parameter -Wa,--noexecstack -Wall -O3 -pthread -Wall -O3 -Wno-missing-field-initializers -Wno-old-style-declaration -O3 -fno-omit-frame-pointer -MMD -MF $RAW_FILE_PATH -c
This is my full output:
ME@COMPUTER:/mnt/e/test-armv6-compile$ ./compile.sh
In file included from /usr/arm-linux-gnueabihf/include/stdio.h:976,
from ./test.c:1:
/usr/arm-linux-gnueabihf/include/bits/stdio.h: In function ‘getchar’:
/usr/arm-linux-gnueabihf/include/bits/stdio.h:48:1: sorry, unimplemented: Thumb-1 ‘hard-float’ VFP ABI
48 | {
| ^
Output of arm-linux-gnueabihf-gcc -v
:
ME@COMPUTER:/mnt/e/test-armv6-compile$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc-cross/arm-linux-gnueabihf/13/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a+fp --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)
I find it odd that the HW floating point was not supported by the compiler at all, since I have used gcc to target android ARMs with no issue. What is my mistake? How can I compile the sample above to run on ARMv6?
Share Improve this question asked yesterday Tomáš ZatoTomáš Zato 53k62 gold badges304 silver badges818 bronze badges 1 |1 Answer
Reset to default 1While there might be a way to get this to work, all I found is simply that the currently distributed arm-linux-gnueabihf-gcc
simply isn't compiled with armv6 support.
You can see that in the output of the -v
in my question too:
--with-arch=armv7-a+fp
No mention of armv6. So what you have to do is compile the compiler yourself. I found this repo: https://github.com/Pro/raspi-toolchain
Without any additional work, this will give you GCC 8, either by downloading a release, or by compiling it yourself. To compile newer version, I edited the docker file. I entered the exact versions of binutils, gcc and glibc that were on my freshly installed Raspberry Zero. Here is my edit, the rest is the same as the dockerfile in the repo:
# This should match the one on your raspi
ENV GCC_VERSION gcc-12.2.0
ENV GLIBC_VERSION glibc-2.36
ENV BINUTILS_VERSION binutils-2.40
ARG DEBIAN_FRONTEND=noninteractive
# Install some tools and compilers + clean up
RUN apt-get update && \
apt-get install -y rsync git wget gcc g++ cmake gdb gdbserver bzip2 texinfo && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Use GCC 8 as the default
# RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 999 \
# && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 999 \
# && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 999 \
# && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 999
After that, I was able to compile my own arm-linux-gnueabihf-gcc
and friends form armV6 and ultimately compile Node.js for the Pi.
- 暴风影音“猝死”,一个PC播放器时代的终结
- .NET开源:微软"云为先"战略的全面铺开
- 大本营不保?美国安卓系统激活量超iOS
- 这个夏天不平静 苹果WWDC 2013抢先看
- 鲍尔默:未来5至10年微软将不再像一家软件公司
- Why does this typecheck in Lean? - Stack Overflow
- anaconda - Trouble using fiona in conda environment: ImportError: DLL load failed while importing _env - Stack Overflow
- google apps script - How do I make it so specific cells get deleted or set to a specific # each time the workbook is opened? the
- swift - How do I know how many times a thread context switch happens on an xcode Instruments? - Stack Overflow
- macos - Can't access UI "section" in AppleScript - Stack Overflow
- typescript - Issues with generic type narrowing on merged records - Stack Overflow
- python - Custom font in a style sheet in matplotlib - Stack Overflow
- android - How to reduce height of a composable to wrap content without padding - Stack Overflow
- python - How can I use FilteredSelectMultiple widget in a django custom form? - Stack Overflow
- c++ - bootloader _start VEZA video buffer - Stack Overflow
- Page Performance Issue with Countdown in Angular on Component Reload - Stack Overflow
- Clicking on Android Studio on Mac makes Chrome window disaapear - Stack Overflow
-marm
(!), or-mthumb-2
(???). You may also need-mfpu
,-mfloat-abi=hard
,-mtune
(specifically-mtune=arm1176jz-s
et. al.). Also, consider-mthumb-interwork
. Seeinfo gcc
or gcc.gnu.org/onlinedocs/gcc/ARM-Options.html And, I assume you have the technical reference manual for ARM1176JZF-S – Craig Estey Commented 14 hours ago