which libs are a header file belongs to [duplicate] - linux

This question already has answers here:
Ubuntu equivalent of Yum's WhatProvides, to find which package provides a file
(2 answers)
Closed 5 years ago.
OS:Debian9 Linux4.4
Hardware:ARMv9
How do i know which libs is a header file in /usr/include/ belongs to?
for example,
there is an error when I build camera-app-gstreamer:
camera-app-gstreamer/xcore'
drm_display.h:30:17: fatal error: drm.h: No such file or directory
#include <drm.h>**
I fixed it by apt install libdrm-dev, after installing libdrm-dev, header files named drm.h, drm*.h appears in /usr/include.
now, I have Make problem , it shows:
conftest.c:29:41: fatal error: linux/atomisp.h: No such file or directory
#include <linux/atomisp.h>
and how can I find which lib it belongs to ?
Thank you.

In case you know the complete path to the file and in case it is installed (maybe on a computer where it works), you can go with this dpkg cheat sheet to find out which package installs it:
dpkg-query -W <pattern> — list locally known packages matching given pattern
dpkg-query -l — list all locally known packages
dpkg -i <packagefile> — install the package in the given file
dpkg -r <package> — remove the given package
dpkg -S /path/to/file — show the package which installed the given file
If you want to find out whether a file is installed on a system, you can use the locate tools.
If you want to find out which package will install it, you should install the apt-file tools and use them:
sudo apt-get install apt-file
sudo apt-file update # will take a while but needs not to be repeated often
apt-file search drm.h
This will list the packages your package management system knows which contain a file with this as part of the name. You can append | grep '/drm.h$' to find only the ones which have exactly this file.

Use the package content search of your distribution, in this case you can find it here.
If you cannot find the filename through that search, it means there is no debian package providing it.

Related

How to search and install the appropriate package of a software in RHEL distro?

I'll like to know how can I reach the software's package, so I'll know what to install with yum. For example, if I need to use the nslookup command, I need to install the bind-utils package.
Is there a way to find by myself what package needs to be installed?
Thanks in advance!
yum whatprovides
check the man page for yum:
Provides Command
Command: provides
Aliases: prov, whatprovides, wp
dnf [options] provides <provide-spec>
Finds the packages providing the given <provide-spec>.
This is useful when one knows a filename and wants to find
what package (installed or not) provides this file. The
<provide-spec> is gradually looked for at following
locations:
1. The <provide-spec> is matched with all file provides of
any available package:
$ dnf provides /usr/bin/gzip
gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Filename : /usr/bin/gzip
2. Then all provides of all available packages are
searched:
$ dnf provides "gzip(x86-64)"
gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Provide : gzip(x86-64) = 1.9-9.fc29
3. DNF assumes that the <provide-spec> is a system
command, prepends it with /usr/bin/, /usr/sbin/
prefixes (one at a time) and does the file provides
search again. For legacy reasons (packages that didn’t
do UsrMove) also /bin and /sbin prefixes are being
searched:
$ dnf provides zless
gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Filename : /usr/bin/zless
4. If this last step also fails, DNF returns “Error: No
Matches found”.
This command by default does not force a sync of expired
metadata. See also Metadata Synchronization.

Remove perl package completely

I am trying to uninstall the old perl package and install a new package. I used rpm -e to uninstall the old package. I could still see the below files after uninstalling. How can i completely remove the perl package from my server. It runs on OEL 6.10. And when I do "perl -v" , I could see 5.30 version as output, even after uninstalling perl.
/opt/CWx/perl
/opt/CWx/modules/installed/Module-Build-0.4005/inc/Perl
/opt/CWx/modules/installed/Perl-OSType-1.003/blib/lib/Perl
/opt/CWx/modules/installed/Perl-OSType-1.003/blib/lib/auto/Perl
/opt/CWx/modules/installed/Perl-OSType-1.003/blib/arch/auto/Perl
/opt/CWx/modules/installed/Perl-OSType-1.003/lib/Perl
/opt/CWx/modules/Module-Build-0.4208/inc/Perl
/usr/src/kernels/2.6.32-754.11.1.el6.x86_64/tools/perf/scripts/perl
/usr/src/kernels/2.6.32-754.6.3.el6.x86_64/tools/perf/scripts/perl
/usr/src/kernels/2.6.32-754.2.1.el6.x86_64/tools/perf/scripts/perl
/usr/local/share/perl5_old/Perl
/usr/local/bin/perl
If you want to know which package installed a file you can use the command:
rpm -q --whatprovides [filename]
For example, for the first file in your list:
rpm -q --whatprovides /opt/CWx/perl
None of the files you list are in locations which are used by the standard Perl RPM on a RedHat-based system. You will, I expect, find that they are either installed by a completely different package or not installed by a package at all.
And that will also explain why you can still access Perl. Those files include other versions of the Perl compiler and I bet that whoever installed them also changed the PATH so that you have access to at least one of them.
If you want to know which Perl installation is responding to your commands, just run this:
which perl

<br>how to install nagios check_procs plugin in nagios</br>

I am new to nagios and I have installed nagios 3 on my linux machine.
i want to install nagios check_procs plugin.can any one suggest me.thanks
You can install from package which depends on Linux distribution you use.
If it is rpm based then install "nagios-plugins" package.
rpm -qf /usr/lib64/nagios/plugins/check_procs
nagios-plugins-1.4.15-2.el6.rf.x86_64
From the tags you've marked on your question, I assume you are using ubuntu as Operative System to your Nagios' Server,
First of all try to verify where is your resources file
# find /* -name resource.cfg
The answer should be something like '/usr/local/nagios/etc/resource.cfg'
Then find where are your plugins, pointed in the resources by the $USER1$ variable (the code below assumes your resources.cfg is in /usr/local/nagios/etc/
# grep '\$USER1\$' /usr/local/nagios/etc/resource.cfg
You'll get the folder of your scripts (in my case it is /usr/local/nagios/libexec/):
$USER1$=/usr/local/nagios/libexec
If in that folder you do not find a check_procs, than you'll need to install a newer version of nagios plugins:
- you can either run the command bellow
apt-get install nagios-plugins
Otherwise you can go to the official Nagios' site and download/install the plugins package: http://www.nagios.org/download/plugins, inside the nagios-plugins .tar.gz archive there is a README file with good instructions for the manual installation process

find whether a library is installed using shell script

I'm complete noobs in shell script what i want is shell script that determine a list of library/package currently installed if not install them without user permission
What I want is to determine the library/package is currently installed or not in system
I'm aware of aptitude search command but I looking for a better solution
e.g I have define(in shell script) check for readline library/package now how can I from inside the shell script (I want to create) know that readline package is currently installed or not.
Any idea or suggestion would certainly help
What I want is to determine the library/package is currently installed or not in system
dpkg -s does not require root permission, and will display package status details.
Example shell script:
#!/bin/sh
for P; do
dpkg -s "$P" >/dev/null 2>&1 && {
echo "$P is installed."
} || {
echo "$P is not installed."
}
done
Usage is:
script.sh package1 package2 .... packageN
For simply doing the test, it would seem that you could grep the output of a command such as ldconfig -p for your library of interest.
Or you could supply a tiny test program linked against the desired library, try running it, and test for non-failure.
If you are trying to set up a dependency check, the proper solution is to create a dummy package which Depends: on the packages you need to have installed. There is a tool called equivs which somewhat helps with this. (However, it has been criticized as being "over-engineered"; certainly, if you are familiar with the format of Debian packages, you might not need a separate tool if your requirements are this simple.) Then you just install this package and it will pull in the packages which are specified as dependencies.
You still have to know that the library which provides libreadline.so is libreadline5-dev. Debian package search can help find the package names you need to put in Depends:
You can probably do what you want with dpkg

autoconf error on ubuntu 11.04

i've been googling and installing libraries for a while, but I couldn't quite handle this problem with autoconf.
i have downloaded a program that i want to compile, made a few changes, and need to run autogen.sh and ./configure and make install respectively.
however, when i try to run autogen.sh, i get the following error;
configure.ac:225: error: possibly undefined macro: AM_PATH_GTK_2_0
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
so i went on, downloaded autoconf-2.68, automake-1.11, m4-1.4.16, and tried sudo apt-get install libgtk2.0-dev, none of which changed the outcome. when i try aclocal, i again get the error
configure.ac:225: warning: macro `AM_PATH_GTK_2_0' not found in library
i'm currently stuck, and got nowhere to go. so i'd be glad for any suggestion.
I know it's a bit late, but you just have to install the library libgtk2.0-dev:
sudo apt-get install libgtk2.0-dev
If you get errors about something related to GLIB, then install libglib2.0-dev as well:
sudo apt-get install libglib2.0-dev
Given the name AM_PATH_GTK_2_0, one makes the following sequence of observations:
1) "AM_" is in automake's namespace, so that m4 macro must come from automake.
2) Hmmm, it isn't in automake.
3) It probably comes from gtk, so the gtk developer's have made an error in naming
their m4 macro in conflict with automake. That's a bug in gtk, but I'll probably need
to download the newest version of gtk to get the macro.
The problem is that you don't have the m4 macro that gtk expects you to have. You probably need to install libgtk-devel (or something like that). If I am correct and libgtk is indeed installing an m4 macro named AM_..., please report that as a bug to the developers. They are stomping on automakes' namespace (this is, unfortunately, an extremely common error.)
Since you mention downloading automake, I think the problem is that you are running aclocal that is not looking in /usr/share/aclocal, but in a different location (ie, you installed automake in /usr/local) When you installed libgtk-dev, it probably installed the *.m4 file in /usr/share/aclocal, but you need that file in /usr/local/share/aclocal (or $prefix/share/aclocal, where prefix is what you used to install automake.) The simplest solution is to copy that file to $(aclocal --print) That is, run "aclocal --print" to see where aclocal is looking for m4 files, then find the file that libgtk-dev installed that defines the improperly named m4 macro and copy that file to the appropriate location. Alternatively (and probably a better solution) you can put a file named dirlist in $(aclocal --print) that contains the single line "/usr/share/aclocal", so that your hand installed aclocal will always look for m4 files that are installed in /usr/share.
In case of same issue on CenOS/RedHat:
sudo yum install gtk2-devel

Resources