91

You can do this with ldd command: NAME ldd - print shared library dependencies SYNOPSIS ldd [OPTION]... FILE... DESCRIPTION ldd prints the shared libraries required by each program or shared library specified on the command line. .... Example: $ ldd /bin/ls linux-vdso.so.1 => (0x00007fff87ffe000) libselinux....


69

readelf -d $executable | grep 'NEEDED' Can be used if you can't run the executable, e.g. if it was cross compiled, or if you don't trust it: In the usual case, ldd invokes the standard dynamic linker (see ld.so(8)) with the LD_TRACE_LOADED_OBJECTS environment variable set to 1, which causes the linker to display the library dependencies. Be ...


65

For the current session you can export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib or to make the change permanent you can add /usr/local/lib to /etc/ld.so.conf (or something it includes) and run ldconfig as root. If you're still having problems, running ldd [executable name] will show you the libraries it's trying to find, and which ones can't be found.


60

NOTE: I'm going to assume that your machine has a memory mapping unit (MMU). There is a Linux version (µClinux) that doesn't require an MMU, and this answer doesn't apply there. What is an MMU? It's hardware—part of the processor and/or memory controller. Understanding shared library linking doesn't require you to understand exactly how an MMU works, just ...


46

If you've already run ldconfig after building the library, keep reading. If not, read aboout ldconfig first. /usr/local/lib might not be in the library path that ldconfig uses. You can just do this: ldconfig /usr/local/lib And the stuff should be added to the linker cache, but it is probably better to add the path properly. Make sure you have a /etc/ld....


45

The version info in not explicitly stored in an ELF file. What you have in there is the name of the library, the soname, which includes the major version. The full version is usually stored as a part of the library file name. If you have library, say libtest.so, then you usually have: libtest.so.1.0.1 - The library file itself, containing the full version ...


43

Ah yes this is a very confusing part if you've dealt with Unixes for any length of time. There is a standard that most Unixes "try" to follow called FHS - Filesystem Hierarchy Standard. Given I primarily use Red Hat based distros I'm most familiar with their take on FHS for Fedora, CentOS, and RHEL Linux distros. But I've used Debian & BSD based distros ...


41

The kernel does have optimised versions of some of these functions, in the arch-specific directories; see for example the x86 implementation of memchr (see all the memchr definitions, and all the strchr definitions). The versions you found are the fallback generic versions; you can spot these by looking for the protective check, #ifndef __HAVE_ARCH_MEMCHR ...


40

You probably shouldn't do this, but you can. Kusalananda's answer is better for the task at hand and explains the issue. Since you did ask specifically how to use any library calls inside the terminal, though, here's a few ways... The Tiny C Compiler (tcc) supports a -run flag that lets you (in effect) interpret C code by writing a small program, so you can ...


33

You can use: ldconfig -p | grep libavfilter If there is no output library is not installed. I am not sure if this is 100% reliable. At least in man page of ldconfig for option -p: Print the lists of directories and candidate libraries stored in the current cache.


32

Under HP-UX, shared libraries are mapped into memory using mmap(), and all memory pages in the system have protection bits which are coupled with the kernel and processor hardware's memory page protection mechanisms. In order to execute the contents of any page of memory on the system, that page must have PROT_EXEC set - a useful feature to prevent data ...


31

libssl1.0.2 and libssl1.0.0 are different packages, providing incompatible libraries; that’s why you can’t satisfy a libssl1.0.0 dependency using libssl1.0.2. To satisfy your package’s requirements, I’d suggest adding the Debian 8 repositories to your configuration, since Debian 8 is still supported (so if necessary you’ll get security updates). To do so, ...


28

The apropos command is useful in many ways, but it does give you a lot of "junk" too. Most of the things that you list are C library routines (this is what section 3 of the manual is for), which you can not use directly from the shell. To use them, you would have to write C program that calls them. This falls outside of the range of topics covered by this ...


28

But why does it not do the same until it finds the expected version rather than accepting the first instance of library irrespective of its version? It does, as far as it’s aware. zlib.so.1.2.7 and zlib.so.1.2.8 both have an soname of zlib.so.1, so your alpha and bravo binaries say they need zlib.so.1. The dynamic loader loads the first matching library it ...


25

Since you can log in, nothing major is broken; presumably your shell’s startup scripts add ~/lib to LD_LIBRARY_PATH, and that, along with the bad libraries in ~/lib, is what causes the issues you’re seeing. To fix this, run unset LD_LIBRARY_PATH This will allow you to run rm, vim etc. to remove the troublesome libraries and edit your startup scripts if ...


24

The problem is that you have put a copy of glibc into your ~/lib directory, and that library is incompatible with the system you've uploaded it to. The library is being referenced as ~/lib is specified in $LD_LIBRARY_PATH. To temporarily fix this, simply unset LD_LIBRARY_PATH - this will work as unset is a shell built-in. You will then be able to run your ...


24

That’s the dynamic linker; if you run it on its own, it will tell you what it does: Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...] You have invoked ‘ld.so’, the helper program for shared library executables. This program usually lives in the file /lib/ld.so, and special directives in executable files using ELF shared libraries ...


23

The usual dynamic linker on Linux uses a cache to find its libraries. The cache is stored in /etc/ld.so.cache, and is updated by ldconfig which looks on the paths it’s given in /etc/ld.so.conf (and nowadays typically files in /etc/ld.so.conf.d). So there is no default value for LD_LIBRARY_PATH, default library lookup doesn’t need it at all. If ...


21

You don't need to. Add the directory to /etc/ld.so.conf or a new file in /etc/ld.so.conf.d/, depending on distro. After that, you must run (at least on Redhat) ldconfig as root. As a word of caution, you need to be careful which libraries you add to the system shared library path (via the environment, ld.so.conf, or putting in /usr/local/lib). In ...


21

ldd and lsof show the libraries loaded either directly or at a given moment. They do not account for libraries loaded via dlopen (or discarded by dlclose). You can get a better picture of this using strace, e.g., strace -e trace=open myprogram (since dlopen ultimately calls open - though you may of course have a system using different names for 64-bit ...


20

Debian and Ubuntu are moving to a new multiarch implementation (spec). Among other things, this involves moving arch-specific libraries into /usr/lib/<triplet>, dropping the limitations of lib32 and lib64 (where will the new x32 ABI go? where do qemulated binaries live? etc.) as well as extending the package manager to handle mixed-architecture ...


20

The software package is libtool : https://www.gnu.org/software/libtool/


19

You don't have to copy anything anywhere. You should add the atlas libraries to the list of locations ld will search. In directory /etc/ld.so.conf.d you can add the file atlas-lib.conf. This file should contain the directory of libatlas.so.3gf, which is /usr/lib/atlas-base. You can do this by running echo "/usr/lib/atlas-base" | sudo tee /etc/ld.so.conf....


19

Conceptually, a library function is part of your process. At run-time, your executable code and the code of any libraries (such as libc.so) it depends on, get linked into a single process. So, when you call a function in such a library, it executes as part of your process, with the same resources and privileges. It's the same idea as calling a function you ...


19

If on a GNU system, try running your application with: LD_DEBUG=libs your-application See LD_DEBUG=help for more options or man ld.so.


16

I just had the problem with a 32-bit binary, solution was: apt-get install gcc-multilib $ uname -a Linux bla 2.6.32-028stab094.3 #1 SMP Thu Sep 22 12:47:37 MSD 2011 x86_64 GNU/Linux


16

I wouldn't do this for just strlen(), but it is a useful trick for trying out C code sometimes. user@host:~$ gdb gdb (gdb) start Temporary breakpoint 1, ... in main () (gdb) print strlen("foobar") $1 = 6 Here gdb is the GNU debugger, and it would normally take a program name to debug after it. Because we have none, this example gives it itself to debug. ...


15

You can use ldconfig -v | grep libraryname , also command has option command -V or binaryfile --version example : test@ubuntukrb12:~# ls --version ls (GNU coreutils) 8.13 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and ...


15

It sounds like you're looking for Audacity which is a cross-platform open source audio editor. One of its features is to allow you to generate tones. It's a multi-track audio editor, so you can easily create a stereo tone. Under the Generate menu, you're able to create Sine, Sawtooth, and Square waveform tones of arbitrary frequency, amplitude, and length ...


14

You have not said which OS you are using so I am going to assume Linux and will use Debian as an example. The quick answer to your question is no as far as I know. This might be a useful workaround though: ldd your_prog | awk '{print $1}' | sed 's/\..*//' | while read n; do echo "----- $n ----"; apt-cache search ^$n; done This will parse the ldd output ...


Only top voted, non community-wiki answers of a minimum length are eligible