P1 Can’t use ‘defined(@array)’
Linux kernel 无法编译通过,报了如下错误:
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373.
kernel/timeconst.pl
中的代码:
372 @val = @{$canned_values{$hz}};
373 if (!defined(@val)) {
374 @val = compute_values($hz);
375 }
376 output($hz, @val);
|
将if (!defined(@val))
改为if (!@val)
,再次编译就 OK。
原因:perl版本升级到 v5.22.1,发现官网因为一个bug,将defined(@array)去掉了。可以直接使用数组判断非空。
来自:http://blog.5ibc.net/p/48570.html
P2 /bin/automake.tmp line 3938.
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at ./bin/automake.tmp line 3938.
增加patch
tools/automake/patches/210-fix-bug-because-of-high-perl-version.patch
diff --git a/bin/automake.in b/bin/automake.in
index 0ee37149dd..8ce621d1af 100644
--- a/bin/automake.in
+++ b/automake.in
@@ -3880,7 +3880,8 @@ 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;
+ $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
return $text;
}
编译Openwrt源码,提示git依赖错误,意思是需要安装1.6.5以上版本的git,而系统中已安装2.17.1版本的git。
Build dependency: Please install Git (git-core) >= 1.6.5
/home/gooday/openwrt/include/prereq.mk:12: recipe for target 'prereq' failed
Prerequisite check failed. Use FORCE=1 to override.
/home/gooday/openwrt/include/toplevel.mk:140: recipe for target 'staging_dir/host/.prereq-build' failed
make: *** [staging_dir/host/.prereq-build] Error 1
解决方法:
方法一:
找到文件 openwrt/include/prereq-build.mk 的第148行,修改 git clone 2>&1 | grep -- --recursive 为 git verison
感谢网友【逸云飞扬】https://bbs.csdn.net/topics/392261336
方法二:
将文件复制到/home/gooday/openwrt/include路径下
在当前路径下执行命令
patch < git-version-check-fix.patch
出错信息:error: dereferencing pointer to incomplete type 'RSA {aka struct rsa_st}'
原因:由于默认使用了openssl 1.1.x 版本,导致的API不一致引起
解决:
1,直接安装openssl1.0版本,Debian 系:apt-get install libssl1.0-dev
————————————————
版权声明:本文为CSDN博主「princeofdream」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/princeofdream/article/details/74546431
编译ncurses错误处理及解决办法
编译ncurses是编译linux内核时用到的一个工具,在make时遇到了如下错误:
In file included from ../ncurses/curses.priv.h:283:0,
from ../ncurses/lib_gen.c:19:
_46863.c:835:15: error: expected ‘)’ before ‘int’
../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
^
Makefile:790: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: Leaving directory '/home/ran/workspace/ncurses-5.9/ncurses'
Makefile:109: recipe for target 'all' failed
make: *** [all] Error 2
根据出错提示,找到ncurses目录下,include文件夹里的curses.h文件,查找mouse_trafo,锁定在1584行
1583 extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
1584 extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
应该是由后面的一行注释引起的,具体原因不详
由于代码的部分是由另一个文件curses.tail
导入的,所以要修改curses.tail,
sudo vim curses.tail
查找mouse_trafo,定位到104行,去除104行后面的注释
103 extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);
104 extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */
————————————————
版权声明:本文为CSDN博主「空灵花」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/praying2/article/details/52143557
编译类openwrt sdk时,出现个gdate.c的错误,与编译器版本有关,打个patch就好
gdate.c: In function 'g_date_strftime':
gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral]
tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
^~~~~~
cc1: some warnings being treated as errors
make[10]: *** [Makefile:1386: libglib_2_0_la-gdate.lo] Error 1
make[10]: Leaving directory '/opt/water/tina-sdk/out/mandolin-perf1/compile_dir/host/pkg-config-0.29/glib/glib'
解决:
单独改源码方式不好,下次重新编译有可能又要重新改, 所以新建个patch一劳永逸
在tools/pkg-config/patches/目录下创建新文件001-glib-gdate-suppress-string-format-literal-warning.patch
内容如下:
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d,
*
* Returns: number of characters written to the buffer, or 0 the buffer was too small
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
gsize
g_date_strftime (gchar *s,
gsize slen,
@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s,
return retval;
#endif
}
+
+#pragma GCC diagnostic pop