LD cannot find an existing library

Source: Internet
Author: User
Tags symlink

Am attempting to link an application with G ++ on this Debian Lenny system. LD is complaining it cannot find specified libraries. the specific example here is ImageMagick, but I am having similar problems with a few other libraries too.

I am calling the linker:

g++ -w (..lots of .o files/include directories/etc..) \ -L/usr/lib -lmagic 

LD complains:

/usr/bin/ld: cannot find -lmagic 

However, libmagic exists:

$ locate libmagic.so /usr/lib/libmagic.so.1 /usr/lib/libmagic.so.1.0.0 $ ls -all /usr/lib/libmagic.so.1* lrwxrwxrwx 1 root root    17 2008-12-01 03:52 /usr/lib/libmagic.so.1 -> libmagic.so.1.0.0 -rwxrwxrwx 1 root root 84664 2008-09-09 00:05 /usr/lib/libmagic.so.1.0.0 $ ldd /usr/lib/libmagic.so.1.0.0      linux-gate.so.1 =>  (0xb7f85000)     libz.so.1 => /usr/lib/libz.so.1 (0xb7f51000)     libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7df6000)     /lib/ld-linux.so.2 (0xb7f86000) $ sudo ldconfig -v | grep "libmagic"     libmagic.so.1 -> libmagic.so.1.0.0 

How do I diagnose this problem further, and what cocould be wrong? Am I doing something completely stupid?

 

The problem is the linker is looking for libmagic. So but you only have libmagic. so.1

A quick hack is to symlink libmagic. so.1 to libmagic. So

 

 

That works, I am kind of perplexed that it wocould name the file in a completely useless way by default-can you provide any insight why it wocould do this by default? -Maxpenguin
Dec 3 '08

Most likely it is a misconfiguration of the install script-grespondawk
Dec 3 '08

The Foo. so.1 is a symlink to foo. so.1.0.0 too. this way, you can have several versions of a library in your system, and if an application needs a specific one, it can link to it, while in general, the newest one is chosen
Symlink. I do not know why this symlink was missing.-Svante
Dec 3 '08

Libmagic. so.1 is the soname, used by the dynamic linker; libmagic. so is used by the linker, and is usually together with the headers in the-dev package. the symlink might be missing because the-dev package was not installed.
-Cesarb
Dec 3 '08

 

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.