cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: setup Issue with libssh2 libcurl and gcc

From: <maarten_at_goeiespullen.nl>
Date: Fri, 20 Jan 2012 16:06:43 +0100

Thanx for helping me out here. Without you help I can make it work.

Offcource the 'make install' was my mistake in the email, I did this on
the machie.

Here the result so far:

$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ export PKG_CONFIG_PATH

$ env |grep PKG
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

$ gcc -Wall -g -O2 `pkg-config libssh2 --cflags --libs` -o main test.cpp
test.cpp:10:28: fatal error: libssh2_config.h: No such file or directory
compilation terminated.

$ locate libssh2_config.h
/home/itops/Downloads/linssh2/libssh2-1.3.0/example/libssh2_config.h
/home/itops/Downloads/linssh2/libssh2-1.3.0/example/libssh2_config.h.in
/home/itops/Downloads/linssh2/libssh2-1.3.0/src/libssh2_config.h
/home/itops/Downloads/linssh2/libssh2-1.3.0/src/libssh2_config.h.in
/home/itops/Downloads/linssh2/libssh2-1.3.0/vms/libssh2_config.h
/home/itops/Downloads/linssh2/libssh2-1.3.0/win32/libssh2_config.h

I think here that the default location is not correct, but how to solve
this one.

Regards,

Maarten

-----Original Message-----
From: Dan Fandrich <dan_at_coneharvesters.com>
Reply-to: libcurl development <curl-library_at_cool.haxx.se>
To: curl-library_at_cool.haxx.se
Subject: Re: setup Issue with libssh2 libcurl and gcc
Date: Fri, 20 Jan 2012 01:53:25 -0800

On Thu, Jan 19, 2012 at 09:10:41PM +0100, maarten_at_goeiespullen.nl wrote:
> Again I burned two days getting libssh2 to work... Is there a simple
> manual/ how to. I simply can not get this to work.

There are lots of man pages and example programs, but I'm not aware of
a tutorial as such.

> After a lot of
> attemps I decided to rollout Ubuntu again over my laptop, so more plain
> then this I can not do. Here what I did. I installed a clean Ubuntu
> 11.10 distribution.
>
> then downloaded the libssh2 package
> ./configure
> make
> sudo make

You're missing the final step:

  sudo make install

Without that, your new libssh2 won't be usable.

> downloaded the sftp_write.c example and I tried to compile this with :
>
> gcc -lssh2 -L/home/itops/Downloads/libssh2/libssh2-1.3.0/src -Wall -g
> -O2 -o main sftp_write.c
> sftp_write.c:28: fatal error: libssh2_config.h: No such file or
> directory
> compilation terminated.

The proper way to compile with libssh2 (once you've installed it) is to
use pkg-config to determine the correct compiler flags to use. Assuming
that you installed libssh2 into the default location (/usr/local/)
you'd use a command like this to compile:

env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
gcc -Wall -g -O2 `pkg-config libssh2 --cflags --libs` -o main sftp_write.c

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-20