樹莓派3交叉編譯qt5/clion


        如果直接在樹莓派上編寫程序,並編譯,會非常卡非常慢。因此,選在在自己筆記本上進行編譯,然後部署到樹莓派上。這就要對QT進行交叉編譯。

樹莓派3系統:Ubuntu mate (ubuntu 16.04.2)

筆記本:ubuntu 16.04


QT5

Qt版本:5.10.1

參考博客:

Qt交叉編譯:https://wiki.qt.io/RaspberryPi2EGLFS

Qt Creator設置:

適用於樹莓派Raspberry Pi的嵌入式QT平臺(二) -- 在Windows下用Qt Creator開發編譯Raspberry Qt 5應用程序

雖然是windows平臺,但是設置方法是一樣的。


編譯過程:

前期的各種準備見第一篇博客。

這裏在qt官網下載qt源碼。配置好後,進入qt-everywhere-src-5.10.1根目錄:

sh configure -opengl es2 -device linux-rasp-pi3-g++  -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/wk/Raspberry/qt5pi/sysroot  -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtwebengine -skip qtscript -nomake examples -make libs -v

注意:在網上查到很多的博客中,都是說在qt-everywhere-src-5.10.1/qtbase下面執行編譯指令,經過測試,會有各種問題。後來發現,直接而在根目錄下面就可以了。


QT執行程序中遇到的一些問題:

問題一:報錯:“Cannot run: No command given

參考博客:

步驟一:在樹莓派上安裝SFTP

               然後修改書沒拍系統中的文件愛你/etc/ssh/sshd_config 

                 其中一句修改爲:Subsystem sftp /usr/lib/openssh/sftp-server                      

                 參考博客:Qt Creator Deploy to Remote Linux Target


步驟2:https://forum.qt.io/topic/47046/cannot-run-no-command-given-in-run-for-raspberry-remote

目前編譯運行不帶界面的程序是沒有問題的。帶界面,即與QT庫相關的都會報錯,EGL庫各種問題。。。


CLion:

qt5交叉編譯,各種EGL庫相關的問題,頭大。。。暫時放棄了。畢竟也不是很需要qt的界面庫,轉用CLion


錯誤:
運行報錯:

cannot execute binary file: Exec format error

參考bash: ./program: cannot execute binary file: Exec format error

執行:sudo apt install binfmt-support qemu qemu-user-static

運行報錯:/lib/ld-linux-armhf.so.3: No such file or directory

將所使用的工具鏈的中的ld-linux-armhf.so.3鏈接到/lib/ld-linux-armhf.so.3:


報錯:

./untitled1: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章