0

I am getting an error about a missing package dependency that is already installed. I have seen versions of this questions about different packages and tried all those solutions, but I still can't figure out what the problem is or how to fix it. In summary: I am trying to apt-get install a package call libxmlada5-dev, which says it depends on a package called gnat. Fair enough, so I try to install gnat. But then gnat says it relies on gnat-4.9. Weird, but okay. So when I try to install gnat-4.9, it says it is actually already installed! I have tried uninstalling and re-installing gnat-4.9, I have tried sudo apt-get -f install, I have tried apt clean, etc. None of these options do anything, since it seems like the dependency is already met. Here is my specific error:

sudo apt-get install gnat
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:
 gnat : Depends: gnat-4.9 but it is not going to be installed

and here is where I try to update the dependency:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
gnat-4.9 is already the newest version (4.9.3-3ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

finally, here is what I get with listapt-cache policy gnat and gnat-4.9:

gnat:
  Installed: (none)
  Candidate: 4.9ubuntu2
  Version table:
     4.9ubuntu2 500
        500 https://my-company-apt-mirror.corp/ubuntu xenial/universe amd64 Packages

gnat-4.9:
  Installed: 4.9.3-3ubuntu5
  Candidate: 4.9.3-3ubuntu5
  Version table:
 *** 4.9.3-3ubuntu5 500
        500 https://my-company-apt-mirror.corp/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status

3 Answers 3

1

I figured out the problem. It turns out the error message on apt-get was completely useless and misleading (and if someone can point me in the right direction I'm happy to submit a bug report). But by downloading the package and trying to install it with dpkg -i, I found that gnat required a version of gcc less than 7. So 'all' I had to do was get rid of gcc-7 and downgrade all its dependencies to versions that use gcc-5.

0

I'm making an assumption that you are running Xenial (16.04 LTS).

The command apt-cache policy output codes 500 and 100 which means installable and installed status, respectively. I could not reproduce the same error here because I'm currently using Bionic, so I cannot give you a perfect answer. Try those options:

  • Source list:

Check your /etc/apt/sources.list. An example of a default Xenial source.list. Maybe you only have the main reference and the system cannot install. Those errors outputs of apt-get are misleading.

  • Manual remove of gnat:

First check if it is on your installed list, just to make sure:

dpkg -l | grep -w gnat.

Then you can uninstall with:

dkpg --purge (< probably need sudo here).

Finally

Try to install the library again, running sudo apt-get update before.

2
  • Thanks for the quick response. My sources.list was empty (though I have a lot of entries in sources.list.d), so I replaced it with that default list. No luck. When I did the dpkg command, I can see that gnat-4.9 is installed, but nothing named gnat. The sudo apt-get update does not do anything new either. Jul 20, 2020 at 20:18
  • And yes, I am on Xenial Jul 20, 2020 at 20:41
0

Better to avoid the APT gnat packages and download from here the current (2021) GNAT version which includes Gnat Studio, the free IDE for Ada, Spark, C/C++ and Python. After selecting the platform option, "x86 GNU Linux (64 bits)", go ahead and download the package.

Follow the README instructions inside the GNAT package - I know that they are very spare and may not put GNAT into the location that you may want but adapt them for your own desired folder location. Ensure to add the final installation's bin folder to your user's PATH environment variable via adding the following line to your /home/user-name/.profile file, e.g.

PATH="/usr/local/bin/GNAT/2021/bin:$PATH"

if /usr/local/bin is where you put the GNAT folder.

Check the visibility of the installation by running the following command on the terminal:

~ $ grpbuild --version

You should see output for GNAT 2021 like:

GPRBUILD Community 2021 (20210519) (x86_64-pc-linux-gnu)
Copyright (C) 2004-2021, AdaCore
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You can start up the GNAT Studio IDE via running the command:

gnatstudio

But it is nicer to create a desktop launcher for this application so you can launch the GNAT package's GNAT Studio IDE from the Show Applications menu.

Navigate the file system to /home/user-name/.local/share/applications and right-click on the mouse and choose "Open in Terminal".

/home/user-name/.local/share/applications $ gedit gnatstudio.desktop

Now copy and paste the following into this file:

[Desktop Entry]
Name=GNAT Studio
GenericName=IDE
Exec=/usr/local/bin/GNAT/2021/bin/gnatstudio %u
Icon=/usr/local/bin/GNAT/2021/share/gnatstudio/gnatstudio-splash.png
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Network;WebBrowser;
Keywords=web;browser;internet;
Actions=new-window;new-private-window;
StartupWMClass=GNATSTUDIO

[Desktop Action new-window]
Name=Open a New Window
Exec=/usr/local/bin/GNAT/2021/bin/gnatstudio %u

[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=/usr/local/bin/GNAT/2021/bin/gnatstudio --private-window %u

NOTE 1: If you have chosen to put the GNAT folder in say /home/user-name/opt then just substitute that file path for /usr/local/bin in the Excec and Icon assignments above.

Save the file and close it.

Now check the Show Applications menu for the GNAT Studio icon and check its operability by clicking it.

NOTE 2: The desktop launcher icons are square-shaped, so any icon image assigned to them is automatically squashed into a square - resulting in a distorted launch icon. The gnatstudio-splash.png icon is originally oblong so distortion will occur. You can make the desktop launcher icon more faithful to itself by cropping gnatstudio-splash.png to a more square shape on GIMP/PhotoShop, saving it as gnatstudio-launch-icon.png, exporting it back to the /usr/local/bin/GNAT/2021/share/gnatstudio folder and assigning it to the Icon field of your gnatstudio.desktop file. This will give you a regular looking launcher icon.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .