Ubuntu1804编译openwrt遇到的问题

第一个错误

错误信息:

autoreconf: running: /home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin/automake --add-missing
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin/automake line 4160.
autoreconf: /home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin/automake failed with exit status: 255
(cd /home/li/OS/IBSS/IBSS-openwrt.git/build_dir/host/mklibs-0.1.35/; if [ -x configure ]; then cp -fpR /home/li/OS/IBSS/IBSS-openwrt.git/scripts/config.{guess,sub} /home/li/OS/IBSS/IBSS-openwrt.git/build_dir/host/mklibs-0.1.35// &&  /bin/bash ./configure CC="gcc" CFLAGS="-O2 -I/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/include -I/home/li/OS/IBSS/IBSS-openwrt.git/tools/mklibs/include" CPPFLAGS="-I/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/include" LDFLAGS="-L/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/lib " SHELL="/bin/bash" --target=x86_64-linux-gnu --host=x86_64-linux-gnu --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host --exec-prefix=/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host --sysconfdir=/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/etc --localstatedir=/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/var --sbindir=/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin ; fi )
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
Makefile:35: recipe for target '/home/li/OS/IBSS/IBSS-openwrt.git/build_dir/host/mklibs-0.1.35/.configured' failed
make[3]: *** [/home/li/OS/IBSS/IBSS-openwrt.git/build_dir/host/mklibs-0.1.35/.configured] Error 1
make[3]: Leaving directory '/home/li/OS/IBSS/IBSS-openwrt.git/tools/mklibs'
tools/Makefile:157: recipe for target 'tools/mklibs/compile' failed
make[2]: *** [tools/mklibs/compile] Error 2
make[2]: Leaving directory '/home/li/OS/IBSS/IBSS-openwrt.git'
tools/Makefile:156: recipe for target '/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyyynyyyyyyyynyyyynnyyynnyynnnyyyy' failed
make[1]: *** [/home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyyynyyyyyyyynyyyynnyyynnyynnnyyyy] Error 2
make[1]: Leaving directory '/home/li/OS/IBSS/IBSS-openwrt.git'
/home/li/OS/IBSS/IBSS-openwrt.git/include/toplevel.mk:171: recipe for target 'world' failed
make: *** [world] Error 2

寻找原因行

Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /home/li/OS/IBSS/IBSS-openwrt.git/staging_dir/host/bin/automake line 4160.

是staging_dir/host/bin/automake的4160行报错
因为新版的perl不再支持左大括号的使用,
进入

vim staging_dir/host/bin/automake +4160

文件删掉大括号,问题解决。

第二个错误

error: ‘gnu_inline’ attribute present on ‘libc_name_p’

.../gcc/cp/cfns.gperf: error: ‘gnu_inline’ attribute present on ‘libc_name_p’ 
.../gcc/cp/cfns.gperf: error: but not here

解决办法

参考这里
修改GGC编译目录下

./build_dir/toolchain-mipsel_mips32_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2013.05/gcc/cp/cfns.h
把原来的文件备份下
--- gcc/cp/cfns.h.orig  2015-02-13 08:27:46.000000000 +0200
+++ gcc/cp/cfns.h   2015-02-13 10:23:53.000000000 +0200
########参考修改处1##################
@@ -56,6 +56,9 @@
 static unsigned int hash (const char *, unsigned int);
 #ifdef __GNUC__
 __inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
 #endif
 const char * libc_name_p (const char *, unsigned int);
 /* maximum key range = 391, duplicates = 0 */
#########参考修改处2###################
@@ -96,7 +99,7 @@
       400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
       400, 400, 400, 400, 400, 400, 400
     };
-  register int hval = len;
+  register int hval = (int)len;
 
   switch (hval)
     {

如上,第二个问题解决

第三个错误

gdate.c:2497:7: error: format not a string literal, format string not checked [-Werror=format-nonliteral] #12

解决办法

修改

./build_dir/host/pkg-config-0.28/glib/glib/gdate.c  
./build_dir/host/glib-2.41.1/glib/gdate.c

参考这里

diff --git a/glib/glib/gdate.c b/glib/glib/gdate.c
index 1978cf7..9be9b97 100644
--- a/glib/glib/gdate.c
+++ b/glib/glib/gdate.c
#第一处:2439行修改
@@ -2439,6 +2439,10 @@ 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行修改
@@ -2549,3 +2553,5 @@ g_date_strftime (gchar       *s,
   return retval;
 #endif
 }
+
+#pragma GCC diagnostic pop

第四个错误

Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373.

这个错误是说应该省略defined().
打开

vim ./build_dir/target-mipsel_mips32_uClibc-0.9.33.2/linux-xburst_canna/linux-3.0.8/kernel/timeconst.pl +373

373行

@val = @{$canned_values{$hz}};
if (!defined(@val)) {
@val = compute_values($hz);
}
output($hz, @val);

if (!defined(@val))

改为

if (!(@val))

就ok了
perl版本升级到了 v5.22.1,官网因为有个BUG,该版本将defined(@array)去掉了。可以直接使用数组判断非空

编完了,没错了~~

你可能感兴趣的:(Ubuntu1804编译openwrt遇到的问题)