pppd-2.4.7交叉编译问题 undefined reference to `setkey‘

文章讲述了在使用pppd进行交叉编译时遇到的错误,涉及chat参数问题和pppcrypt.c中的setkey、encrypt函数undefinedreference。通过添加ssl库和修复警告,最终解决了这些问题。
摘要由CSDN通过智能技术生成

目录

问题的出现

交叉编译

错误提示

解决过程


问题的出现

        运行pppd call gprs-dial时 提示chat 不支持参数 -f ,这个chat 是busybox编译出来的,可能版本的问题参数有变,在menuconfig中没有找到chat的说明;想单独编译chat.于是找到pppd2.4.7开发包。编译出错,其实错误是pppd的错误,而chat已经编译出来。

交叉编译

交叉编译器 :arm-mix410-linux-gcc

./configure

make CC=arm-mix410-linux-gcc

错误提示

/opt/linux/x86-arm/arm-mix410-linux/host_bin/../lib/gcc/arm-linux-gnueabi/7.3.0/../../../../arm-linux-gnueabi/bin/ld: pppcrypt.o: in function `DesSetkey':
/home/topeet/hisi/tools/ppp-2.4.7/pppd/pppcrypt.c:122: undefined reference to `setkey'
/opt/linux/x86-arm/arm-mix410-linux/host_bin/../lib/gcc/arm-linux-gnueabi/7.3.0/../../../../arm-linux-gnueabi/bin/ld: pppcrypt.o: in function `DesEncrypt':
/home/topeet/hisi/tools/ppp-2.4.7/pppd/pppcrypt.c:137: undefined reference to `encrypt'
/opt/linux/x86-arm/arm-mix410-linux/host_bin/../lib/gcc/arm-linux-gnueabi/7.3.0/../../../../arm-linux-gnueabi/bin/ld: pppcrypt.o: in function `DesDecrypt':
/home/topeet/hisi/tools/ppp-2.4.7/pppd/pppcrypt.c:153: undefined reference to `encrypt'

解决过程

1、pppcrypt.c找不到setkey ,在makefile中添加ssl的lib库

CC = arm-mix410-linux-gcc
#
COPTS = -O2 -pipe -Wall -g
LIBS = -L/home/topeet/hisi/tools/openssl-1.1.1d/build/lib -lcrypto -lssl

添加后同样的错误。

2、查看库文件,有没有setkey函数 没有找到

nm libcrypto.so | grep "setkey"
nm libssl.so | grep "setkey"

3、在错误提示之前有两行提示

pppcrypt.c:122:2: warning: implicit declaration of function 'DES_set_key'; did you mean 'DesSetkey'? [-Wimplicit-function-declaration]
  setkey((const char *)crypt_key);
  ^~~~~~~~~~~
  DesSetkey

pppcrypt.c: In function 'DesEncrypt':
pppcrypt.c:137:2: warning: implicit declaration of function 'encrypt'; did you mean 'crypt'? [-Wimplicit-function-declaration]
  encrypt((char *)des_input, 0);
  ^~~~~~~
  crypt

这两个提示正式解决问题的方法,在.c文件找到对应的行替换函数即可。

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
这个错误是由于在编译tomato源码时,找不到`crypt`函数的引用导致的。`crypt`函数是用于加密密码的函数。根据引用和引用的错误信息可知,在编译过程中,链接器(ld)无法找到`crypt`函数的定义。 解决这个错误的方法是在编译时链接`libcrypt`库。根据引用的错误信息,可以看到编译命令中使用了`-lcrypt`选项,这个选项指示链接器链接`libcrypt`库。所以,你可以尝试在编译命令中添加`-lcrypt`选项来解决这个问题。 另外,根据引用中的代码片段,可以看到`crypt`函数的声明在`unistd.h`头文件中。确保你的代码中包含了这个头文件。 总结一下,解决`undefined reference to `crypt'`错误的方法是: 1. 在编译命令中添加`-lcrypt`选项,以链接`libcrypt`库。 2. 确保你的代码中包含了`unistd.h`头文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [tomato/release/src/router/pppd/pppd/auth.c:972: undefined reference to `crypt'](https://blog.csdn.net/nemo2011/article/details/42319583)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [undefined reference to `crypt](https://blog.csdn.net/qzoscar91/article/details/116484618)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Linux常见错误 undefined reference to `crypt'](https://blog.csdn.net/weixin_42073412/article/details/100140845)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

为了维护世界和平_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值