[Libssh] Comment inclure libssh en static ?

Norbert Kiesel nkiesel at tbdnetworks.com
Tue Jul 15 23:54:14 CEST 2008


I could compile and link your test program using:
 gcc -o sample sample.c /usr/lib/libssh.a \
   /usr/lib/libcrypto.a /usr/lib/libgcrypt.a \
   /usr/lib/libgpg-error.a /usr/lib/libz.a

</nk>


On Tue, 2008-07-15 at 22:15 +0200, .:: Alfred Sawaya ::. wrote:
> Ok. So I try to compile a minimal code using libssh. I would like to use
> libssh as a static library. Aris said to use make libssh.a and to
> compile on this way : gccc -o test test.c libssh.a but it does errors :
> 
> libssh.a(wrapper.o): In function `sha1':
> > /home/huji/test/libssh-0.2/libssh/wrapper.c:238: undefined reference to
> > `SHA1'
> > libssh.a(wrapper.o): In function `sha1_update':
> > /home/huji/test/libssh-0.2/libssh/wrapper.c:231: undefined reference to
> > `SHA1_Update'
> > libssh.a(init.o): In function `ssh_finalize':
> > /home/huji/test/libssh-0.2/libssh/init.c:31: undefined reference to
> > `EVP_cleanup'
> 
> and many more...
> 
> So Jean-Philipe (in this mailing list) said to link libraries used by
> libssh : gcc -o test test.c libssh.a -lcrypto -lz
> 
> but it does not work. Anyway I don't know what to include and which
> files to put in the folder having sources. I thought it could be
> possible to simply include libssh.a and link with libssh.a but it's
> not... So i'm querying some solution :)
> 
> Thanks to all !
> 
> I join the file I want to compile.
> 
> Norbert Kiesel a écrit :
> > You might get more help by posting your questions in English (or in
> > English as well).
> > 
> > </nk>
> > 
> > 
> > On Tue, 2008-07-15 at 21:41 +0200, .:: Alfred Sawaya ::. wrote:
> >> Ca n'a pas l'air concluant :
> >>
> >> gcc -o sample libssh.a -lcrypto -lz
> >> /usr/lib/gcc/i486-linux-gnu/4.3.1/../../../../lib/crt1.o: In function
> >> `_start':
> >> (.text+0x18): undefined reference to `main'
> >> collect2: ld returned 1 exit status
> >>
> >> j'envoie le fichier que j'essaie de compiler en fichier joint, on sait
> >> jamais, surement une betise que j'ai fait... (c'est une version mini de
> >> sample.c)
> >>
> >> Aussi, le fichier est dans un dossier avec libssh.a et crypt.o mais bon
> >> ca ne marche pas non plus...
> >>
> >> Merci !
> > 
> > 
> 
> 




More information about the Libssh mailing list