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