編譯Qt5.15.16并啟用pdf模塊
標題1.目錄設置
-q-bulid
–qt-everywhere-src-5.15.16
–bulid
cd bulid
必須,否則會提示Project ERROR: You cannot configure qt separately within a top-level build.
create .qmake.stash and .qmake.super in build folder for MACOSX build
2. config,執行前請確保使用的是python3
../qt-everywhere-src-5.15.16/configure -prefix /usr/local/Qt-5.15.16 -opensource -confirm-license -opengl desktop -c++std c++14 -nomake examples -nomake tests -release -skip qtdoc -skip qtlocation -no-build-qtwebengine-core -webengine-printing-and-pdf -ssl -framework
- 啟用pdf的關鍵:-no-build-qtwebengine-core -webengine-printing-and-pdf
- 如果要在項目中使用qml中的QtGraphicalEffects等高級功能,需要啟用OpenGL: -opengl desktop
- 如果在make時提示std::move等C++語法問題,要指定C++11(14)或更高的版本: -c++std c++14
編譯(-j8 表示使用 8 個線程,根據 CPU 調整)
attention: 如果出現編譯錯誤,有可能是源碼目錄加密導致的,聯系it解密
make -j8
3. 安裝
sudo make install
驗證
/usr/local/Qt-5.15.16/bin/qmake -v
檢查是否成功啟用pdf