18

I want to make a simple Debian package to install a simple tool that depends on Qt4 libs.

In control file I have defined that it depends on Qt4 libs however, by the time I'm testing the package it says that the dependency could not be met.

Question:

How can I make Debian trigger apt to install the dependencies as well?

Can't find that the documentation however I know that apt-get does that.

simhumileco
  • 31,877
  • 16
  • 137
  • 115
Nuno Santos
  • 1,476
  • 3
  • 17
  • 34
  • Do you depend on the normal Qt4 libs shipped with your distribution? Could you please post the exact details, i.e. the "Depends" specification and the apt-get call with errors? – thiton Dec 12 '11 at 16:44
  • It sounds to me like your package is correct, but that the dependency doesn't exist in the apt mirror(s) you're using. Please post your complete error message. – Jonathan Hall Dec 13 '11 at 01:43
  • `dpkg` is a low level tool and doesn't take dependencies into account. Carlos has the right idea for using gdebi, as it pulls in dependencies when you run it without having to use `apt`, which you can also use as Thomas pointed out. – NuclearPeon May 12 '15 at 19:09
  • Simply add needed packages to PreDepends section and to cinst file – ETech Sep 27 '17 at 13:07

5 Answers5

26

If you want to avoid creating a local APT repository, you can do:

dpkg -i mypackage.deb
apt-get install --fix-missing

If you do want to create a local repository, you can use reprepro for this.

Thomas Leonard
  • 7,068
  • 2
  • 36
  • 40
17

If you install it via dpkg it won't work because dkpg doesn't know where to find additional dependencies. You could do it via apt-get if you build your own repo, but it's kind of time-consuming the first time (it's not difficult, just something "new" the first time that needs some time to be learnt).

On the other hand, and the solution you are probably looking for is gdebi (you may need to install it: apt-get install gdebi-core). It's a tool that checks the dependencies for a package and calls apt-get to fetch and install them, and then calls dpkg to install your package.

Carlos Campderrós
  • 22,354
  • 11
  • 51
  • 57
  • Hummm. I see... The thing is. I need to make an installer. For example. When you download Skype it comes in a .deb. Does it bring all the libs it needs? Should I include all the libs I need? How should I rely on apt to fetch the dependencies? The problem of packing the dependecies is that they can mess with the target system. Is your suggestion of a local rep valid for a distribution. Idea: I could create that local rep by the time I run the .deb and then call the apt-get on post install... but this doesn't seem a valid solution... – Nuno Santos Dec 12 '11 at 17:03
  • During the install process, install gdebi from the apt repo and then execute `gdebi your-package.deb`. It will fetch all the dependencies from the configured apt repositories in that machine (if they are available at the repo). Or there is any other problem I don't understand? – Carlos Campderrós Dec 12 '11 at 17:18
  • Will gdebi mark installed packages as dependencies for package I want to install? – Trismegistos Oct 06 '12 at 17:28
  • 2
    You want "gdebi-core", not "gdebi" package; however, the command-line utility is called "gdebi". – Shnatsel Feb 01 '13 at 01:02
12

Per @textshell in this answer:

starting with apt 1.1 (available in Xenial (16.04), stretch) apt install also allows local files:

sudo apt install ./foo-1.2.3.deb

So much simpler and cleaner.

See the release announcment

This will also install dependencies, just like a normal apt install or apt-get install.

7

If you're creating the Debian package, you specify its dependencies in the debian/ directory control files; I believe debian/control takes Depends: directives for that purpose.

I don't know the details too clearly, myself, but there are instructions at http://www.debian.org/doc/manuals/maint-guide/ ; in particular, http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control seems to be the right place to start looking.

BRPocock
  • 13,638
  • 3
  • 31
  • 50
  • 1
    Hi, I think `Depends: ` will only check if the dependency is installed and will stop the installation of deb package accordingly. The solution I am looking for is to install those dependencies automatically as a part of deb isntallation. Would you please have a look at this question : http://stackoverflow.com/questions/22907113/how-to-install-dependencies-while-creating-a-deb-installer – exAres Apr 07 '14 at 08:40
3

One way would be to create a local package repository on your computer and add it to /etc/apt/sources.list. Then you could install the package from your local repository with apt-get and have the dependencies resolved automatically.

There's probably an easier way to do it, but I don't know what that would be.

Jonathan
  • 1,163
  • 7
  • 12