cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: A question about linking

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 10 Aug 2004 08:05:05 +0200 (CEST)

On Tue, 10 Aug 2004, [gb2312] 黄志军 wrote:

> This is my first time to play with libcurl ,below is my question. Thank u
> for ur help!

[makefile snipped out]

> when I execute make, 'simple' is created, but when i execute simple the
> following info is shown in my term. Why?
>
> ld.so.1: simple: fatal: libcurl.so.3: open failed: No such file or directory

This means that you build and linked the example fine, but that your run-time
linker (ld.so) couldn't find the shared library named libcurl.so.3 when you
tried to execute it.

You need to make sure that ld.so finds libcurl.so.3. You can do that multiple
ways, and it differs somewhat between different operating systems, but they
are usually:

* Add an option to the linker command line that specify the hard-coded path
   the run-time linker should check for the lib (usually -R)

* Set an environment variable (LD_LIBRARY_PATH for example) where the
   run-time linker should check for libs

* Adjust the system's config to check for libs in the directory where you've
   put the dir (like Linux's /etc/ld.so.conf)

I would guess that 'man ld.so' and 'man ld' will tell you more details.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-08-10