全志r528编译搭建之“秘籍”

在服务器上搭建了ubuntu16、18、22的虚拟机进行r528 编译环境的搭建,发现16没有成功, 18成功了, 成功了就没有去看22下的编译了。

ubuntu16一直不能成功,出现的错误如图下:

arm/toolchain-sunxi-glibc/toolchain/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such  # include <gnu/stubs-soft.h>

 于是果断停下来使用ubuntu18, 最后成功了,现在总结下大概要做的步骤:

一 下载对应代码:

1 NDA当然少不了,然后开始上传公钥

2 来了,下载了:

$mkdir tina-r528

$ cd tina-r528

$ repo init -u ssh://你的账号@你的授权代码仓库/git_repo/R528_Tina/manifest.git -b master -m tina-r528.xml $ repo sync $ repo start product-smartx-r528-tina-stable-v1.0 --all

3 安装编译相关的依赖

sudo apt-get install build-essential subversion git libncurses5-dev  zlib1g-dev gawk  flex quilt  libssl-dev  xsltproc  libxml-parser-perl  mercurial  bzr  ecj  cvs  unzip lib32z1 lib32z1-dev lib32stdc++6  libstdc++6  -y libc6:i386  libstdc++6:i386  lib32ncurses5   lib32z1

 

4 开始编译

(1)source build/envsetup.h

(2)lunch

(3)make -j1 V=s 2>&1|tee make.log     (这里我是为了记录编译的错误,填编译环境的坑开始)

(4)pack [-d]

二 坑的总结:

1      .c-stack.c:55:26: error: missing binary operator before token

遇到了buildroot 的坑:

看宝典: 我把补丁的文件(0003-c-stack-stop-using-SIGSTKSZ.patch)放在tina-r528/tools/m4/patch/下, 搞点0003-c-stack-stop-using-SIGSTKSZ.patch « m4 « package - buildroot - Buildroot: Making Embedded Linux easy

c-stack: stop using SIGSTKSZ

It’s been proposed to stop making SIGSTKSZ an integer constant:
https://sourceware.org/pipermail/libc-alpha/2020-September/118028.html
Also, using SIGSTKSZ in #if did not conform to current POSIX.
Also, avoiding SIGSTKSZ makes the code simpler and easier to grok.
* lib/c-stack.c (SIGSTKSZ): Remove.
(alternate_signal_stack): Now a 64 KiB array, for simplicity.
All uses changed.

[Retrieved (and backported) from:
https://git.savannah.gnu.org/cgit/gnulib.git/patch/?id=f9e2b20a12a230efa30f1d479563ae07d276a94b]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

diff -Nura m4-1.4.18.orig/lib/c-stack.c m4-1.4.18/lib/c-stack.c
--- m4-1.4.18.orig/lib/c-stack.c	2021-04-11 19:12:14.086494029 +0200
+++ m4-1.4.18/lib/c-stack.c	2021-04-11 19:48:46.316862760 +0200
@@ -50,15 +50,16 @@
 #if ! HAVE_STACK_T && ! defined stack_t
 typedef struct sigaltstack stack_t;
 #endif
-#ifndef SIGSTKSZ
-# define SIGSTKSZ 16384
-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
-   more than the Linux default of an 8k alternate stack when deciding
-   if a fault was caused by stack overflow.  */
-# undef SIGSTKSZ
-# define SIGSTKSZ 16384
-#endif
+
+/* Storage for the alternate signal stack.
+   64 KiB is not too large for Gnulib-using apps, and is large enough
+   for all known platforms.  Smaller sizes may run into trouble.
+   For example, libsigsegv 2.6 through 2.8 have a bug where some
+   architectures use more than the Linux default of an 8 KiB alternate
+   stack when deciding if a fault was caused by stack overflow.  */
+static max_align_t alternate_signal_stack[(64 * 1024
+                                           + sizeof (max_align_t) - 1)
+                                          / sizeof (max_align_t)];
 
 #include <stdlib.h>
 #include <string.h>
@@ -128,19 +129,6 @@
 #if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
      && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV
 
-/* Storage for the alternate signal stack.  */
-static union
-{
-  char buffer[SIGSTKSZ];
-
-  /* These other members are for proper alignment.  There's no
-     standard way to guarantee stack alignment, but this seems enough
-     in practice.  */
-  long double ld;
-  long l;
-  void *p;
-} alternate_signal_stack;
-
 static void
 null_action (int signo __attribute__ ((unused)))
 {
@@ -205,8 +193,8 @@
 
   /* Always install the overflow handler.  */
   if (stackoverflow_install_handler (overflow_handler,
-                                     alternate_signal_stack.buffer,
-                                     sizeof alternate_signal_stack.buffer))
+                                     alternate_signal_stack,
+                                     sizeof alternate_signal_stack))
     {
       errno = ENOTSUP;
       return -1;
@@ -279,14 +267,14 @@
   stack_t st;
   struct sigaction act;
   st.ss_flags = 0;
+  st.ss_sp = alternate_signal_stack;
+  st.ss_size = sizeof alternate_signal_stack;
 # if SIGALTSTACK_SS_REVERSED
   /* Irix mistakenly treats ss_sp as the upper bound, rather than
      lower bound, of the alternate stack.  */
-  st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
-  st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
-# else
-  st.ss_sp = alternate_signal_stack.buffer;
-  st.ss_size = sizeof alternate_signal_stack.buffer;
+  st.ss_size -= sizeof (void *);
+  char *ss_sp = st.ss_sp;
+  st.ss_sp = ss_sp + st.ss_size;
 # endif
   r = sigaltstack (&st, NULL);
   if (r != 0)
diff -Nura m4-1.4.18.orig/lib/c-stack.h m4-1.4.18/lib/c-stack.h
--- m4-1.4.18.orig/lib/c-stack.h	2021-04-11 19:12:14.098494042 +0200
+++ m4-1.4.18/lib/c-stack.h	2021-04-11 19:17:42.138848378 +0200
@@ -34,7 +34,7 @@
    A null ACTION acts like an action that does nothing.
 
    ACTION must be async-signal-safe.  ACTION together with its callees
-   must not require more than SIGSTKSZ bytes of stack space.  Also,
+   must not require more than 64 KiB bytes of stack space.  Also,
    ACTION should not call longjmp, because this implementation does
    not guarantee that it is safe to return to the original stack.

2  elf.hpp:52:56: error: ISO C++17 does not allow dynamic exception specifications

 真实折腾~~~~, 补丁只有几句我就手动加了 tools/mklibs/Makefiletools/mklibs: Fix compile with GCC 11 · a1ee0ebbd8 - openwrt - Freifunk Franken Git

 3  libfakeroot.c:99:40: error: ‘_STAT_VER’ undeclared (first use in this function)

 无语了~, 继续FS#69572 : [fakeroot] fails to build: _STAT_VER undeclared

 我根据以下补丁直接修改我的文件“ out/r528-evb3hmi/compile_dir/host/fakeroot-1.20.2/libfakeroot.c”

From 8b32ba771160d440a7fa3a358dfcf7804e14d5ba Mon Sep 17 00:00:00 2001
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Date: Thu, 11 Feb 2021 20:59:25 -0800
Subject: [PATCH 1/6] libfakeroot.c: define _STAT_VER if not already defined

Based on patch from Jan Pazdziora:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
---
 libfakeroot.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libfakeroot.c b/libfakeroot.c
index 3e80e38..14cdbc4 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -90,6 +90,16 @@
 #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
 #endif
 
+#ifndef _STAT_VER
+ #if defined (__aarch64__)
+  #define _STAT_VER 0
+ #elif defined (__x86_64__)
+  #define _STAT_VER 1
+ #else
+  #define _STAT_VER 3
+ #endif
+#endif
+
 /*
    These INT_* (which stands for internal) macros should always be used when
    the fakeroot library owns the storage of the stat variable.
-- 
2.30.1

4  /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x0): first defined here
...
/usr/bin/ld: xattr.o:(.bss+0x8): multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x8): first defined here
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:262: mksquashfs] Error 1

 继续百度发现

tools: squashfskit4: fix build with GCC10 · be4ed1db18 - openwrt - Gitce

 

再加上补丁  

tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch

@ -0,0 +1,43 @@
From fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Sun, 26 Jan 2020 18:35:13 +0000
Subject: [PATCH] squashfs-tools: fix build failure against gcc-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On gcc-10 (and gcc-9 -fno-common) build fails as:

```
cc ... -o mksquashfs
ld: read_fs.o:(.bss+0x0):
  multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here
ld: read_fs.o:(.bss+0x8):
  multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here
```

gcc-10 will change the default from -fcommon to fno-common:
https://gcc.gnu.org/PR85678.

The error also happens if CFLAGS=-fno-common passed explicitly.

Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/706456
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 squashfs-tools/mksquashfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h
index 1beefef7..b6503063 100644
--- a/squashfs-tools/mksquashfs.h
+++ b/squashfs-tools/mksquashfs.h
@@ -143,7 +143,7 @@ struct append_file {
 #endif
 
 extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
-struct cache *bwriter_buffer, *fwriter_buffer;
+extern struct cache *bwriter_buffer, *fwriter_buffer;
 extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
 	*to_frag, *locked_fragment, *to_process_frag;
 extern struct append_file **file_mapping;

  • 19
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值