具体的编译步骤已经在玩转「Wi-Fi」系列之wpa_supplicant 介绍(七)描述过,这里针对编译过程中遇到的错误做总结
wpa_supplicant 中 cp defconfig .config 执行make 会提示
/usr/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
Makefile:1693: recipe for target 'wpa_supplicant' failed
make: *** [wpa_supplicant] Error 1
需要修改 .config 中指定 libnl头文件/库的路径
# driver_nl80211.c requires libnl. If you are compiling it yourself
# you may need to point hostapd to your version of libnl.
#
#CFLAGS += -I$<path to libnl include files>
#LIBS += -L$<path to libnl library files>
CFLAGS += -I/usr/local/include/libnl3/
LIBS += -L/usr/local/lib/
# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
# CONFIG_LIBNL32=y
fatal: No names found, cannot describe anything.
CC config.c
CC notify.c
CC bss.c
CC eap_register.c
CC ../src/utils/common.c
CC ../src/utils/wpa_debug.c
CC ../src/utils/wpabuf.c
CC wmm_ac.c
../src/utils/os_unix.c: In function ‘os_rel2abs_path’:
../src/utils/os_unix.c:293:17: error: ‘errno’ undeclared (first use in this function)
last_errno = errno;
^
../src/utils/os_unix.c:293:17: note: each undeclared identifier is reported only once for each function it appears in
../src/utils/os_unix.c:295:22: error: ‘ERANGE’ undeclared (first use in this function)
if (last_errno != ERANGE)
^
Makefile:1780: recipe for target '../src/utils/os_unix.o' failed
make: *** [../src/utils/os_unix.o] Error 1
出现该问题, 百思不得其解, 最终由于libnl头文件路径:
CFLAGS += -I/usr/local/include/libnl3/netlink/ 改为 CFLAGS += -I/usr/local/include/libnl3/ 解决
后续遇到问题再补充……