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

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

问题的出现

交叉编译

错误提示

解决过程


问题的出现

        运行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文件找到对应的行替换函数即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

为了维护世界和平_

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

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

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

打赏作者

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

抵扣说明:

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

余额充值