cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl and libssh2

From: Xu, Qiang (FXSGSC) <Qiang.Xu_at_fujixerox.com>
Date: Wed, 14 Oct 2009 15:32:08 +0800

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Guenter
> Sent: Monday, October 12, 2009 5:46 PM
> To: libcurl development
> Subject: Re: libcurl and libssh2
>
> Hi,
> you dont need to be root in order to compile a curl version
> just for you; that works fine also within your home
> directory; just download recent sources, and then configure
> with --disable-shared; that results in a statically linked
> curl version which you can test with, and also simply copy to
> your personal ~/bin folder so that it is found before the
> system-own version. Also you can do same with libssh2; build
> a static version, and then configure libcurl to use this
> version, and you should get a curl which is sftp/scp aware.

Just found I have mistaken the configure option about libss2. The option "--with-libssh2=PATH" means the installation directory of libssh2, and the configure script will try to find the related headers and libraries from "PATH/include", and "PATH/lib".

Previously, I set the option mistakenly to "--with-libssh2=/home/qxu/opensrc/libssh2-1.2/src/.libs", and this lead to the following error in config.log:
=====================================================
configure:25884: checking for libssh2_channel_open_ex in -lssh2
configure:25916: gcc -o conftest -g0 -O2 -Wno-system-headers -I/usr/kerberos/include -I/home/qxu/opensrc/libssh2-1.2/src/.libs/include -L/usr/kerberos/lib -L/home/qxu/opensrc/libssh2-1.2/src/.libs/lib conftest.c -lssh2 -lssl -lcrypto -lrt -lssl -lcrypto -ldl -lz -lz >&5
=====================================================
You will notice the configure script tried to locate the header from "/home/qxu/opensrc/libssh2-1.2/src/.libs/include" and the library from "/home/qxu/opensrc/libssh2-1.2/src/.libs/lib". Obviously, this is incorrect. I didn't notice this, coz the configure script ran successfully and didn't report and error of libssh2. Maybe this is due to another version of libssh2 exists in the same linux box.

For the libssh2-1.2 source package compiled by myself, the headers are in "/home/qxu/opensrc/libssh2-1.2/include", and the libraries are in "/home/qxu/opensrc/libssh2-1.2/src/.libs". So I did the following:
=====================================================
qxu_at_durian(pts/0):~/opensrc/libssh2-1.2[224]$ ln -s src/.libs/ lib
qxu_at_durian(pts/0):~/opensrc/libssh2-1.2[225]$ ll
...
lrwxrwxrwx 1 qxu XOG_cc 10 Oct 14 15:12 lib -> src/.libs/
...
qxu_at_durian(pts/0):~/opensrc/curl-7.19.6[228]$ ./configure --with-libssh2=/home/qxu/opensrc/libssh2-1.2 -disable-shared
...
qxu_at_durian(pts/0):~/opensrc/curl-7.19.6[229]$ make
...
qxu_at_durian(pts/0):~/opensrc/curl-7.19.6/src[233]$ ./curl --version
curl 7.19.6 (i686-pc-linux-gnu) libcurl/7.19.6 OpenSSL/0.9.8b zlib/1.2.3 libssh2/1.2
Protocols: tftp ftp telnet dict http file https ftps scp sftp
Features: IPv6 Largefile NTLM SSL libz

/* everything is good up to now, and libssh2's version is correctly reflected as 1.2 in the output of "./curl --version */

qxu@durian(pts/0):~/opensrc/curl-7.19.6/src[234]$ ./curl -v -u qxu:fair123 -T CMakeLists.txt sftp://13.198.98.202/scan/test.txt
* About to connect() to 13.198.98.202 port 22 (#0)
* Trying 13.198.98.202... connected
* Connected to 13.198.98.202 (13.198.98.202) port 22 (#0)
* Failed to read known hosts from /home/qxu/.ssh/known_hosts
* SSH host check: 2, key: <none>
* Closing connection #0
* SSL peer certificate or SSH remote key was not OK

curl: (51) SSL peer certificate or SSH remote key was not OK
=====================================================
How to overcome this hosts failure?

Thanks,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-14