[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Problemer med lænkning



Hey

Jeg prøver at compile noget kode, som benytter SHA256 funktionerne fra
openssl/sha.h, men jeg kan sgi ikke få det til at lænke:

$ make
cc `pkg-config --libs --cflags libssl` -o hash hash.c
/tmp/ccZoqZAW.o: In function `check_hash':
hash.c:(.text+0x31): undefined reference to `SHA256_Init'
hash.c:(.text+0x4f): undefined reference to `SHA256_Update'
hash.c:(.text+0x65): undefined reference to `SHA256_Final'
collect2: error: ld returned 1 exit status
make: *** [hash] Error 1


Kommandoen `pkg-config --libs --cflags libssl` giver følgende flag:
-lssl -lcrypto
Hvis jeg stracer compileren kan jeg se, at følgende libcrypto bliver brugt:
[pid 13401]
stat("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libcrypto.so",
{st_mode=S_IFREG|0644, st_size=1848736, ...}) = 0
[pid 13401]
open("/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libcrypto.so",
O_RDONLY) = 8

...og hvis jeg lister dens symboler, så ligger funktionerne der:
$ objdump -T
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libcrypto.so|grep
SHA256
0000000000068640 g    DF .text    000000000000000a  OPENSSL_1.0.0
SHA256_Transform
0000000000068330 g    DF .text    00000000000000e2  OPENSSL_1.0.0
SHA256_Init
0000000000068420 g    DF .text    000000000000020f  OPENSSL_1.0.0
SHA256_Update
0000000000068830 g    DF .text    0000000000000078  OPENSSL_1.0.0 SHA256
0000000000068650 g    DF .text    00000000000001c7  OPENSSL_1.0.0
SHA256_Final

Ved nogen, hvad jeg gør galt?

God weekend til alle


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2012-12-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *