Linux find if library installed

How to check if a shared library is installed?

My question originates from my problem in getting ffmpeg started. I have installed ffmpeg and it is displayed as installed:

whereis ffmpeg ffmpeg: /usr/bin/ffmpeg /usr/bin/X11/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz 

Later, I figured out, that some programs depend on libraries that do not come with the installation itself, so I checked with ldd command what is missing:

# ldd /usr/bin/ffmpeg linux-vdso.so.1 => (0x00007fff71fe9000) libavfilter.so.0 => not found libpostproc.so.51 => not found libswscale.so.0 => not found libavdevice.so.52 => not found libavformat.so.52 => not found libavcodec.so.52 => not found libavutil.so.49 => not found libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5f20bdf000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5f209c0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5f205fb000) /lib64/ld-linux-x86-64.so.2 (0x00007f5f20f09000) 

As it turns out my ffmpeg is cut off from 7 libraries too work. I first thought that each of those libraries have to be installed, but than I figured out, that some or all might be installed, but their location unknown to ffmpeg. I read that /etc/ld.so.conf and /etc/ld.so.cache contain the paths to the libraries, but I was confused, because, there was only one line in

/etc/ld.so.conf cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf 

but a very long /etc/ld.so.cache . I am now at a point where I feel lost how to investigate further, It might be a helpful next step to figure out, how I can determine if a given library is indeed installed even if its location unknown to ffmpeg.

---------Output---of----apt-cache-policy-----request--------- apt-cache policy Package files: 100 /var/lib/dpkg/status release a=now 500 http://archive.canonical.com/ubuntu/ trusty/partner Translation-en 500 http://archive.canonical.com/ubuntu/ trusty/partner i386 Packages release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner origin archive.canonical.com 500 http://archive.canonical.com/ubuntu/ trusty/partner amd64 Packages release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner origin archive.canonical.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main origin security.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/main Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/main i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 700 http://extra.linuxmint.com/ rebecca/main i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin extra.linuxmint.com 700 http://extra.linuxmint.com/ rebecca/main amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin extra.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/import i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/upstream i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/main i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/import amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/upstream amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/main amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin packages.linuxmint.com Pinned packages: 

Источник

Читайте также:  Kali linux persistence gparted

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 package manager? What shell? What language? You need to provide details in order to receive help.

Define «library/package». This covers a lot of territory. Also, installing things without user interaction requires root access.

Technically installing things the normal distribution way, ie, system wide would require root access. Grabbing a private copy from somewhere and storing it under the user’s directory for use by a single user/application would not, though I’d personally be unhappy if I wasn’t asked to confirm any fetches of remotely sourced binaries. But for something common like readline, I’d think it much better to trigger the distribution’s packager to supply it.

@JimGarrison library/package will be any thing but will be relevant to ruby language i.e compiling dependency for ruby e.g readline or openssl etc

4 Answers 4

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.

#!/bin/sh for P; do dpkg -s "$P" >/dev/null 2>&1 && < echo "$P is installed." >|| < echo "$P is not installed." >done 

script.sh package1 package2 . packageN

Читайте также:  Linux перезапустить сетевую карту

Be careful: If dpkg -s returns 0 , it doesn’t necessarily mean that the package is fully/correctly installed. dpkg -s also returns 0 if the package is in half-configured or in config-files state (and I guess also in half-installed , but I didn’t check that). See the man page of dpkg for further «incomplete» states.

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:

Источник

How to find location of installed library

Background: I’m trying to build my program but first I need to set up libraries in NetBeans. My project is using GLU and therefore I installed libglu-dev. I didn’t note the location where the libraries were located and now I can’t find them. I’ve switched to Linux just a few days ago and so far I’m very content with it, however I couldn’t google this one out and became frustrated. Is there way to find out where files of package were installed without running the installation again? I mean if I got library xxx and installed it some time ago, is there some-command xxx that will print this info? I’ve already tried locate, find and whereis commands, but either I’m missing something or I just can’t do it correctly. For libglu, locate returns:

/usr/share/bug/libglu1-mesa /usr/share/bug/libglu1-mesa/control /usr/share/bug/libglu1-mesa/script /usr/share/doc/libglu1-mesa /usr/share/doc/libglu1-mesa/changelog.Debian.gz /usr/share/doc/libglu1-mesa/copyright /usr/share/lintian/overrides/libglu1-mesa /var/lib/dpkg/info/libglu1-mesa:i386.list /var/lib/dpkg/info/libglu1-mesa:i386.md5sums /var/lib/dpkg/info/libglu1-mesa:i386.postinst /var/lib/dpkg/info/libglu1-mesa:i386.postrm /var/lib/dpkg/info/libglu1-mesa:i386.shlibs 

The other two commands fail to find anything. Now locate did its job, but I’m sure none of those paths is where the library actually resides (at least everything I was linking so far was in /usr/lib or /usr/local/lib ). libglu was introduced just as example. I’m looking for a general solution for this problem.

Читайте также:  Extract rar archive linux

Источник

Оцените статью
Adblock
detector