qt cross compilation for raspberry pi: Cannot find GLESv2

前端 未结 3 1168

I am trying to compile qt 5.9 for my raspberry pi 3 compute module and I have been following mainly the online guide here (https://wiki.qt.io/RaspberryPi2EGLFS). So

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 21:32

    My starting point was 2017-11-29-raspbian-stretch and built my toolchain in OSX using crosstool-ng.

    While sudo rpi-update helped and brought in 'libGLESv2.so', it did not solve the problem for me. The issue turned out to be in the QT configuration. QT uses gcc -dumpmachine to establish the tuple. For me it was 'arm-raspbian-linux-gnueabihf'. QT ends up searching for libraries and packages in locations like /usr/lib/arm-raspbian-linux-gnueabihf which do not exist. (It ends up failing to find libraries like 'libpthread.so' while compiling using GLESv2.) Instead, if you look at the OS, the correct location is /usr/lib/arm-linux-gnueabihf. The solution is to modify 'configure.pri' in qtbase.

    --- a/configure.pri
    +++ b/configure.pri
    @@ -241,7 +241,7 @@ defineReplace(qtConfFunc_licenseCheck) {
    
     # this is meant for linux device specs only
     defineTest(qtConfTest_machineTuple) {
    -    qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", $${1}.tuple)|return(false)
    +    qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine | sed 's/-raspbian//'", $${1}.tuple)|return(false)
         $${1}.cache += tuple
         export($${1}.cache)
         return(true)
    

    This changes the tuple from crosstool-ng to the triplet.

    Update. If you are using crosstool-ng, an alternative to this "fix" is to use CT_TARGET=arm-linux-gnueabihf (not CT_TARGET_ALIAS).

提交回复
热议问题