Ubuntu 20.02にlibqt4-devをインストールする方法

Ubuntu 20.02にlibqt4-devをインストールする方法

Ubuntu 20.04にインストールしようとしていますが、libqt4-dev次のエラーが発生します。

kjs@PC:~/Downloads$ sudo apt-get install -y libqt4-dev
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libqt4-dev : Depends: libqt4-dbus (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-declarative (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-designer (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-dev-bin (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: libqt4-help (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-network (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-qt3support (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-script (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-scripttools (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-sql (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-svg (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-test (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-xml (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqt4-xmlpatterns (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqtcore4 (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: libqtgui4 (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
              Depends: qt4-linguist-tools (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: qt4-qmake (= 5:4.8.7+dfsg-7ubuntu4rock7)
              Depends: qtchooser (>= 55-gc9562a1-1~)
              Recommends: libqt4-opengl-dev (= 5:4.8.7+dfsg-7ubuntu4rock7) but it is not going to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

その後、私は以下を試しました。

sudo add-apt-repository ppa:rock-core/qt4 
sudo apt-get update
sudo apt-get install libqtcore4

次のエラーが発生しました。

~$ sudo apt-get install libqtcore4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libqtcore4 : Breaks: libqtcore4:i386 (!= 5:4.8.7+dfsg-7ubuntu4rock7) but 4:4.8.7+dfsg-5ubuntu2 is to be installed
 libqtcore4:i386 : Breaks: libqtcore4 (!= 4:4.8.7+dfsg-5ubuntu2) but 5:4.8.7+dfsg-7ubuntu4rock7 is to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

また、次のようにQt5をインストールしようとしました。

sudo apt-get install git g++ python libeigen3-dev zlib1g-dev libqt5opengl5-dev libqt5svg5-dev libgl1-mesa-dev libfftw3-dev libtiff5-dev libpng-dev

次のエラーが発生しました。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:9.3.0-1ubuntu2).
g++ set to manually installed.
libpng-dev is already the newest version (1.6.37-2).
git is already the newest version (1:2.25.1-1ubuntu3.10).
libgl1-mesa-dev is already the newest version (21.2.6-0ubuntu0.1~20.04.2).
libgl1-mesa-dev set to manually installed.
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu1.5).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libfftw3-dev : Depends: libfftw3-bin (= 3.3.8-2ubuntu1)
                Depends: libfftw3-double3 (= 3.3.8-2ubuntu1) but it is not going to be installed
                Depends: libfftw3-long3 (= 3.3.8-2ubuntu1) but it is not going to be installed
                Depends: libfftw3-quad3 (= 3.3.8-2ubuntu1) but it is not going to be installed
 libqt5opengl5-dev : Depends: libqt5opengl5 (= 5.12.8+dfsg-0ubuntu2.1) but it is not going to be installed
                     Depends: qtbase5-dev (= 5.12.8+dfsg-0ubuntu2.1)
 libqt5svg5-dev : Depends: libqt5svg5 (= 5.12.8-0ubuntu1) but it is not going to be installed
 libqtgui4:i386 : Depends: libpng12-0:i386 (>= 1.2.13-4) but it is not going to be installed
                  Recommends: qt-at-spi:i386 but it is not going to be installed
 python : PreDepends: python-minimal (= 2.7.11-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.11-1~) but it is not going to be installed
          Depends: libpython-stdlib (= 2.7.11-1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答え1

Ubuntu 20.04は公式リポジトリからすべての依存qt4関係を削除します。libqt4-*このPPAリポジトリをシステムに追加すると、問題が解決する可能性があります。

sudo add-apt-repository ppa:rock-core/qt4
sudo apt-get update

それからqt4

sudo apt-get install libqtcore4

関連情報