樹莓派4 64bit 編譯安裝QT5.13.2 和 Redis Desktop Manager 2020.1-dev


未經授權,嚴禁轉載

文章很長,關鍵步驟不多,寫的詳細只是記錄下解決問題的思路

[2020-6-22 更新 解決 eglfs問題,使得  egldevice、 gbm 、X11 全為yes]

2017年的時候我發表過一篇樹莓派 編譯安裝Python3.5 + PyQT5.8 + Eric6 的文章 鏈接在此,由於當時搞完了再寫的,回憶過程中有些遺漏,導致留言里抱怨問題太多……這次特地邊搞邊-寫……

 

之前上一篇已經交代了系統已經編譯安裝了Python 3.8.3 和Vscode ,VSCode 網上教程一堆,幾步搞定,不多說,安裝后顯示為Code - OSS (headmelted)

編譯安裝 redis6.0 也比較簡單,很順利沒有太多麻煩,這里不贅述。

說明下,其實我所有的命令都是在root下完成,全部用的proxychain4 代理下載的,真實命令只有 p4 apt install xxxxx , 這里為了嚴謹沒有直接這么寫

64bit beta 沒有預裝QT,於是

 sudo apt-get install qt5-default qtcreator qtdeclarative5-dev qtmultimedia5-dev libqt5sql5-mysql 

命令一頓擼,安裝啟動后正常,版本qt5.11 , QTcreator4.8,繼續,在pi用戶的downlaods 目錄下:

git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 2020 rdm2020 && cd ./rdm2020


下載后,用Qtcreator 打開src中的工程文件,發現問題很多,缺模塊,一頓操作補充模塊,發現插件版本又不對……算了,按照官方要求,直接上Qt5.13 編譯安裝Qt5.13 全程用了4小時,大家要有心理准備 , 下載源碼:

wget http://download.qt.io/archive/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz


國外有一篇寫編譯qt5.12的文章,微雪也有一篇,很多人都看過,都是在32位系統下的,64位系統有很多不同,

先下載樹莓派的配置文件

我是直接 訪問  https://github.com/oniongarlic/qt-raspberrypi-configuration  打包下載解壓后

把里面的 linux-rpi4-v3d-g++ 文件夾放到 qt-everywhere-src-5.13.2/qtbase/mkspecs 目錄里

按照這樣編譯不了的,報錯: 不支持參數  -mfpu=crypto-neon-fp-armv8

因為 arm 開發文檔里面有寫 相關鏈接

Note
The -mfpu option is only valid with the armv8a-arm-none-eabi target. It is not possible to override the default FPU for the aarch64-arm-none-eabi target. However, you can prevent the use of floating-point instructions or floating-point registers for the aarch64-arm-none-eabi target with the -mgeneral-regs-only option.

linux-rpi4-v3d-g++ 目錄里,打開 qmake.conf 修改

 QMAKE_CFLAGS            += -march=armv8-a -mtune=cortex-a72

保存,安裝依賴

apt install build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libinput-dev libxkbcommon-dev libsqlite3-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev

這樣子編譯會出現錯誤以及其他七七八八的問題:

Note: The following modules are not being compiled in this configuration:
    3dcore
    3drender
    …………

在終端下運行:raspi-config Advanced Options -> GL Driver -> GL 2  選擇此項,繼續補充依賴:

 

apt-get install bison libgles2-mesa-devmesa-utils libegl1-mesa libegl1-mesa-dev libgbm-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libbluetooth-dev bluetooth blueman bluez libusb-dev libdbus-1-dev bluez-hcidump bluez-tools libclang-dev llvm-7 clang-7

 

ln -s /usr/lib/llvm-7/bin/llvm-config /usr/bin/llvm-config

建立llvm-config是為了configure時候編譯QTdoc要用,或者通過改環境變量也可以,具體可參考官方說明 鏈接

 

現在再 到 qt-everywhere-src-5.13.2 中運行:(沒有skip 全部組件都裝上)

./configure -platform linux-rpi4-v3d-g++ -v -opengl es2 -eglfs -no-gtk -opensource -confirm-license -release -reduce-exports -force-pkg-config -qt-pcre -no-pch -ssl -tslib -evdev -system-freetype -fontconfig -glib -prefix /opt/Qt5.13.2 -qpa eglfs -recheck-all

這里注意,EGLFS Details 里面看了下 :

 

QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... no
    EGLFS GBM ............................ no
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ yes

 

EGLDevice 和 GBM  要求應該是YES的,這里是NO,但是去config.log日志里面看了下:

executing config test egl-egldevice
+ cd /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/egl-egldevice && /home/pi/workspace/qt-everywhere-src-5.13.2/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" 'QMAKE_USE += egl' 'QMAKE_LIBS_EGL = /usr/lib/aarch64-linux-gnu/libEGL.so' /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/egl-egldevice
+ cd /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/egl-egldevice && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
> rm -f main.o
> rm -f *~ core *.core
> g++ -c -pipe -march=armv8-a -mtune=cortex-a72 -O2 -w -fPIC  -I. -I/home/pi/workspace/qt-everywhere-src-5.13.2/qtbase/mkspecs/linux-rpi4-v3d-g++ -o main.o main.cpp
> g++ -Wl,-O1 -o egl-egldevice main.o   /usr/lib/aarch64-linux-gnu/libEGL.so   
test config.qtbase_gui.tests.egl-egldevice succeeded
looking for library gbm
Trying source 0 (type pkgConfig) of library gbm ...
+ /usr/bin/pkg-config --exists --silence-errors gbm
+ /usr/bin/pkg-config --modversion gbm
> 19.3.2
+ /usr/bin/pkg-config --libs-only-L gbm
+ /usr/bin/pkg-config --libs-only-l gbm
> -lgbm
+ /usr/bin/pkg-config --cflags gbm
+ cd /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/gbm && /home/pi/workspace/qt-everywhere-src-5.13.2/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" 'QMAKE_USE += gbm' 'QMAKE_LIBS_GBM = /usr/lib/aarch64-linux-gnu/libgbm.so' /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/gbm
+ cd /home/pi/workspace/qt-everywhere-src-5.13.2/config.tests/gbm && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
> rm -f main.o
> rm -f *~ core *.core
> g++ -c -pipe -march=armv8-a -mtune=cortex-a72 -O2 -w -fPIC  -I. -I/home/pi/workspace/qt-everywhere-src-5.13.2/qtbase/mkspecs/linux-rpi4-v3d-g++ -o main.o main.cpp
> g++ -Wl,-O1 -o gbm main.o   /usr/lib/aarch64-linux-gnu/libgbm.so   
 => source accepted.
test config.qtbase_gui.libraries.gbm succeeded

都是SUCCESS 這就有點莫名其妙了……(PS: 按照找個模式繼續裝完,實踐過用也可以,不設參數沒問題,但是qpa_platform 設置為 eglfs 會出現字體很小看不見七七八八問題)

——————————————————————

6-22號,解決了這個問題:

編譯QT5.13錯誤不明顯,但是那天我編譯QT5.14.2出了提示webengine不能用,於是我直接download了qt5.14的webengine模塊,解壓后目錄下運行qmake檢查時候可以展示詳細的錯誤。

對比qt官方: https://wiki.qt.io/QtPDF_Build_Instructions

要求的yes項目補齊依賴:

apt install libfontconfig1-dev libfreetype6-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxkbcommon-x11-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev

 以及關鍵的兩個缺失:

apt install ninja-build libdrm-dev

到qt5.13目錄下清理之前的configure緩存

rm -rf config.cache

重新細微修改了下configure后,測試這兩個已經yes了:

./configure -platform linux-rpi4-v3d-g++ -v -opengl es2 -opensource -confirm-license -release -reduce-exports -qt-pcre -ssl -tslib -system-freetype -fontconfig -glib -prefix /opt/Qt5.13.2 -recheck-all

 

nice   很完美了,Qt5.14同理解決此問題

——————————————————————

開始編譯, 由於我是8gb內存,就沒搞交換內存等,而且有風扇吹,直接上-j 4

 make -j 4

經過5個小時的漫長等待,如果沒有報錯就可以進行下一步了

后面install時候發現還有坑,這里先補一些依賴

apt install libxcb-xfixes0-dev
make install

后續還會提示一些七七八八問題,遇到一個解決一個:

/usr/bin/ld: 找不到 -lclip2tri
/usr/bin/ld: 找不到 -lpoly2tri
/usr/bin/ld: 找不到 -lclipper

主要是這6個第三方依賴的問題:

qt-everywhere-src-5.13.2/qtlocation/src/3rdparty/clip2tri
qt-everywhere-src-5.13.2/qtlocation/src/3rdparty/clipper
qt-everywhere-src-5.13.2/qtlocation/src/3rdparty/poly2tri
qt-everywhere-src-5.13.2/qtvirtualkeyboard/src/plugins/openwnn/3rdparty/openwnn
qt-everywhere-src-5.13.2/qtvirtualkeyboard/src/plugins/pinyin/3rdparty/pinyin
qt-everywhere-src-5.13.2//qtvirtualkeyboard/src/plugins/tcime/3rdparty/tcime

遇到就去這些目錄里面,make 一下:然后再make install,此過程歷時1個多小時

最終沒有再報錯結束,這時候打開 QTcreator 打開 工具 -> 選項 Kits 中 QtVersion手工設置 路徑,同時Kits中也添加一個設置,如圖

 

 

這時候再打開之前的rdm2020目錄中src目錄,選擇工程文件,選擇自己的環境Qt5.13.2,然后

再rdm2020中新建 build-rdm-default-Debug 、build-rdm-default-Release 、build-rdm-default-Profile、以及 /bin/linux/release 目錄

按照要求 要

 pip3 install -r src/py/requirements.txt

 

但是可能有些不一定能裝上,這邊我缺的不多,直接運行以下內容,這里只是簡單過了下

pip3 install bitstring cbor msg apt install python3-pandas

修改配置others/resource 中的文件 qt.conf

 

[Paths] Libraries=/opt/Qt5.13.2/lib Plugins=/opt/Qt5.13.2/plugins Qml2Imports=/opt/Qt5.13.2/qml

 

以及 src/resources/rdm.sh 修改為

#!/bin/bash DIR=$(dirname "$(readlink -f "$0")") export LD_LIBRARY_PATH="$DIR/../Qt5.13.2/lib":$LD_LIBRARY_PATH $DIR/rdm

選擇 - 工具 - 外部 - QT語言家 -  發布翻譯,生成 翻譯的qm文件

選擇 構建 - 構建項目“rdm"  不會太久,10來分鍾后,完成,警告不用管,不報錯就行,點擊運行如圖

 

這里補充一點:

修改了下 src/modules/updater/updater.cpp 文件,注釋以下代碼,不想讓它每次都去訪問升級地址:

    /* manager->get(QNetworkRequest(updateUrl));*/

去/src/qml/apptoolbar.qml把一些基本上不用按鈕關閉顯示:

        BetterButton {
            visible: false
            implicitWidth: 40
            iconSource: "qrc:/images/alert.svg"            
            tooltip: qsTranslate("RDM","Report issue")
            onClicked: Qt.openUrlExternally("https://github.com/uglide/RedisDesktopManager/issues")
        }

        BetterButton {
            visible: false
            implicitWidth: 40
            iconSource: "qrc:/images/help.svg"            
            tooltip: qsTranslate("RDM","Documentation")
            onClicked: Qt.openUrlExternally("http://docs.redisdesktop.com/en/latest/")
        }

        BetterButton {
            visible: false
            implicitWidth: 40
            iconSource: "qrc:/images/telegram.svg"            
            tooltip: qsTranslate("RDM","Join Telegram Chat")
            onClicked: Qt.openUrlExternally("https://*.**/RedisDesktopManager")
        }

        BetterButton {
            visible: false
            implicitWidth: 40
            iconSource: "qrc:/images/twi.svg"            
            tooltip: qsTranslate("RDM","Follow")
            onClicked: Qt.openUrlExternally("https://twitter.com/RedisDesktop")
        }

        BetterButton {
            visible: false
            implicitWidth: 40
            iconSource: "qrc:/images/github.svg"            
            tooltip: qsTranslate("RDM","Star on GitHub!")
            onClicked: Qt.openUrlExternally("https://github.com/uglide/RedisDesktopManager")
        }

 

 

以下問題已解決:之前編譯的問題,系統后來重新裝過后,沒有繼續裝qt5-default,按照安裝流程重新編譯了一遍,安裝完只有Qt5.13.2 設置編譯后一切功能正常。

我這邊發現無法切換語言和字體,選擇后重新啟動還是原來一樣,別的沒問題,修改源代碼app/app.cpp 以及 翻譯 .ts  文件名規則,還是不行,debug顯示 加載load() 為 True 沒問題,有待解決:

  QTranslator translator;

  if (translator.load(QLocale(), "rdm", ".",QLatin1String(":/translations",".qm"))){
      qDebug() << "Load translations file for locale:" << locale;
      QCoreApplication::installTranslator(&translator);
  }else {
      qDebug() << "Load translations failed:";

  }
  /* QTranslator* translator = new QTranslator((QObject*)this);

  if (translator->load(QString(":/translations/rdm_") + locale)) {
    qDebug() << "Load translations file for locale:" << locale;
    QCoreApplication::installTranslator(translator);
  } else {
    qDebug() << "Load translations failed:" << QString(":/translations/rdm_") + locale;
    delete translator;
  }

  */
}

具體有其他問題可以留言

:)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM