qt 5.10.1 cross compile for raspberry pi 3 in debian stretch



  • Hi everyone,

    I have been trying to qt cross compile (qt 5.10.1) for raspberry pi 3 in debian stretch. I am strictly following the links here and here. During (after make command) compilation I am getting the error below.

    In file included from ../../include/QtCore/qglobal.h:1:0,
                     from ../corelib/global/qt_pch.h:56:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:762:47: error: static assertion failed: Required feature library for file ../../include/QtCore/../../src/corelib/plugin/qlibrary.h not available.
     #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                   ^
    ../../include/QtCore/../../src/corelib/global/qglobal.h:86:36: note: in expansion of macro ‘Q_STATIC_ASSERT_X’
     #define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
                                        ^
    ../../include/QtCore/../../src/corelib/plugin/qlibrary.h:45:1: note: in expansion of macro ‘QT_REQUIRE_CONFIG’
     QT_REQUIRE_CONFIG(library);
     ^
    Makefile:27975: recipe for target '.obj/qsslsocket_opensslpre11.o' failed
    make[2]: *** [.obj/qsslsocket_opensslpre11.o] Error 1
    make[2]: Leaving directory '/root/raspi/qtbase/src/network'
    Makefile:273: recipe for target 'sub-network-make_first' failed
    make[1]: *** [sub-network-make_first] Error 2
    make[1]: Leaving directory '/root/raspi/qtbase/src'
    Makefile:48: recipe for target 'sub-src-make_first' failed
    make: *** [sub-src-make_first] Error 2
    

    My best guess was that there is something wrong about the libraries of Qt, but I am not sure of course.
    I am looking forward to hearing your solution ideas to this problem.

    Thanks in advance.

    sdttn,


  • Moderators

    Most probably that comes from bad symlinks in your sysroot. Make sure you run sysroot-relativelinks.py



  • I tried that, it doesnt resolve the problem. What are those errors telling us? I am not quite sure what is going on with these errors though.


  • Moderators

    @sdttn said in qt 5.10.1 cross compile for raspberry pi 3 in debian stretch:

    I tried that, it doesnt resolve the problem.

    Weird, it worked for me (with Qt 5.10.0 and 5.9.4). Try going to the website this file comes from and checking out if there is a newer version of the script.

    What are those errors telling us? I am not quite sure what is going on with these errors though.

    The errors tell us that the sysroot or toolchain are broken. Basic C++ functionalities are not available.



  • I think toolchain is broken...not sure how to fix it though...May be I am supposed to edit some files and export some path etc.


  • Moderators

    @sdttn said in qt 5.10.1 cross compile for raspberry pi 3 in debian stretch:

    I think toolchain is broken...

    I don't think so. Last commit in RPi toolchain repo is from a month ago - and I used it to compile 5.9.4 and 5.10.0, it worked.


  • Moderators

    I've just tried, it works, with 5.10.1.

    Make sure you properly rsync'ed your sysroot from your raspbery pi, then run the symlink fix script again. I'm pretty certain that's the issue.



  • @sierdzio said in qt 5.10.1 cross compile for raspberry pi 3 in debian stretch:

    Make sure you properly rsync'ed your sysroot from your raspbery pi, then run the symlink fix script again. I'm pretty certain that's the issue.

    Have you used the qtbase or from the source file qt-everywhere-opensource-src-5.7.0.tar.gz.
    I have tried again and still getting the same errors. May be I should try Qt 5.10.0 instead of Qt 5.10.1.

    Kind regards,


  • Moderators

    I've used qt-everywhere-src-5.10.1.tar.xz for the test above. I have also successfully compiled 5.10.0 and 5.9.4 with the same sysroot and toolchain.



  • OK. This is really weird. What am I missing. I have done everything.... including fixing the sysroot folder. Because I just tried even with the 5.10.0 still didnt work.


  • Moderators

    Dunno. I'm on Ubuntu and not Debian Stretch, but I doubt this is of any relevance here.

    Perhaps it's about some detail on the wiki, I was not following it word for word (mostly because I'm setting up prefixes and folders differently - but the toolchain+sysroot is the same. Plus additionally, I'm running on a live Pi and not the OS image).

    I did have exactly the issue you had, and in my case running the symlink fix did the trick. One idea - check the version of your symlink script, perhaps some new commit spoiled it or something. Mine is from ~11 January 2018. Actually, let me send it to you, here you go: https://www.dropbox.com/s/1alp65bf2lenrjj/sysroot-relativelinks-1.10-priv.py?dl=0



  • @sierdzio said in qt 5.10.1 cross compile for raspberry pi 3 in debian stretch:

    I did have exactly the issue you had, and in my case running the symlink fix did the trick

    Thank @sierdzio I ll try with your file along with couple of other things and I ll put the results here. But I am glad you get the same error too, I have started to think that I am crazy :)

    I am not sure what version of raspberry pi is installed on the machine though, I havent put fresh OS in RPI3. There was already some OS in it. That might be an issue. The second possibility could be the OS on my desktop side (debian stretch).
    These are the possibilities that I can come up with just right now.

    Like I said I will try and let you know.
    Thank you for your kind responses.

    Regards,



  • hi @sierdzio once again,

    I have tried the file from the link you have given but this time I got the error as below.

    g++: error trying to exec 'cc1plus': execvp: No such file or directory
    Makefile:242: recipe for target 'main.o' failed
    make: *** [main.o] Error 1
    
    

    This time I have tried for both 5.10.0 and 5.10.1 still on debian stretch installed on virtual machine.
    Thanks,


  • Moderators

    This one I've not met before.


  • Lifetime Qt Champion

    Hi,

    Might be a silly question but do you have g++ installed ?



  • Hi @SGaist,

    which g++ are you talking about? You mean this
    apt-get install g++
    Then yes. Interestingly something happened, I was trying for 5.9.4 and it didint even configure with ./config
    Now it keeps giving me the error

    g++: error trying to exec 'cc1plus': execvp: No such file or directory
    Makefile:242: recipe for target 'main.o' failed
    make: *** [main.o] Error 1
    

    Right before that I was getting pcre_compile.o failed kind of error.

    This is really getting messy. Not sure what to do at this point though.


  • Lifetime Qt Champion

    I’d start by verifying that you can use g++ for a simple hello world application.

    I’d also double check the installation of the development tools.



  • Hi again,

    After I am able to compile, I was trying to make an example code which is a simple push button changes the text and I have gotten the error below.
    By the way instead of using linaro gcc and g++, I used the one that I have installed with the command

    apt-get install gcc-arm-linux-gnueabihf
    apt-get install g++-arm-linux-gnueabihf
    

    I am not sure what the problem is though. Do you think that at some point my compilers and debuggers got mixed up.? Thats my best guess though. I am open for any ideas.

    /usr/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/root/raspi/sysroot -Wl,-rpath,/usr/local/qt5pi/lib -Wl,-rpath-link,/root/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/root/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/root/raspi/sysroot/lib/arm-linux-gnueabihf -o testRPI3 main.o mainwindow.o moc_mainwindow.o   -L=/opt/vc/lib -L/root/raspi/qt5pi/lib -lQt5Widgets -lQt5Gui -lQt5Core -L/root/raspi/sysroot/usr/lib/arm-linux-gnueabihf -lGLESv2 -lpthread 
    main.o: file not recognized: File format not recognized
    collect2: error: ld returned 1 exit status
    Makefile:245: recipe for target 'testRPI3' failed
    make: *** [testRPI3] Error 1
    05:40:53: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project testRPI3 (kit: Raspberry Pi 3 )
    When executing step "Make"
    05:40:53: Elapsed time: 00:00.
    

    Kind regards,


  • Moderators

    @sdttn Looks like you compiled all the *.o files with a different compiler. You should clean up and rebuild.



  • @sdttn said in qt 5.10.1 cross compile for raspberry pi 3 in debian stretch:

    apt-get install gcc-arm-linux-gnueabihf
    apt-get install g++-arm-linux-gnueabihf

    Can I use these three including gdb as well. Are these correct tools? or Should I use the linaro one...

    apt-get install gcc-arm-linux-gnueabihf
    apt-get install g++-arm-linux-gnueabihf
    apt-get install gdb-multiarch
    

  • Moderators

    @sdttn You should not mix binaries built with different compilers. Either you build everything with gcc-arm-linux-gnueabihf or you build everything with the Linaro toolchain. That's why I suggested to cleanup and rebuild: to get rid of all *.o files and build everything with same compiler.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.