On Wed, Aug 18, 2010 at 11:34:18AM +0800, CHEN Xiaolei A wrote:
> After I succeeding in compiling libcurl-7.21.0, the "lib" directory lists as
> -rw-r--r-- 1 someone bjumts 1718756 Jul 1 17:42 libcurl.a
> -rwxr-xr-x 1 someone bjumts 1166 Jul 1 17:42 libcurl.la
> lrwxrwxrwx 1 someone bjumts 16 Jul 1 17:42 libcurl.so ->
> lrwxrwxrwx 1 someone bjumts 16 Jul 1 17:42 libcurl.so.4 ->
> -rwxr-xr-x 1 someone bjumts 1384988 Jul 1 17:42 libcurl.so.4.2.0
> drwxr-xr-x 2 someone bjumts 4096 Jul 1 17:42 pkgconfig
> And under my design environment, I only use actual dynamic lib
> (libcurl.so.4.2.0). I wrote a demo program, it can compile and link
> But before executing it, I use "ldd" command, it displays as follow:
> > ldd FTPSession.x
> libcurl.so.4 => (file not found)
> libssh2.so.1 => (file not found)
> libldap.so.5 => /usr/lib/libldap.so.5
> librt.so.1 => /lib/librt.so.1
> so when the program is begin execution, the name it want to find to load
> dynamic lib is libcurl.so.4 -it's a symbol link refer to actual dynamic lib
> (libcurl.so.4.2.0). But I don't need that, I hope the name it want to find is
> My question is:
> 1) What should I do? If I need only actual dynamic lib(libcurl.so.4.2.0) after
> compiling and installing, and when executing a program, it can find actual
> dynamic lib name(libcurl.so.4.2.0), not the symbol link libcurl.so.4?
When you link against libcurl, the linker uses the SONAME that's built-in
to the .so file to know what to link to at run-time. The SONAME is
libcurl.so.4, which is the most general name that by convention maintains
binary compatibility in future releases. You might be able to work some
trickery with linker flags to use a different name, like libcurl.so.4.2.0,
but why? If you ever want to upgrade libcurl to a new release to fix a
security problem or bug, the new name is guaranteed to be different (e.g.
libcurl.so.4.2.1) and your program will fail to run. If you insist on
having no hard or symbolic links to the library, you'd probably be better
off calling the library file libcurl.so.4 instead of libcurl.so.4.2.0.
If you are never going to upgrade libcurl without also upgrading the
application, then just statically link it instead.
> 2) As we known, libcurl compiling is depending on libssh2, so for my question
> 1), Is there any change when compiling libssh2?
The libcurl.so.4.2.0 dynamic library itself calls upon the SONAME of libssh2,
which is libssh2.so.1. So you're going to encounter the same issue there
if you don't want any links to libraries.
> 3) Does libcurl provide some interfaces to download a whole directory
> recursively from a FTP server?
Recent versions of libcurl support CURLOPT_WILDCARDMATCH that may do what
you want. Otherwise, you'll have to have the directory recursion logic
in the app.
List admin: http://cool.haxx.se/list/listinfo/curl-library
Received on 2010-08-18