5

To make use of vfp or neon I added -mfpu=vfp and -mfloat-abi=hard to my cross compilation. The Programm is a very simple hellofloat.cpp which then doesn't compile any more with the Sourcery CodeBench Lite 2013.05-24.

#include <string>
#include <iostream>
using namespace std;
int main()
{
    double val=1.04;
    cout << "Hello Float: " << val  << endl;
}

Compile instruction:

arm-none-linux-gnueabi-g++ -o armhf-main main.cpp  -march=armv7-a  -mfloat-abi=hard -mfpu=neon

I'm confused since Codesorcery should support armhf compilation?

Error:

In file included from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/features.h:399:0,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/os_defines.h:40,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/c++config.h:414,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/string:40,
                 from main.cpp:1:
/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/gnu/stubs.h:10:29: fatal error: gnu/stubs-hard.h: No such file or directory
compilation terminated.

Compiler

arm-none-linux-gnueabi-g++ -v
Using built-in specs.
COLLECT_GCC=arm-none-linux-gnueabi-g++
COLLECT_LTO_WRAPPER=/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.3/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/jbrown/2013.05-arm-linux-release/src/gcc-4.7-2013.05/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} -D__CS_SOURCERYGXX_MAJ__=2013 -D__CS_SOURCERYGXX_MIN__=5 -D__CS_SOURCERYGXX_REV__=24 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery CodeBench Lite 2013.05-24' --with-bugurl=https://sourcery.mentor.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/jbrown/2013.05-arm-linux-release/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpfr=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-mpc=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-ppl=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --with-libelf=/scratch/jbrown/2013.05-arm-linux-release/obj/pkg-2013.05-24-arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr --disable-libgomp --disable-libitm --enable-poison-system-directories --with-build-time-tools=/scratch/jbrown/2013.05-arm-linux-release/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/jbrown/2013.05-arm-linux-release/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.7.3 (Sourcery CodeBench Lite 2013.05-24) 
eactor
  • 862
  • 3
  • 14
  • 34
  • http://wiki.debian.org/ArmHardFloatPort and http://wiki.debian.org/ArmHardFloatPort/VfpComparison – eactor Jun 28 '13 at 13:33
  • 2
    Can you compile with `softfp` or any other simple test application? Looks like a toolchain issue. – auselen Jun 28 '13 at 14:22
  • 1
    Try `arm-none-linux-gnueabi-g++ -v` and post the output. – artless noise Jun 28 '13 at 14:28
  • Unless you've linking against libstdc++ built with `-mfloat-abi=hard`, you're linking two incompatible ABIs. Brokenness is to be expected. – marko Jun 28 '13 at 14:42
  • @auselen sry I have no access to the board until monday, i will post the -v output than. softfp works, since it should be the same as using no mfloat-abi option – eactor Jun 28 '13 at 16:33
  • @Marko how do I specific what I want to link against? – eactor Jun 28 '13 at 16:33
  • Basically, the compiler can be configured to support only one of the float types easily. If it supports both *soft and hard float-abi*, it is *multi-lib* gcc. Generally, the compiler name reflects this, but it is just the compiler builder who specifies the prefix, so only the `-v` output will tell for sure. The *multi-lib* will look at the compiler options and pick the correct library. However, this issue is at compile time and a missing header, afaiu. See [cross..](http://stackoverflow.com/questions/17336236/cross-compile-from-linux-to-arm-elf-arm926ej-s-mt7108) which is opposite. – artless noise Jun 28 '13 at 17:40
  • What Marko said. Referring to my CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/share/doc/arm-arm-none-linux-gnueabi/html/getting-started/sec-armfloat.html "While the compiler is capable of generating code using the VFP ABI, no compatible runtime libraries are provided in Sourcery CodeBench Lite." – Joe Kul Jun 28 '13 at 19:51
  • @JoeKul: I didn't get that from Marko's comment. I am glad you did. Also, the actual error is a header file not present, we didn't get to the library yet. So apparently it is hopeless with this compiler. – artless noise Jun 28 '13 at 20:02
  • arm-none-linux-gnueabi-g++ -v -> gcc version 4.7.3 (Sourcery CodeBench Lite 2013.05-24) – eactor Jul 01 '13 at 06:05

1 Answers1

4

The Sourcery CodeBench Lite toolchain does not support armhf. Nor do the Academic or Personal editions.

You'll need to purchase the Standard or Professional editions to get that.

Alternatively, I believe the cross-compiler packages for Ubuntu support the configuration you need (in fact, only that configuration).

If you're not using Ubuntu, then the pre-built Linaro toolchains should be exactly what you need. (The Ubuntu cross compiler packages are/were also built by Linaro people, albeit using the Debian/Ubuntu-specific deb build system.)

ams
  • 24,923
  • 4
  • 54
  • 75
  • 1
    You can also build your own. See [crosstool-ng](http://www.crosstool-ng.org/) which is a collection of scripts to build the cross-compilers. This is slightly easier than *roll your own* and generally allows creation of a compiler that is better suited for your hardware once you understand how it works. [Linaro](https://launchpad.net/gcc-linaro/+download) is another good suggestion. Both **Ubuntu** and **Linaro** use the *crosstool-ng* scripts. – artless noise Jun 28 '13 at 20:05
  • @artlessnoise: Indeed, I forget that the whole world doesn't use Ubuntu. The Linaro tools are exactly the same but are more widely installable. – ams Jun 28 '13 at 20:31
  • 1
    It's a shame ARM stopped sponsoring the CodeSourcery tools, but it's not hard to see why with Linaro around. – ams Jun 28 '13 at 20:32
  • So to you know if possibly the Xilinx compiler support armhf? They addjust the Codesorcery compiler and add it to ther ISE Suite as arm-xilinx-linux-gnueabi? – eactor Jul 01 '13 at 06:03
  • I believe the Xilinx toolchains use the softfp ABI (i.e. they're *not* `armhf`), but I can't swear to it. – ams Jul 01 '13 at 09:34