cURL / Mailing Lists / curl-library / Single Mail


Re: setup Issue with libssh2 libcurl and gcc

From: Dan Fandrich <>
Date: Fri, 20 Jan 2012 10:08:36 -0800

On Fri, Jan 20, 2012 at 04:06:43PM +0100, wrote:
> 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.

Does "pkg-config libssh2 --cflags --libs" produce reasonable output when
run on its own?

> $ 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/
> /home/itops/Downloads/linssh2/libssh2-1.3.0/src/libssh2_config.h
> /home/itops/Downloads/linssh2/libssh2-1.3.0/src/
> /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.

The libssh2_config.h file is private and shouldn't be used outside of
libssh2 itself. However, it looks to me like the example programs are
"cheating" in that they are actually using that private file. It makes
some sense in this case because the examples really are part of libssh2,
and it's very convenient to use that internal file since it allows the
example code to stay rather more clean and simple and still portable
across a number of machines. But real applications should be configuring
themselves properly without using that file.

If you just want to get the example going, just copy libssh2_config.h from
your libssh2 build directory into the same directory as your example
source file. But when you build your actual app out of that example code
(if you do it that way), then remove the use of that file and either
hard-code the correct configuration for your desired platform in the
source, or use something like autoconf to configure your application

>>> Dan
List admin:
Received on 2012-01-20