Important: Please read the Qt Code of Conduct -

Cross compilation : Rasp berryPi2

  • HI

    Faced isse while cross compiling Qt for Rasp BerryPi

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/ram/RPI/compiler/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi

    Error Message:
    Creating qmake...
    .cc1plus: error: unrecognized command line option ‘-std=c++11’
    make: *** [project.o] Error 1

    After online search about the issue , it tells old version og g++ compiler like g++ 4.6 and below. But i m using g++ 4.7

    Thank you in advance

  • Moderators

    @yuvaram You need 4.7 I believe for c++11.. Check to see if maybe your desktop g++ is getting picked up instead and if it's < 4.7 that could be the issue. Not the version but the fact that the desktop compiler is being used.

    Can you do a quick test and try this:

    $ mkdir xxx
    $ cd xxx
    $ echo "int main() { return 0; }" > main.cpp
    $ /home/ram/RPI/compiler/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -std=c++1 main.cpp

    And see if that works. If it does than your cross compiler definitely supports c++11.

    Do you have a clean build directory for Qt? You never built or configured with a different option or compiler before that test?

  • @ambershark said in Cross compilation : Rasp berryPi2:

    /home/ram/RPI/compiler/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -std=c++1 main.cpp

    Thank you @ambershark
    main.cpp compiled successfully.

  • Moderators

    @yuvaram Ok so if that's the case your cross compiler definitely works with c++11, so that means your desktop compiler doesn't.

    Check what compiler your using with g++ --version and if it's below 4.7, upgrade your compiler and you should be good to go. :)

    You're probably running some really old linux if it doesn't have at least 4.7 though. I mean on arch I'm using 6.3.1. gcc 4 is a LONG time ago. CentOS/redhat or something really old would be my guess. Both CentOS and Redhat are really really far behind everyone else since they are going for "stable" linux platforms.

  • Hi... I wanted to start cross compiling for raspberry pi2 on Ubuntu 32bit (in virtual box), so I downloaded the toolchain on the github site and tried to compile a simple hello world program with the command (I've included the path to the bin folder that contains arm-linux-gnueabihf-gcc-4.8.3 to the PATH variable.

    printed circuit assembly

Log in to reply