嵌入式linux下wifi网卡的使用(四)——应用程序sub_supplicant编译

有readme先看看readme看看有没有编译的方法

里面告诉我们安装时可能会依赖某些库事实证明会依赖openssl库,之前也使用过openssl

这个文件中有个defualtconfig,先用它做.config

这里面没有configure,那么直接修改makefile

CC=arm-linux-gcc

接下来make,发现出错,看提示应该是缺少openssl库。这个库以前也用过,一个加密库,就是抓包后看不到包里面的内容

 

Shell命令:make > log.txt 2>&1

0:表示stdin标准输入

1:表示stdout标准输出

2:表示stderr标准错误

 

这句话把标准错误重定向到标准输出

 

发现第一条出错的命令是../src/crypto/tls_openssl.c:17:25: warning: openssl/ssl.h: No such file or directory

看来需要编译它的依赖openssl了

进入这个目录发现openssl有Configure文件,用通用公式发现并不能执行过

Configure –help可以看到这个configure支持的选项,发现os/compiler[:flags]这个好像是选择交叉编译的平台的

 

./Configure os/compiler:arm-linux-gcc  可以通过

进行make发现竟然编译成功了,没有bug真是出乎意料了

 

接下来进行安装

make INSTALL_PREFIX=${PWD}/TMP

安装结束后去tmp目录看了下,发现并没有生成动态库,应该是配置的命令还得再改一改

./Configure shared --prefix=$PWD/tmp os/compiler:arm-linux-gcc

最后会出现

You gave the option 'shared'.  Normally, that would give you shared libraries.

Unfortunately, the OpenSSL configuration doesn't include shared library support

for this platform yet, so it will pretend you gave the option 'no-shared'.  If

you can inform the developpers (openssl-dev\@openssl.org) how to support shared

libraries on this platform, they will at least look at it and try their best

(but please first make sure you have tried with a current version of OpenSSL).

这句话说share这个命令会编译出动态库,但是在arm-linux-平台还不支持这个选项

用当前目录下的./config,不指定平台试试,配置后修改Makefile

./config shared --prefix=$PWD/tmp

修改Makefile后出现错误

x86cpuid.s: Assembler messages:

x86cpuid.s:4: Error: unrecognized symbol type ""

x86cpuid.s:5: Error: alignment too large: 15 assumed

我们是要应用在嵌入式平台上,为什么会有x86呢?再去看看配置选项no-asm(这个选项是为了x86平台优化而存在的)

然后更改Makefile,make;make install;

将include和lic拷贝到交叉编译链的目录中去

 

 

解决了依赖库的问题 回去执行make,但是make还是有错误

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find –lnl

 

找不到这个链接的库文件,其实在刚刚编译好的libnl-3.so

grep "lnl" * -nR

找到文件的位置

ifdef CONFIG_LIBNL32

  DRV_LIBS += -lnl-3

  DRV_LIBS += -lnl-genl-3

  DRV_CFLAGS += -DCONFIG_LIBNL20 -I/usr/include/libnl3

Else

文件中说如果定义了这个东西,那么就会引用这个库,所以修改.config中将这个值设置为y

make 

make install 

就可以在定义好的安装目录下看到应用程序了

posted @ 2018-01-09 19:29  郑志强Aloha  阅读(382)  评论(0编辑  收藏  举报