Cannot find lib linux

LD cannot find lib even with specified path

Do you have a libavfilter.so (with no numbers) anywhere? You probably need the avfilter development package ( libavfilter-dev on Debian and derivatives).

Thank you, that solved it. I’m not quite sure why though, since I already had the libraries in that particular directory. libavfilter.so is in the same folder as *.so.x.x.x, which it links to.

1 Answer 1

ld looks for shared libraries or linker scripts named libsomething.so , or static libraries named libsomething.a , where something matches the -lsomething parameter given to ld . Libraries named libsomething.so.x.y.z , where x.y.z is the library’s version, are used at runtime, not for building, and ld won’t use them.

You therefore need to install the development packages for libraries you want to link to, such as libavfilter-dev in your case (assuming Debian or a derivative).

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.12.43529

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Читайте также:  Vipnet linux фильтр открытой сети

Источник

Cannot find lib in path

I am trying to start a program that relies on some libraries that are in my path, however, the program says it cannot find the files:

11:45:27 ~ > echo $PATH /usr/share/fsl/5.0/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/mri/Scripts:/home/mri/Scripts/MRI:/home/mri/Software/BRAINS3/bin:/home/mri/Software/BRAINS3/lib:/home/mri/Software/ITK_Build/bin:/home/mri/Software/ITK_Build/lib:/home/mri/Software/VTK_Build/bin:/home/mri/Software/VTK_Build/lib:/usr/lib/fsl/5.0 11:45:33 ~ > brains3 /home/mri/Software/BRAINS3/bin/brains3_real: error while loading shared libraries: libiplUtils.so: cannot open shared object file: No such file or directory 11:45:35 ~ > sudo find / -name libiplUtils.so [sudo] password for mri: /home/mri/Software/BRAINS3/lib/libiplUtils.so 

3 Answers 3

You can specify the library search path with the environment variable LD_LIBRARY_PATH .

$ export LD_LIBRARY_PATH=/home/mri/Software/BRAINS3/lib $ brains3 

You shouldn’t set this variable for your whole system. If you can’t/don’t want to install the software system wide you could create a wrapper script.

The dynamic linker searches for libraries en LD_LIBRARY_PATH.

Unix systems tend to sort different types of files into different directories. There are separate directories for executables (e.g. /usr/bin ), documentation (e.g. /usr/man , /usr/info , …), native libraries (e.g. /usr/lib ), Perl libraries (e.g. /usr/lib/perl5 ), and so on. Correspondingly, there are different path variables, all with the same syntax (colon-separated list of directories): PATH for executables, MANPATH for man pages, LD_LIBRARY_PATH for native libraries¹, PERL5LIB for Perl libraries, and so on.

For native libraries, there are system default libraries that are in the search path whether mentioned in the LD_LIBRARY_PATH environment variable or not. On Linux, these directories are listed in /etc/ld.so.conf (also, /lib and /usr/lib are always in the search path).

You therefore have several possibilities:

  • Add /home/mri/Software/BRAINS3/lib to /etc/ld.so.conf (Linux-specific, other unix variants may have a similar file). Run ldconfig to make the change take effect.
  • Add export LD_LIBRARY_PATH=/home/mri/Software/BRAINS3/lib in /etc/profile (applies to all users) or in ~/.profile (applies only to you).
  • Make a wrapper script:
#!/bin/sh export LD_LIBRARY_PATH=/home/mri/Software/BRAINS3/lib exec /home/mri/Software/BRAINS3/bin/brains3 "$@" 
ln -s /home/mri/Software/BRAINS3/bin/brains3/lib*.so.* /usr/local/lib/ 

¹ LD_LIBRARY_PATH is the name on most unix variants, but Mac OS X uses DYLD_LIBRARY_PATH instead.

Источник

How to fix error after compiling with GCC on ubuntu? /usr/bin/ ld: cannot find

I’m practicing with the MySQL C API, because I need to do a project for the university. I have a problem after compiling with gcc on ubuntu. I’m working with MariaDB on simple example like this:

#include #include int main(int argc, char **argv)
$ gcc version.c -o version `mysql_config --cflags --libs` 
/usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lssl collect2: error: ld returned 1 exit status 

Ensure that the development package providing libssl is installed. I would have expected that to be already done if you installed the mariadb development components from a package, but for whatever reason, they do not appear to be present. See Install openssl-dev on Ubuntu server.

@AndrewHenle this is the outpu: -I/usr/include/mariadb -I/usr/include/mariadb/mysql -L/usr/lib/x86_64-linux-gnu/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto

From the looks of it, the system doesn’t have OpenSSL installed — at least not in the normal place, and the -lssl -lcrypto options try to link in the OpenSSL libraries. What do you get if you enter the openssl command on the system? If that works (you get an OpenSSL> prompt that you have to enter exit to quit), what the full path of the openssl executable and what’s the output from ldd /full/path/to/openssl ? Because the openssl binary itself should depend on the same libraries. And if MariaDB is installed, OpenSSL should be installed too.

@AndrewHenle OpenSSL works. The full path is /usr/bin/openssl . The output for the ldd command is linux-vdso.so.1 (0x00007fffd0b70000) libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fac6c4be000) libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fac6c046000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fac6be27000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fac6ba36000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fac6b832000) /lib64/ld-linux-x86-64.so.2 (0x00007fac6c9c9000)

Источник

Linux: executable cannot find shared library

I have compiled casablanca and have put -l:/~/path/to/lib/libcasablanca.so in my CMakeList.txt . I have build my application and I have got no errors. But when I run the executable it says:

./myproj: error while loading shared libraries: libcasablanca.so: cannot open shared object file: No such file or directory 

I have done it on another computer and it seems to work fine. Does anyone know what is the problem? How to fix this? I have no administrator access to this machine.

1 Answer 1

This is very simple: your library is not in the default system path from them the shared libraries are imported. During the compilation, the compile scripts solved these problems. In runtime, you have the LD_PRELOAD or LD_LIBRARY_PATH environment variables.

For example: an export LD_LIBRARY_PATH=/home/darkside/wunderprog/lib will extend the directoried searched for your libraries with the named directory. If there is your libcasablanca.so , you will get what you want.

Normally I use a /home//lib directory in my useronly accounts and set LD_LIBRARY_PATH from .profile .

If I do export LD_LIBRARY_PATH=/~/path/to/lib , does it removes the values existent in the variable? Or there is nothing in it?

@thedarksideofthemoon Yes, but normally it is empty (the system sharedlib search path isn’t there). If you have some important there, you can give him a colon-separated path list, just as we can see in $PATH : export LD_LIBRARY_PATH=/home/darkmoon/lib:/home/darkmoon/some_another/lib . or just so.

Источник

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