[Libssh] undefined refs linking to server functions FIXED

Matt Lawson lawson08 at yahoo.com
Fri Apr 11 18:19:38 CEST 2008


Ha!  Fixed it!  As usual the solution came to me once
I stopped pounding the keyboard and walked away for a
while...

server.h is missing the sequence:

#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
} ;
#endif

This sequence is present in other files such as
libssh.h and sftp.h, that's why those worked with my
app which is, obviously, written in C++.  So that
should prolly be added to server.h.

One other unrelated consistency I ran across: 
ssh_options_new() is in libssh.h but
ssh_options_free() is in priv.h which describes itself
as "[stuff] the user app shouldn't have to [mess
with]".  So I'm unclear as to if I'm supposed to be
allocating SSH_OPTIONS dynamically or just use the
stack.

Keep up the good work!
- matt


> 
>    1. undefined refs linking to server functions
> (Matt Lawson)
>    2. Re: undefined refs linking to server functions
> (Aris Adamantiadis)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 10 Apr 2008 16:48:19 -0700 (PDT)
> From: Matt Lawson <lawson08 at yahoo.com>
> Subject: [Libssh] undefined refs linking to server
> functions
> To: libssh at cerkinfo.be
> Message-ID:
> <75124.30735.qm at web36706.mail.mud.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Hi,
> 
> I've been using the libssh library successfully for
> while from a shared library, but only the 'client'
> functions.
> 
> Now I'm interested in doing some server functions as
> well.  So I followed the instructions here:
> 
> http://0xbadc0de.be/wiki/libssh:newapi
> 
> My application compiles fine, when I try to link
> though, a bunch of the server type functions come
> back
> as undefined:
> undefined reference to
> `ssh_bind_set_options(ssh_bind_struct*,
> ssh_options_struct*)'
> undefined reference to
> `ssh_bind_listen(ssh_bind_struct*)'
> undefined reference to
> `ssh_bind_set_blocking(ssh_bind_struct*, int)'
> undefined reference to
> `ssh_bind_free(ssh_bind_struct*)'
> undefined reference to `ssh_bind_new()'
> 
> But I see those symbols exist; I can see them with
> nm:
> 
> 00000000000163c0 T ssh_bind_new
> 
> So... is there something special about the server
> functions?  Is their visibility hidden somehow, or
> is
> there some configure option I need to enable/include
> them?
> 
> I'm sure it's something simple, just can't seem to
> get
> it...
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 11 Apr 2008 09:33:07 +0200
> From: Aris Adamantiadis <aris at 0xbadc0de.be>
> Subject: Re: [Libssh] undefined refs linking to
> server functions
> To: libssh project mailing list <libssh at cerkinfo.be>
> Message-ID: <47FF1433.9070009 at 0xbadc0de.be>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
> 
> Matt Lawson a ?crit :
> > Hi,
> > 
> > I've been using the libssh library successfully
> for
> > while from a shared library, but only the 'client'
> > functions.
> > 
> > Now I'm interested in doing some server functions
> as
> > well.  So I followed the instructions here:
> > 
> > http://0xbadc0de.be/wiki/libssh:newapi
> > 
> > My application compiles fine, when I try to link
> > though, a bunch of the server type functions come
> back
> > as undefined:
> > undefined reference to
> > `ssh_bind_set_options(ssh_bind_struct*,
> > ssh_options_struct*)'
> > undefined reference to
> > `ssh_bind_listen(ssh_bind_struct*)'
> > undefined reference to
> > `ssh_bind_set_blocking(ssh_bind_struct*, int)'
> > undefined reference to
> > `ssh_bind_free(ssh_bind_struct*)'
> > undefined reference to `ssh_bind_new()'
> > 
> Hello,
> 
> Could you paste the complete link line ? I guess
> you're trying to link 
> against an older version of libssh that doesn't
> provide those symbols.
> 
> Regards,
> Aris
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Libssh mailing list
> Libssh at cerkinfo.be
>
http://www.cerkinfo.be/cgi-bin/mailman/listinfo/libssh
> 
> 
> End of Libssh Digest, Vol 40, Issue 1
> *************************************
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Libssh mailing list