最近到手1个K2p, 刷了openwrt-chaos-calmer,在编译shadowsocks-libev的时候遇到很多坑,这里记录下。

编译过程参考了shadowsocks/openwrt-shadowsocks的README,OpenWrt SDK 文档,以及这篇文章

./scripts/feeds update 报错

  • 有用的报错信息:
Argument "4.2.1" isn't numeric in numeric ge (>=) at ./scripts/feeds line 25
  • 解决方法:

打上下面这个patch,或者手动修改./scripts/feeds

@@ -22,7 +22,10 @@ my @mkver = split /\s+/, `$mk -v`, 4;
my $valid_mk = 1;
$mkver[0] =~ /^GNU/ or $valid_mk = 0;
$mkver[1] =~ /^Make/ or $valid_mk = 0;
-$mkver[2] >= "3.81" or $valid_mk = 0;
+
+my ($mkv1, $mkv2) = split /\./, $mkver[2];
+($mkv1 >= 4 || ($mkv1 == 3 && $mkv2 >= 81)) or $valid_mk = 0;
+
$valid_mk or die "Unsupported version of make found: $mk\n";

my @feeds;

make menuconfig报错

  • 有用的报错信息:
make -s -C scripts/config all CC=cc: build failed. Please re-run make with -j1 V=s to see what's going on
  • 解决方法:

按照报错信息,运行make -j1 v=s

  • 有用的报错信息:
The C compiler
"/home/daveh/.local/share/openwrt-sdk/OpenWrt-SDK-15.05.1-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/host/bin/ccache"
is not able to compile a simple test program.
  • 解决方法:

这里卡了很长时间,直到无意中在pacman中搜到ccache这个软件包,抱着试一下的心态安装完,make ./package/shadowsocks-libev/compile V=99终于开始编译依赖包了。但是make menuconfig还是报错build failed

编译依赖包pcre不通过

  • 有用的报错信息:
Unescaped left brace in regex is illegal here in regex staging_dir/host/bin/automake-1.15 line 3938
  • 解决方法:

找错误信息找到眼瞎,不得不说gcc的interface就是一坨屎啊,应该不是给人用的吧??!
找到错误信息就简单了,google爸爸愉快地给出了答案…

./staging_dir/host/bin/automake打上下面这个patch:

From 13f00eb4493c217269b76614759e452d8302955e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 31 Mar 2016 16:35:29 -0700
Subject: [PATCH] automake: port to Perl 5.22 and later

Without this change, Perl 5.22 complains "Unescaped left brace in
regex is deprecated" and this is planned to become a hard error in
Perl 5.26. See:
http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#A_literal_%22{%22_should_now_be_escaped_in_a_pattern
* bin/automake.in (substitute_ac_subst_variables): Escape left brace.
---
bin/automake.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/automake.in b/bin/automake.in
index a3a0aa318..2c8f31e14 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker
sub substitute_ac_subst_variables
{
my ($text) = @_;
- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+ $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
return $text;
}

--
2.13.1

最后总结

make ./package/shadowsocks-libev/compile V=99 成功编译出ipk文件。但最后make menuconfig还是无法运行,不管啦!啦啦啦~~