[openssl-users] error when linking with OpenSSL library dynamically
Martin Vegter
martin.vegter9 at gmail.com
Mon Feb 1 21:21:49 UTC 2016
Hello,
I have a C program, which is using AES routines from the OpenSSL
library. I have the necessary library installed (libssl-dev
1.0.1e-2+deb7u19):
$ ls /usr/lib/x86_64-linux-gnu/libcrypto.*
/usr/lib/x86_64-linux-gnu/libcrypto.a
/usr/lib/x86_64-linux-gnu/libcrypto.so
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
I can compile my program statically:
gcc -s -o aes aes.c /usr/lib/x86_64-linux-gnu/libcrypto.a
but when i try to compile it dynamically, I get following error:
$ gcc -s -o aes aes.c -lcrypto
/tmp/ccofFr4N.o: In function `encrypt':
aes.c:(.text+0x9f): undefined reference to `aesni_set_encrypt_key'
aes.c:(.text+0xd9): undefined reference to `aesni_cbc_encrypt'
aes.c:(.text+0x1a0): undefined reference to `aesni_cbc_encrypt'
/tmp/ccofFr4N.o: In function `decrypt':
aes.c:(.text+0x2d4): undefined reference to `aesni_set_decrypt_key'
aes.c:(.text+0x31e): undefined reference to `aesni_cbc_encrypt'
collect2: error: ld returned 1 exit status
I noticed the following:
$ grep aesni_set_encrypt_key /usr/lib/x86_64-linux-gnu/libcrypto.*
Binary file /usr/lib/x86_64-linux-gnu/libcrypto.a matches
Is it possible, that libcrypto.so does not contain the functions,
while libcrypto.a does ?
could somebody please advise how I can compile my program dynamically ?
More information about the openssl-users
mailing list