Linux-Mint

Ubuntu Qmake 不是執行檔

  • August 9, 2014

在 Ubuntu 中安裝新版本的 QtCreator 後,

tux-world@alachiq:~ > sudo apt-get install qt5-qmake build-essential g++ gcc
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  build-essential is already the newest version.
  g++ is already the newest version.
  g++ set to manually installed.
  gcc is already the newest version.
  qt5-qmake is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 247 not upgraded.

在選項中Build & Run並選擇 qmake/usr/bin/qmake我得到這個錯誤:

The qmake executable /usr/lib/i386-linux-gnu/qt4/bin/qmake could not be added: qmake '/usr/lib/i386-linux-gnu/qt4/bin/qmake' is not an executable.

在家庭系統中,安裝這些軟體包並在選項中設置 Qmake 後我沒有任何問題

其他資訊:

tux-world@alachiq:~ > apt-cache search qt5-qmake
qt5-qmake - Qt 5 qmake Makefile generator tool

tux-world@alachiq:~ > ldd /opt/qtForArm/bin/qmake 
    ldd: /opt/qtForArm/bin/qmake: No such file or directory

tux-world@alachiq:~ > sudo chmod +x /usr/lib/i386-linux-gnu/qt4/bin/qmake
[sudo] password for tux-world: 
chmod: cannot access ‘/usr/lib/i386-linux-gnu/qt4/bin/qmake’: No such file or directory

更新

tux-world@alachiq:~ > apt-cache policy qt5-qmake
qt5-qmake:
 Installed: 5.2.1+dfsg-1ubuntu14.2
 Candidate: 5.2.1+dfsg-1ubuntu14.2
 Version table:
*** 5.2.1+dfsg-1ubuntu14.2 0
       500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main i386 Packages
       100 /var/lib/dpkg/status
    5.2.1+dfsg-1ubuntu14 0
       500 http://archive.ubuntu.com/ubuntu/ trusty/main i386 Packages



tux-world@alachiq:~ > ls -a -l /usr/bin/qmake 
lrwxrwxrwx 1 root root 9 فوریه 19 15:53 /usr/bin/qmake -> qtchooser



tux-world@alachiq:~ > qtchooser 
Usage:
 qtchooser { -l | -list-versions | -print-env }
 qtchooser -run-tool=<tool name> [-qt=<Qt version>] [program arguments]
 <executable name> [-qt=<Qt version>] [program arguments]

Environment variables accepted:
QTCHOOSER_RUNTOOL  name of the tool to be run (same as the -run-tool argument)
QT_SELECT          version of Qt to be run (same as the -qt argument)

tux-world@alachiq:~ > 

您已經安裝了 qt5-qmake,但您的 Qt Creator 正在尋找 Qt4 版本的 qmake。您可以在 Tools -> Options -> Build & Run -> Qt Versions 中安裝 qt4-qmake 或將 Qt5 qmake 執行檔添加到 Qt Creator。

/edit 在問題更新後:

Qt 選擇器是一個根據其配置和/或環境變數自動選擇正確 Qt 二進製文件的工具。

如果你想使用 Qt 5 qmake,你只需要安裝包qt5-default。這會將/usr/bin/qmakeQt Chooser 提供的各種二進製文件(如 )指向您的 Qt 5 安裝。如果你想使用 Qt 4 qmake,你需要 install qt4-default,它做同樣的事情,但對於 Qt 4。

引用自:https://unix.stackexchange.com/questions/146809