事实上我觉得在openwrt下所有的东西都不像看上去那么容易,本来linux下就有“dependence hell", openwrt下更是问题一堆堆。。。
一天试验的结果,pptp,l2tp/ipsec,cisco ipsec,甚至某个vpn厂商自己定制的协议都被长城 f-u-c-k了,表现是丢包率都在2%以上。只有sstp目前还好。但sstp似乎是windows下的,linux只有这个据说可用。
=========================================================================================================
已经有人移植到openwrt下:
https://github.com/openwrt/packages/tree/master/net/sstp-client
我也不知道到底怎么编译,查攻略有的说直接在openwrt的编译环境下编译,先把代码放到package目录下,make menuconfig,把这个package标注为"M",退出后,用make package/example/clean
make package/example/compile编译
也有说要下载SDK环境,也就是
以下引用:(http://blog.chinaunix.net/uid-27194309-id-3432651.html)
利用 SDK 生成自己的ipk安装包,
1. 解压
tar jxvf OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2
2. 进入目录
cd OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2
3. 将自己的代码目录拷贝到本目录的 package目录下
注意 Makefile 必须遵守openwrt的规则, 可参考
http://blog.chinaunix.net/uid-27194309-id-3432651.html
4. 编译, 成功后在bin/ar71xx/packages目录下可以看到相关的ipk文件, 可用winscp 拷贝出来
#编译所有组件
make V=99
#单独编译某个组件
make package/hid/compile
注意:
- 用迅雷下载的OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2好像是坏的,解压不了。直接用wget下载。
- 要进入OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2目录下编译,不要在package/example目录下
- 代码一定要放到package目录下,而不是packages目录下
- 虽然有SDK,但基本软件包还是要安装,见http://wiki.openwrt.org/doc/howto/buildroot.exigence,否则会报错:Build dependency: Please install ncurses.之类的。
=========================================================================================
我用SDK的方法编译的,编译过程报错:
configure: WARNING: unrecognized options: --disable-nls
configure: loading site script /home/harvey/BB/OpenWrt-SDK-ar71xx/include/site/mips-openwrt-linux-uclibc
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for mips-openwrt-linux-strip... mips-openwrt-linux-uclibc-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for mips-openwrt-linux-gcc... ccache_cc
checking whether the C compiler works... no
configure: error: in `/home/harvey/BB/OpenWrt-SDK-ar71xx/build_dir/target-mips_34kc_uClibc-0.9.33.2/sstp-client-1.0.9':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: *** [/home/harvey/BB/OpenWrt-SDK-ar71xx/build_dir/target-mips_34kc_uClibc-0.9.33.2/sstp-client-1.0.9/.configured_] Error 77
make[2]: Leaving directory `/home/harvey/BB/OpenWrt-SDK-ar71xx/package/sstp-client'
make[1]: *** [package/sstp-client/compile] Error 2
make[1]: Leaving directory `/home/harvey/BB/OpenWrt-SDK-ar71xx'
make: *** [package/sstp-client/compile] Error 2
h
检查config.log
configure:3230: ccache_cc --version >&5
/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/host/bin/ccache_cc: 2: exec: ccache: not found
configure:3241: $? = 127
configure:3230: ccache_cc -v >&5
/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/host/bin/ccache_cc: 2: exec: ccache: not found
configure:3241: $? = 127
configure:3230: ccache_cc -V >&5
/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/host/bin/ccache_cc: 2: exec: ccache: not found
configure:3241: $? = 127
configure:3230: ccache_cc -qversion >&5
/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/host/bin/ccache_cc: 2: exec: ccache: not found
configure:3241: $? = 127
configure:3261: checking whether the C compiler works
configure:3283: ccache_cc -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -mips16 -minterlink-mips16 -I/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include -I/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/target-mips_34kc_uClibc-0.9.33.2/include -I/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include -L/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib -L/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/target-mips_34kc_uClibc-0.9.33.2/lib -L/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib conftest.c >&5
/home/harvey/BB/OpenWrt-SDK-ar71xx/staging_dir/host/bin/ccache_cc: 2: exec: ccache: not found
configure:3287: $? = 127
configure:3325: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "sstp-client"
| #define PACKAGE_TARNAME "sstp-client"
| #define PACKAGE_VERSION "1.0.9"
| #define PACKAGE_STRING "sstp-client 1.0.9"
| #define PACKAGE_BUGREPORT "http://sourceforge.net/projects/sstp-client"
| #define PACKAGE_URL ""
| #define PACKAGE "sstp-client"
| #define VERSION "1.0.9"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3330: error: in `/home/harvey/BB/OpenWrt-SDK-ar71xx/build_dir/target-mips_34kc_uClibc-0.9.33.2/sstp-client-1.0.9':
configure:3332: error: C compiler cannot create executables
See `config.log' for more details
网上查了一些帖子,也有类似问题:
https://forum.openwrt.org/viewtopic.php?id=13447
http://www.linino.org/forums/topic/unable-to-build-latest-master/
https://dev.openwrt.org/ticket/13949
https://forum.openwrt.org/viewtopic.php?id=44271
https://dev.openwrt.org/ticket/10822
https://forum.openwrt.org/viewtopic.php?id=42864
看了半天,也没见怎么搞定。干脆简单粗暴的 apt-get install ccache 然后就可以了。。。