Subject: AW: static linking problem

AW: static linking problem

From: may nothing <may_241913_at_yahoo.com>
Date: Mon, 18 Oct 2010 20:56:46 +0100 (BST)

>On Mon, Oct 18, 2010 at 07:19:48PM +0100, may nothing wrote:
>> Tried, but no effect. I also tried adding -lssh2 ...
>> Given the fact that the linker complains about "libssh2_init" it looks more
>>like
>>
>> a ssh.h problem to me. But still, libssh2.h and libssh2_sftp.h are available in
>>
>> /usr/local/include

>Do you even have a static library available? Try adding the path to that
>library
>on your link command, e.g. gcc -o foo foo.o /usr/local/lib/libssh2.a
>And don't forget to add any libraries given by "pkg-config libssh2 --static".

>>> Dan

Hi Dan,

sorry but that doesn't work. libssh2.a is definitely present in /usr/local/lib.
Surprisingly "pkg-config libssh2 --static" doesn't returns anything ...

However, this is the farest I could get:

root_at_server: /data/work > gcc -Wall -I/usr/include -I/usr/local/include
/usr/local/lib/libssh2.a -static -lssh2 sftptest.c -o sftptest
sftptest.c: In function \u2018main\u2019:
sftptest.c:26: warning: unused variable \u2018mem\u2019
/tmp/ccEzyeoH.o: In function `main':
sftptest.c:(.text+0xc7): undefined reference to `libssh2_init'
sftptest.c:(.text+0x219): undefined reference to `libssh2_session_init_ex'
sftptest.c:(.text+0x24b): undefined reference to `libssh2_session_set_blocking'
sftptest.c:(.text+0x265): undefined reference to `libssh2_session_startup'
sftptest.c:(.text+0x2b8): undefined reference to `libssh2_hostkey_hash'
sftptest.c:(.text+0x371): undefined reference to `libssh2_userauth_password_ex'
sftptest.c:(.text+0x3fe): undefined reference to `libssh2_sftp_init'
sftptest.c:(.text+0x4a9): undefined reference to `libssh2_sftp_open_ex'
sftptest.c:(.text+0x52e): undefined reference to `libssh2_sftp_read'
sftptest.c:(.text+0x57a): undefined reference to `libssh2_sftp_close_handle'
sftptest.c:(.text+0x5b1): undefined reference to `libssh2_sftp_shutdown'
sftptest.c:(.text+0x5d8): undefined reference to `libssh2_session_disconnect_ex'
sftptest.c:(.text+0x5e7): undefined reference to `libssh2_session_free'
sftptest.c:(.text+0x623): undefined reference to `libssh2_exit'
collect2: ld returned 1 exit status

cu
May

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-10-18