linux openssl 编译静态库,OpenSSL Linux动态库编译

OpenSSL Linux动态库编译

发布时间:2020-03-15 16:30:08

来源:51CTO

阅读:1077

作者:fengyuzaitu

静态库编译

./config

make

make install

动态库编译

./config shared

make

make install

问题1)relocation R_AARCH64_ADR_PREL_PG_HI21

之前编译完成静态库,没有清理干净,出现问题

指令    ./config shared && make

出错

usr/bin/ld: libcrypto.a(gost_eng.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: libcrypto.a(gost_eng.o)(.text+0x4f0): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'

/usr/bin/ld: final link failed: bad value

./stdio.h:477:1: error: 'gets' undeclared here (not in a function)

sed -i '/gets is a security hole/d' \

gettext-{runtime/gnulib-lib,tools/{gnulib-lib,libgettextpo}}/stdio.in.h

解决

make clean

./config shared

问题2)undefined reference to

undefined reference to `GENERAL_NAME_free@libcrypto.so.10'

undefined reference to `SSL_get_verify_result@libssl.so.10'

undefined reference to `SSL_CTX_set_default_passwd_cb_userdata@libssl.so.10'

undefined reference to `sk_num@libcrypto.so.10'

undefined reference to `SSL_CTX_ctrl@libssl.so.10'

undefined reference to `CRYPTO_set_dynlock_lock_callback@libcrypto.so.10'

undefined reference to `SSL_accept@libssl.so.10'

undefined reference to `SSL_new@libssl.so.10'

undefined reference to `SSL_CTX_set_cipher_list@libssl.so.10'

按照如上的make install操作,就可以解决该问题,否则需要通过-lssl -lcrypto链接指定的openssl库,同时需要指定openssl的头文件目录

例子

g++  UploadMessageService_server.skeleton.cpp uploadmessageservice.cpp  thriftcom_types.cpp thriftcom_constants.cpp  pushmessageservice.cpp -lthrift-0.9.0 -lpthread -I /home -I ./  -L. -L /home/dong/3thrdparty/openssl-1.0.2j   -fpermissive  -o output -DHAVE_NETINET_IN_H

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值