Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 從零建置 Qt 4.8.4 開發環境:依賴套件、配置參數與常見錯誤排解

編輯:關於 Linux

Qt 開發環境建置需先完備 G++、X11、OpenGL、GTK 等大量依賴庫。本文以 Qt 4.8.4 為例,詳細列出 apt-get 安裝 30+ 依賴套件指令、./configure 參數說明、Basic XLib functionality test failed 等常見錯誤對應方案(補裝 libX11-dev、libXext-dev、libXtst-dev),以及 WebKit -fuse-ld=gold GCC 相容性問題的修正方法。

核心依賴安裝(節錄)

sudo apt-get install build-essential
sudo apt-get install libx11-dev libxext-dev libxtst-dev libglib2.0-dev libssl-dev \
  libgtk2.0-dev libcups2-dev libgl1-mesa-dev libglu1-mesa-dev \
  libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

配置與編譯

tar zxvf qt-everywhere-opensource-src-4.8.4.tar.gz
cd qt-everywhere-opensource-src-4.8.4
./configure -prefix /usr/local/Qt-4.8.2
# 選擇 open source edition,輸入 yes 授權
make -j$(nproc)
make install

常見錯誤修正

  • cannot find -lXext → 補裝 libX11-dev libXext-dev libXtst-dev
  • Package gstreamer-app-0.10 not found → 裝 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
  • g++: error: unrecognized command line option '-fuse-ld=gold' → 編輯 src/3rdparty/webkit/Source/common.pri 註解 QMAKE_LFLAGS+=-fuse-ld=gold

完成上述步驟,Qt 將安裝至 /usr/local/Qt-4.8.2,可供 Qt Creator 指定版本進行跨平台開發。

Copyright © Windows教程網 All Rights Reserved