[Libssh] Comment inclure libssh en static ?

Norbert Kiesel nkiesel at tbdnetworks.com
Wed Jul 16 00:12:25 CEST 2008


Try adding "-static" and "/usr/lib/libdl.a"

</nk>


> /usr/lib/libgcrypt.a /usr/lib/libgpg-error.a /usr/lib/libz.a 
On Tue, 2008-07-15 at 23:59 +0200, .:: Alfred Sawaya ::. wrote:
> Thank you :)
> 
> I have :
> 
> # 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
> 
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
> (.text+0x2d6): undefined reference to `dlsym'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
> (.text+0x3b7): undefined reference to `dlerror'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
> (.text+0x446): undefined reference to `dlsym'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
> (.text+0x527): undefined reference to `dlerror'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
> (.text+0x595): undefined reference to `dlclose'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
> (.text+0x676): undefined reference to `dlopen'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
> (.text+0x6e0): undefined reference to `dlclose'
> /usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
> (.text+0x715): undefined reference to `dlerror'
> collect2: ld returned 1 exit status
> 
> 
> Think we touch the solution... ?
> 
> Norbert Kiesel a écrit :
> > 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