Linux list libraries installed

Where are package library and header files installed?

After downloading and installing a package in Ubuntu, how can I check where the library and header files were written to? I believe that this has something to do with the package’s .pc file, but I do not know how to find that file either. For example, I have downloaded the PCL (Point Cloud Library) package, and then in a sample CMakeLists.txt file, I have been given the following:

include_directories($) link_directories($) add_definitions($) 

Where are these environment variables defined, and how can I see them? If I compiled the libraries from source rather than through a package, will this be any different? Will a .pc file be created automatically?

That just returns an empty line. However, compiling my project as above works fine so it must be using the PCL libraries. Is it searching anywhere else?

If you installed a debian package you can see the content via dpkg -L . If you install from source, it depends heavily on the source and you need to familiarise yourself with the build system it uses.

I had similar confusions. You can check to what values $ resolves to by using message command in your CMakeLists.txt i.e. add this line: message(«$) or message(«PCL_INCLUDE_DIRS = » $) . It will display the result when you run cmake .. Do the same for other macros/variables i.e. $ and $

Читайте также:  Самый удобный дистрибутив linux

2 Answers 2

If you install the package containing the libpcl development files

sudo apt-get install libpcl-dev 

You can list the installed files

an see the location of all headers.

. /usr/include/pcl-1.7/pcl/filters/fast_bilateral.h /usr/include/pcl-1.7/pcl/filters/voxel_grid_covariance.h /usr/include/pcl-1.7/pcl/filters/voxel_grid_occlusion_estimation.h /usr/include/pcl-1.7/pcl/filters/median_filter.h /usr/include/pcl-1.7/pcl/filters/crop_box.h /usr/include/pcl-1.7/pcl/filters/voxel_grid_label.h /usr/include/pcl-1.7/pcl/filters/covariance_sampling.h /usr/include/pcl-1.7/pcl/filters/random_sample.h /usr/include/pcl-1.7/pcl/filters/normal_refinement.h /usr/include/pcl-1.7/pcl/filters/project_inliers.h /usr/include/pcl-1.7/pcl/filters/fast_bilateral_omp.h /usr/include/pcl-1.7/pcl/filters/clipper3D.h /usr/include/pcl-1.7/pcl/filters/convolution.h /usr/include/pcl-1.7/pcl/filters/passthrough.h /usr/include/pcl-1.7/pcl/filters/conditional_removal.h /usr/include/pcl-1.7/pcl/filters/impl /usr/include/pcl-1.7/pcl/filters/impl/frustum_culling.hpp /usr/include/pcl-1.7/pcl/filters/impl/conditional_removal.hpp /usr/include/pcl-1.7/pcl/filters/impl/convolution_3d.hpp /usr/include/pcl-1.7/pcl/filters/impl/voxel_grid_covariance.hpp /usr/include/pcl-1.7/pcl/filters/impl/fast_bilateral_omp.hpp /usr/include/pcl-1.7/pcl/filters/impl/project_inliers.hpp /usr/include/pcl-1.7/pcl/filters/impl/morphological_filter.hpp /usr/include/pcl-1.7/pcl/filters/impl/crop_box.hpp /usr/include/pcl-1.7/pcl/filters/impl/covariance_sampling.hpp /usr/include/pcl-1.7/pcl/filters/impl/local_maximum.hpp /usr/include/pcl-1.7/pcl/filters/impl/plane_clipper3D.hpp /usr/include/pcl-1.7/pcl/filters/impl/bilateral.hpp /usr/include/pcl-1.7/pcl/filters/impl/voxel_grid_occlusion_estimation.hpp . 

Источник

How do I get a list of shared library filenames under Linux?

Is there a GNU Linux built-in for getting a list of the filenames of shared libraries? I have considered parsing the output of ldconfig -p . However, I’m not sure about consistency in output from system to system. I am already aware that I could use find but given that the linker / loader has a cache of libraries and locations, it seems more efficient to use it in some way. Additionally, the paths that the linker / loader searches are the only ones I’m concerned with—i.e libraries that have been processed by ldconfig .

1 Answer 1

If you want to catch them all, there is no other choice but to do full filesystem traversals. ldconfig knows only about the libraries in the standard paths and the extra paths it is configured to look in (usually defined in /etc/ld.so.conf* ). The usual suspect places where other libraries can be found are $HOME and /opt , though there is no limit, especially when people build applications themselves.

If you don’t trust the output of ldconfig -p , you can parse its cache directly. It’s binary, but using strings removes all the garbage (5 so /lib/ matches):

Читайте также:  Установить linux одной кнопкой

On my system, they both give the same results, which I verified with this quicky:

a=$(ldconfig -p | awk -F'> ' '' | sort); # get them to the same format b=$(strings -n5 /etc/ld.so.cache | sort -u); echo -e "$a\n$b\n$b" | sort | uniq -u 

Which checked if any library on the ldconfig -p list was not mentioned in the cache. Nothing was returned.

Источник

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.

Читайте также:  Genymotion установка на линукс

Источник

How to get the list of installed library packages only?

I want to get the list of installed library packages only from terminal. Is there any command for that?

5 Answers 5

The -v option will show the libraries version.

267 libs found in cache `/etc/ld.so.cache' libz.so.1 (libc6) => /usr/lib/libz.so.1 libz.so (libc6) => /usr/lib/libz.so libxslt.so.1 (libc6) => /usr/lib/libxslt.so.1 libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2 libxcb.so.1 (libc6) => /usr/lib/libxcb.so.1 libxcb-xlib.so.0 (libc6) => /usr/lib/libxcb-xlib.so.0 libwrap.so.0 (libc6) => /lib/libwrap.so.0 libvolume_id.so.0 (libc6) => /lib/libvolume_id.so.0 libuuid.so.1 (libc6) => /lib/libuuid.so.1 libutil.so.1 (libc6, hwcap: 0x8008000000008000, OS ABI: Linux 2.6.8) => /lib/tls/i686/cmov/libutil.so.1 libutil.so.1 (libc6, OS ABI: Linux 2.6.8) => /lib/libutil.so.1 libutil.so (libc6, OS ABI: Linux 2.6.8) => /usr/lib/libutil.so libusb-0.1.so.4 (libc6) => /lib/libusb-0.1.so.4 libusb-0.1.so.4 (libc6) => /usr/lib/libusb-0.1.so.4 libulockmgr.so.1 (libc6) => /lib/libulockmgr.so.1 libt1x.so.5 (libc6) => /usr/lib/libt1x.so.5 libt1.so.5 (libc6) => /usr/lib/libt1.so.5 libtiff.so.4 (libc6) => /usr/lib/libtiff.so.4 libticw.so.5 (libc6) => /lib/libticw.so.5 

If you want to turn that list into a list of packages, you can do something like this:

dpkg -S $(/sbin/ldconfig -p | awk 'NR>1 < print $NF >') 

And you can further massage that to cut out errors, unneeded components and duplicates:

$ dpkg -S $(/sbin/ldconfig -p | awk 'NR>1 < print $NF >') 2>/dev/null | sed 's/\: .*$//' | sort -u akregator ark binutils calligra-libs comerr-dev compiz-core dolphin e2fslibs:amd64 freeglut3:amd64 gettext . 

Источник

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