User Tools

Site Tools


howtos:apt-file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
howtos:apt-file [24/05/2008 18:13] domingohowtos:apt-file [02/12/2018 21:34] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== How To Search For Missing Packages With apt-file On Debian and Ubuntu ======
  
 +===== 1 Initital Situation =====
 +
 +I guess you all know this: you try to compile some software from the sources, and suddenly the compilation stops because it complains that some file is missing of which you have never heard before:
 +
 +//
 +root@falko-desktop:~/avant-window-navigator-0.1.1# make \\
 +make all-recursive \\
 +make[1]: Entering directory `/root/avant-window-navigator-0.1.1' \\
 +Making all in src \\
 +make[2]: Entering directory `/root/avant-window-navigator-0.1.1/src' \\
 +if gcc -DHAVE_CONFIG_H -I. -I. -I.. -DORBIT2=1 -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/libwnck-1.0 -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -DDATADIR=\""/usr/local/share"\" -DGNOMELOCALEDIR=\""/usr/local/share/locale"\" -g -O2 -Wall -pedantic -std=c99  -fno-strict-aliasing -fmessage-length=0 -D_FORTIFY_SOURCE=2 -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.c; \ \\
 +then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi \\
 +<color red>main.c:21:21: error: gtk/gtk.h: No such file or directory</color>// \\
 +... \\
 +... \\
 +... \\
 +... \\
 +
 +
 +
 +
 +===== 2 Install apt-file =====
 +
 +apt-file is installed as follows:
 +
 +<file>
 +# apt-get install apt-file
 +</file>
 +
 +After the installation, we must update apt-file's package database like this:
 +
 +<file>
 +# apt-file update
 +</file>
 +
 +You must also do this whenever you modify /etc/apt/sources.list.
 +
 + 
 +
 +===== 3 Search For Packages =====
 +
 +Now let's search for the package containing the file gtk/gtk.h. You could search like this:
 +
 +<file>
 +# apt-file search gtk.h
 +</file>
 +
 +but this would give back lots of packages, so let's narrow down the search by running:
 +
 +<file>
 +# apt-file search gtk/gtk.h
 +</file>
 +
 +The output looks like this:
 +
 +<code>
 +root@falko-desktop:~/avant-window-navigator-0.1.1# apt-file search gtk/gtk.h 
 +libgfcui-dev: usr/include/gfc-2.0/gfc/gtk/gtk.hh 
 +libgtk+2.0-directfb-dev: usr/include/directfb/gtk-2.0/gtk/gtk.h 
 +libgtk1.2-dev: usr/include/gtk-1.2/gtk/gtk.h 
 +libgtk2.0-dev: usr/include/gtk-2.0/gtk/gtk.h 
 +libgtk2.0-doc: usr/share/doc/libgtk2.0-doc/gtk/gtk.html 
 +root@falko-desktop:~/avant-window-navigator-0.1.1# 
 +</code>
 +
 +As you see there are three packages containing gtk/gtk.h (one contains gtk/gtk.hh, another one gtk/gtk.html which is not what we are looking for), and it's now up to you to install the right one. If you are unsure, you can install all three packages, or you install one after the other and check after each one if the compilation error still occurs. In our case the right package is libgtk2.0-dev, so we install that one:
 +
 +<code>
 +# apt-get install libgtk2.0-dev
 +</code>
 +
 +Now we try the compilation again: 
 +
 +<code>
 +root@falko-desktop:~/avant-window-navigator-0.1.1# make
 +make all-recursive
 +make[1]: Entering directory `/root/avant-window-navigator-0.1.1'
 +Making all in src
 +make[2]: Entering directory `/root/avant-window-navigator-0.1.1/src'
 +if gcc -DHAVE_CONFIG_H -I. -I. -I.. -DORBIT2=1 -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/libwnck-1.0 -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -DDATADIR=\""/usr/local/share"\" -DGNOMELOCALEDIR=\""/usr/local/share/locale"\" -g -O2 -Wall -pedantic -std=c99 -fno-strict-aliasing -fmessage-length=0 -D_FORTIFY_SOURCE=2 -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.c; \
 +then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi
 +In file included from /usr/include/gtk-2.0/gtk/gtk.h:170,
 +from main.c:21:
 +/usr/include/gtk-2.0/gtk/gtktextbuffer.h:52: warning: ISO C restricts enumerator values to range of âintâ
 +/usr/include/gtk-2.0/gtk/gtktextbuffer.h:53: warning: ISO C restricts enumerator values to range of âintâ
 +/usr/include/gtk-2.0/gtk/gtktextbuffer.h:55: warning: ISO C restricts enumerator values to range of âintâ
 +In file included from main.c:28:
 +awn-app.h:30:29: error: libwnck/libwnck.h: No such file or directory
 +In file included from main.c:28:
 +awn-app.h:60: error: expected specifier-qualifier-list before âWnckWindowâ
 +awn-app.h:80: warning: struct has no members
 +awn-app.h:83: error: expected â)â before â*â token
 +main.c: In function âmainâ:
 +main.c:52: warning: unused variable âlabâ
 +make[2]: *** [main.o] Error 1
 +make[2]: Leaving directory `/root/avant-window-navigator-0.1.1/src'
 +make[1]: *** [all-recursive] Error 1
 +make[1]: Leaving directory `/root/avant-window-navigator-0.1.1'
 +make: *** [all] Error 2
 +root@falko-desktop:~/avant-window-navigator-0.1.1#
 +</code>
 +
 +As you see, the initial error is now gone, but still another file is missing, libwnck/libwnck.h, so let's search for the missing package:
 +
 +<file>
 +# apt-file search libwnck/libwnck.h
 +</file>
 +
 +This time we're lucky, there's only one package containing that file:
 +
 +<code>
 +root@falko-desktop:~/avant-window-navigator-0.1.1# apt-file search libwnck/libwnck.h
 +libwnck-dev: usr/include/libwnck-1.0/libwnck/libwnck.h
 +root@falko-desktop:~/avant-window-navigator-0.1.1#
 +</code>
 +
 +So let's install the missing package:
 +
 +<file>
 +# apt-get install libwnck-dev
 +</file>
 + 
 +//Source: http://www.howtoforge.com/apt_file_debian_ubuntu //