1

I downloaded the latest Linaro toolchain (https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/) to cross-compile C++ code for different Raspberry Pis which running a Raspbian Buster. For testing I used a simple hello world code. If I compile this using

<path to toolchain>/arm-linux-gnueabihf-g++ main.cpp -o helloworld

the programme runs fine on Raspberry Pi II as well as on Raspberry Pi III models but on Raspberry Pi I it throws a

Segmentation fault

For some other code (Qt) the execution fails with

Illegal instruction

If I compile the same code directly on the Raspberry Pi I, it works fine.

So far I understood is this due to that the toolchain compiles for arm7 by default. I tried to force arm6 compatibility using

<path to toolchain>/arm-linux-gnueabihf-g++ main.cpp -o helloworld -marm

But this makes no difference. Further I tried

<path to toolchain>/arm-linux-gnueabihf-g++ main.cpp -o helloworld march=armv6z -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard

however, this results in compiler errors:

In file included from /home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/exception:38:0,
                 from /home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/ios:39,
                 from /home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/ostream:38,
                 from /home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/iostream:39,
                 from main.cpp:2:
/home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/bits/exception.h: In Konstruktor »std::exception::exception()«:
/home/development/linaro/gcc-linaro-7.4.1-2019.02-i686_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.4.1/bits/exception.h:63:39: nicht implementiert: Thumb-1 Hardware-Gleitkomma VFP ABI
     exception() _GLIBCXX_USE_NOEXCEPT { }

where "nicht implementiert: Thumb-1 Hardware-Gleitkomma" means "not implemented: Thumb-1 Hardware floating point".

Does anybody has an idea, how to use the toolchain to compile for armv6, i.e. Raspberry Pi I?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.