Search code examples
c++user-interfacegtkapt-getubuntu-20.04

Install libgtk-3-dev on Ubuntu 20.04


I would like to write a GUI in cpp. As far as I know gtk is a nice solution for this. Sadly it appears to me that gtk is no longer available under Ubuntu 20.04. (I am using Xubuntu if this matters)

Executing: sudo apt install libgtk-3-dev

Leads to:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgtk-3-dev : Depends: gir1.2-gtk-3.0 (= 3.24.20-0ubuntu1) but 3.24.20-1 is to be installed
                Depends: libatk-bridge2.0-dev but it is not going to be installed
                Depends: libatk1.0-dev (>= 2.15.1) but it is not going to be installed
                Depends: libcairo2-dev (>= 1.14.0) but it is not going to be installed
                Depends: libfontconfig1-dev but it is not going to be installed
                Depends: libgdk-pixbuf2.0-dev (>= 2.40.0) but it is not going to be installed
                Depends: libglib2.0-dev (>= 2.57.2) but it is not going to be installed
                Depends: libpango1.0-dev (>= 1.41) but it is not going to be installed
                Depends: libxi-dev but it is not going to be installed
                Depends: libgtk-3-0 (= 3.24.20-0ubuntu1) but 3.24.20-1 is to be installed
E: Unable to correct problems, you have held broken packages.

I added "deb http://archive.ubuntu.com/ubuntu focal-updates main" as suggested and tried again resulting in:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgtk-3-dev : Depends: libatk-bridge2.0-dev but it is not going to be installed
                Depends: libatk1.0-dev (>= 2.15.1) but it is not going to be installed
                Depends: libcairo2-dev (>= 1.14.0) but it is not going to be installed
                Depends: libfontconfig1-dev but it is not going to be installed
                Depends: libgdk-pixbuf2.0-dev (>= 2.40.0) but it is not going to be installed
                Depends: libglib2.0-dev (>= 2.57.2) but it is not going to be installed
                Depends: libpango1.0-dev (>= 1.41) but it is not going to be installed
                Depends: libxi-dev but it is not going to be installed
                Depends: libgtk-3-0 (= 3.24.20-0ubuntu1) but 3.24.20-1 is to be installed
E: Unable to correct problems, you have held broken packages.

I am looking for a solution to install libgtk-3-dev.


Solution

  • The problem is that the proper version of the library libgtk-3-dev and related dependencies are not in the main focal repository yet. My solution was to add focal-updates repo. You can do it through GUI (Software&Update) or by manually editing file:

    /etc/apt/sources.list
    

    and adding following line:

    deb http://archive.ubuntu.com/ubuntu focal-updates main
    

    An update of repo list can be necessary (if you are working from command line):

    sudo apt update
    

    Then I was able to install the library (I used Synaptic manager) without any problems. And finally I have disabled the focal-updates repo to stay just with release repo as before, not to automatically update other not-yet-released libraries.