1, Try building hostapd
1)Download hostapd-2.0.tar.gz
tar xzvf hostapd-2.0.tar.gz
cd hostapd-2.0/hostapd
cp defconfig .config
Modify .config, let
CONFIG_DRIVER_NL80211=y
modify Makefile
CC= XX-linux-gcc
CFLAGS += -mle -march=xx
2) make;
error info output, it shows hostapd depends on libnl library.
../src/drivers/driver_nl80211.c:25:31: fatal error: netlink/genl/genl.h: No such file or directory
3) to check if it depends on other library:
let CONFIG_DRIVER_NL80211=n in .config
make;
another error info output as befow, it shows hostapd also depends on openssl library,
../src/crypto/tls_openssl.c:23:25: fatal error: openssl/ssl.h: No such file or directory
compilation terminated.
the openssl library has be make and installed before, in /home/libinsall/openssl
add it to .config as below:
31 CFLAGS+= -march=xx -mle -Os -I/home/install/openssl/include
32 LDFLAGS += -ldl -march=xx -mle -I/home/install/openssl/include
33 LIBS += -L/home/install/openssl/lib
34 LIBS_p += -L/home/install/openssl/lib
make again, no error output again, hostapd is output in current folder,but nl80211 driver is disabled.
to enable nl80211 driver, CONFIG_DRIVER_NL80211 should be set y in .config,
so the next step is to make and install libnl.
2, build libnl-1.1
Somebody said hostapd use the libnl-1.1, the API of libnl with higher version has been changed and is not
usable for hostapd, so I download libnl-1.1.tar.gz
1) tar xzvf libnl-1.1.tar.gz
cd libnl-1.1
./configure --prefix=/home/install/libnl
modify Makefie.opts:
CC=xx-linux-gcc
AR=xx-linux-ar
CFLAGS += -mle -march=xx
2) make; error info output as below:
../include/netlink-local.h:218: error: ‘ULONG_MAX’ undeclared (first use in this function)
to fix this error, just add #include <limits.h> in netlink-local.h
3) make again, other error infor output as below, it shows error output when create libnl.so.1.1
CC netfilter/log.c
CC netfilter/log_obj.c
CC netfilter/nfnl.c
LD libnl.so.1.1
/opt/xx-glibc-le-nor31/bin/../xx-linux/sys-root/usr/lib/libm.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [libnl.so.1.1] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2
4) find out the place where libnl.so.1.1 is created, it is in lib/Makefile Line 51(LIBNL_LIB = -lm):
49 $(OUT_SLIB): ../Makefile.opts $(OBJ)
50 @echo " LD $(OUT_SLIB)"; \
51 $(CC) -shared -W1,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc
52 @echo " LN $(OUT_SLIB) $(LN1_SLIB)"; \
53 rm -f $(LN1_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN1_SLIB)
54 @echo " LN $(LN1_SLIB) $(LN_SLIB)"; \
55 rm -f $(LN_SLIB) ; $(LN) -s $(LN1_SLIB) $(LN_SLIB)
I find there is no CFLAGS option in line 51, because we are building libnl for specific SOC chip, it need specific
compiling options "-mle -march=xx". without this option, xx-linux-gcc doesnot recognize the libm.so .
so modify line 51 as below:
51 $(CC) -shared -W1,-soname,libnl.so.1 -o $(OUT_SLIB) $(CFLAGS) $(OBJ) $(LIBNL_LIB) -lc
5) make again, now libnl.so.1.1 is successfully built out. but other errors come up:
LN libnl.so.1 libnl.so
Entering include
Entering doc
Entering src
CC utils.c
LD nl-addr-add
/opt/ba-glibc-le-nor31/bin/../lib/gcc/ba-linux/4.5.2/../../../../ba-linux/bin/ld: warning: libm.so.6, needed by ../lib/libnl.so, not found (try using -rpath or -rpath-link)
../lib/libnl.so: undefined reference to http://blog.csdn.net/junllee/article/details/mailto:%60lrint@GLIBC_2.1'
collect2: ld returned 1 exit status
make[1]: *** [nl-addr-add] Error 1
make: *** [all] Error 2
6) find out where nl-addr-add is created, it is src/Makefile:
20 all: $(TOOLS)
21
22 $(TOOLS): utils.o
23
24 nl-%: nl-%.c
25 @echo " LD $@"; \
26 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
27
28 genl-%: genl-%.c
29 @echo " LD $@"; \
30 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
31
32
33 nf-%: nf-%.c
34 @echo " LD $@"; \
35 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
modify line 26/30/35 as below, add $(LIBNL_LIB)
26 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBNL_LIB)
30 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBNL_LIB)
35 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBNL_LIB)
modify tests/Makeifle line 26, alo add $(LIBNL_LIB) as below:
24 test-%: test-%.c
25 @echo " LD $@"; \
26 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBNL_LIB)
7) make;make install, successfully!!
libnl-1.1 installed in /home/install/libnl directory.
3, Come back to build hostapd
1) add libnl library info in .config as below:
35 CFLAGS += -I/home/joe/joeinstall/libnl/include
36 LDFLAGS += -I/home/joe/joeinstall/libnl/include
37 LIBS += -L/home/joe/joeinstall/libnl/lib
38 LIBS_p += -L/home/joe/joeinstall/libnl/lib
2) make clean;make
error info output:
CC ../src/drivers/driver_common.c
/opt/ba-glibc-le-nor31/bin/../lib/gcc/ba-linux/4.5.2/../../../../ba-linux/bin/ld: warning: libm.so.6, needed by /home/joe/joeinstall/libnl/lib/libnl.so, not found (try using -rpath or -rpath-link)
/home/joe/joeinstall/libnl/lib/libnl.so: undefined reference to http://blog.csdn.net/junllee/article/details/mailto:%60lrint@GLIBC_2.1'
collect2: ld returned 1 exit status
make: *** [hostapd] Error 1
3) modify .config, add -lm option in LDFLAGS:
32 LDFLAGS += -ldl -march=ba2 -mle -lm -I/home/joe/joeinstall/openssl/include
4) make; ok,Done:
CC ../src/drivers/driver_common.c
LD hostapd
CC hostapd_cli.c
CC ../src/common/wpa_ctrl.c
CC ../src/utils/edit_simple.c
LD hostapd_cli
联系客服