在Openwrt編譯工具鏈和SDK之後可能報錯如下:
zchx@zchx-System-Product-Name:~$ mips-openwrt-linux-g++ mips-openwrt-linux-uclibc-g++.bin: environment variable "STAGING_DIR" not defined
其解決方案很簡單,就是編譯的時候也選擇上編譯SDk,在編譯好了的SDK中,包含了工具鏈。這裡的工具鏈就不會報錯了。Good TIme。
zchx@zchx-System-Product-Name:~/Openwrt-USE/OpenWrt-SDK-atheros-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/bin$ ls
ldd mips-openwrt-linux-uclibc-addr2line
mips-openwrt-linux-addr2line mips-openwrt-linux-uclibc-ar
mips-openwrt-linux-ar mips-openwrt-linux-uclibc-as
mips-openwrt-linux-as mips-openwrt-linux-uclibc-c++
mips-openwrt-linux-c++ mips-openwrt-linux-uclibc-c++filt
mips-openwrt-linux-c++filt mips-openwrt-linux-uclibc-cpp
mips-openwrt-linux-cpp mips-openwrt-linux-uclibc-g++
mips-openwrt-linux-g++ mips-openwrt-linux-uclibc-gcc
mips-openwrt-linux-gcc mips-openwrt-linux-uclibc-gcc-4.3.3
mips-openwrt-linux-gcc-4.3.3 mips-openwrt-linux-uclibc-gccbug
mips-openwrt-linux-gccbug mips-openwrt-linux-uclibc-gcov
mips-openwrt-linux-gcov mips-openwrt-linux-uclibc-gprof
mips-openwrt-linux-gprof mips-openwrt-linux-uclibc-ld
mips-openwrt-linux-ld mips-openwrt-linux-uclibc-nm
mips-openwrt-linux-nm mips-openwrt-linux-uclibc-objcopy
mips-openwrt-linux-objcopy mips-openwrt-linux-uclibc-objdump
mips-openwrt-linux-objdump mips-openwrt-linux-uclibc-ranlib
mips-openwrt-linux-ranlib mips-openwrt-linux-uclibc-readelf
mips-openwrt-linux-readelf mips-openwrt-linux-uclibc-size
mips-openwrt-linux-size mips-openwrt-linux-uclibc-strings
mips-openwrt-linux-strings mips-openwrt-linux-uclibc-strip
mips-openwrt-linux-strip
zchx@zchx-System-Product-Name:~/Openwrt-USE/OpenWrt-SDK-atheros-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/bin$ ./mips-openwrt-linux-g++
然後把staging_dir加入到環境變數中就可以了。
export STAGING_DIR=~/Downloads/OpenWrt-SDK-atheros-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/bin:$STAGING_DIR
使用eclipse的話,不要使用sudo登陸。直接普通使用者登陸