大佬教程收集整理的这篇文章主要介绍了C:动态链接OpenSSL库时出错,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我可以静态编译我的程序:
gcc -s -o aes aes.c /usr/lib/x86_64-linux-gnu/libcrypto.a
但是当我尝试动态编译它时,我得到以下错误:
$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
为什么我不能用动态链接的OpenSSL编译我的程序?
那么,这里是来自libssl-dev的库:
$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
我注意到了以下内容.当我为他们寻找AES函数的名称时,只有libcrypto.a匹配.
$grep aesni_set_encrypt_key /usr/lib/x86_64-linux-gnu/libcrypto.* Binary file /usr/lib/x86_64-linux-gnu/libcrypto.a matches
以上是大佬教程为你收集整理的C:动态链接OpenSSL库时出错全部内容,希望文章能够帮你解决C:动态链接OpenSSL库时出错所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。