wpa_supplicant_V2.6 版本编译问题

具体的编译步骤已经在玩转「Wi-Fi」系列之wpa_supplicant 介绍(七)描述过,这里针对编译过程中遇到的错误做总结

问题1 : cannot find -lnl

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

问题2 : error: ‘ERANGE’ undeclared (first use in this function)

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 functionos_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/ 解决

后续遇到问题再补充……

猜你喜欢

转载自blog.csdn.net/z2066411585/article/details/80739704