Extra dependencies in Gambas packager (EXPLAINED)

Post your Gambas programming questions here.
Post Reply
User avatar
Posts: 36
Joined: Friday 23rd September 2016 11:41am
Location: Netherlands

Extra dependencies in Gambas packager (EXPLAINED)

Post by gbWilly » Monday 27th May 2019 4:37pm


I noticed in another topic there is some misunderstandings on how to use the 'Extra dependencies' part of the Gambas IDE packager.

I didn't want to steal the topic there with a reply so I decided to try and explain it in a new topic (better to find anyway than hidden in a gb.gui error topic :D )

Let's take a very simple example.

Let's say you used tar in a Shell command in you code to extract some files from an archive to a certain location. The application works well and you decide to package it for all available distro's the Gambas packager has to offer.

First question in mind should be, do all these distro's have tar installed by default?
Or maybe they have but the person using it prefers another tool and uninstalled tar.

What will happen if you have packaged your application and this person installs it on his/her tar-free system and runs it? Exactly, in the best case scenario it will fail to extract the files from the archive, worst case it will crash your application. Either way, it won't work :(

So, what to do about this as you can impossibly know if every person in the world running your application has tar installed.

Well, you can force tar being installed on their systems if they want to use your application.


You might have guessed by now, Extra dependencies ;)

In you terminal do tar --version, so you know what version of tar works with your code.
Next, when packaging, on tab 'Extra dependencies' write following in the respective fields of the first row:
- Package: tar
- Min. version: 1.27.1*
- Max. version:

* 1.27.1 was the version returned on my sytem when doing tar --version

Next continue packaging.

Now these packages will contain a dependency on tar or higher version.
If you distribute this package and tar is not installed on the target system these are possible senarios:
1. Tar is in the repository of the distribution, so upon installing your package the dependencies will be installed from the distro repository.
2. Tar is not in the repository of the distribution, so upon installing your package the dependencies will not be met and your package will not install. The user will know it is because of a failing dependency on tar.

Hope this clarifies the matter a bit.

There is an even more interesting manner of using this, writing your 'all over used, look-alike code in many different applications' into an one abstracted version an put it in a Gambas library and next have your many applications use them and depend on them. Big advantage here is one point of maintenance for all this commonly used code.
Next distribute packages of your dependent library along side the package of the applications that depend on it, and it will all work just fine if all gets installed in the proper order (meaning libraries first, next the application).

- Dutch translation for Gambas3
- Gambas wiki content contributer

... there is always a Catch if things go wrong!

Post Reply