1. wpa_supplicant的编译需要用到的3个源码包, 分别是wpa_supplicant, openssl, libnl

wpa_supplicant的下载地址:http://w1.fi/releases/

openssl的下载地址:https://www.openssl.org/so

libnl的下载地址:http://www.infradead.org/~tgr/libnl/files/

2. 编译

后面编译 wpa_supplicant 2.6时报错,"can't find -lnl",所以编译 libnl-1.1.4。
./configure --prefix=/home/henry/wpa/libnl-1.1.4/out

先装依赖库

sudo apt-get install bison

sudo apt-get install flex

./configure --prefix=/home/henry/wpa/libnl-1.1.4/out

make
make check
make install
// to install the API documentation:
mkdir -vp /home/henry/wpa/libnl-1.1.4/out/libnl/doc
tar -xf ../libnl-doc-1.1.4.tar.gz --strip-components=1 --no-same-owner -C /home/henry/wpa/libnl-1.1.4/out/libnl/doc

openssl的编译:

./config shared --prefix=/home/henry/wpa/openssl-1.1.1/out/ssl/prefix --openssldir=/home/henry/wpa/openssl-1.1.1/out/ssl/configuration
make
make test
make install

wpa_supplicant的编译

cd ~/wpa/wpa_supplicant-2.6/wpa_supplicant
cp defconfig .config
修改配置文件 .config,在"#Uncomment following two linee and fix..."下增加如下语句,用来添加openssl和libnl的头文件和库文件目录,更新编译链接环境变量:
CFLAGS += -I/home/henry/wpa/openssl-1.1.1/out/prefix/include
CFLAGS += -I/home/henry/wpa/libnl-1.1.4/out/include
LIBS += -L/home/henry/wpa/openssl-1.1.1/out/prefix/lib
LIBS += -L/home/henry/wpa/libnl-1.1.4/out/lib

LIBS_p += -L/home/henry/wpa/openssl-1.1.1/out/ssl/prefix/lib  (否则找不到libcripto)

执行 make 进行编译,成功后生成三个目标文件 wpa_supplicant, wpa_cli, wpa_passphrase 。

01-06 11:42