[Libssh] Comment inclure libssh en static ?

.:: Alfred Sawaya ::. huji at huji.fr
Wed Jul 16 00:22:52 CEST 2008


OK. It works, just have a warning :

# 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/libdl.a -static
/usr/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
(.text+0x676): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for
linking
/usr/lib/libssh.a(options.o): In function `get_username_from_uid':
/home/huji/test/libssh-0.2/libssh/options.c:295: warning: Using
'getpwent' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
/home/huji/test/libssh-0.2/libssh/options.c:298: warning: Using
'endpwent' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
/usr/lib/libssh.a(connect.o): In function `getai':
/home/huji/test/libssh-0.2/libssh/connect.c:68: warning: Using
'getaddrinfo' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking

But... I've a segmentation fault when I execute sample...
When I put sample in libssh folder and I do "make sample.c" it works and
sample works well too...


Norbert Kiesel a écrit :
> 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 !
>>
> 


-- 


 --
|
  .:: Alfred Sawaya ::.
                        |
                      --





More information about the Libssh mailing list