Ld cannot find udev

I am trying to compile a program, but it causes the following error:

[cc] /usr/bin/ld: cannot find -ludev 

I checked other topics on SO, but the answers should have installed something while I seem to have installed libudev.

In / lib / x86_64-linux-gnu I also have:

 lrwxrwxrwx 1 root root 16 lut 19 21:30 libudev.so.1 -> libudev.so.1.3.5 -rw-r--r-- 1 root root 67600 lut 19 21:31 libudev.so.1.3.5 

I tried to link libudev.so.0 with libudev.so.1 but it still does not work. What are they looking for and why is it not working? How can i solve this?

+8
linux ld
source share
2 answers

When you use -lfoo , the linker will look for a file named libfoo.a or libfoo.so .

So, in your case, you need libudev.so without any suffix number.

Some Linux distributions, such as Debian and derivatives (Ubuntu?), Do not install these symbolic links by default. Therefore, instead of creating this symbolic link, first try the *-dev package ( libudev-dev ).

+14
source share

ld is a command for the linker, you need to update the LIBPATH variable to include the library location.

check the value of the env variable LIBPATH and change it to LIBPATH=LIBPATH:<lib location> and compile again.

0
source share

All Articles