Ubuntu2204 Tina4.0 编译

A133

Posted by LXG on January 17, 2025

全志哪吒D1-H Tina Linux Ubuntu 22.04入门踩坑日记

报错-1


In file included from /usr/include/signal.h:328,
                 from ./signal.h:52,
                 from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
   55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
      |                          ^~~~~~~~
make[7]: *** [Makefile:1910: c-stack.o] Error 1

解决方案

tools/m4/patches/012-fix-sigstksz-ubuntu2204.patch


--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -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,18 +129,6 @@ die (int signo)
 #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 +194,8 @@ c_stack_action (void (*action) (int))
 
   /* 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 +268,14 @@ c_stack_action (void (*action) (int))
   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)
--- a/lib/c-stack.h
+++ b/lib/c-stack.h
@@ -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 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


In file included from elf_data.hpp:24,
                 from elf.cpp:21:
elf.hpp:52:56: error: ISO C++17 does not allow dynamic exception specifications
   52 |       const section &get_section(unsigned int i) const throw (std::out_of_range) { return *sections.at(i); };
      |                                                        ^~~~~
elf.hpp:62:47: error: ISO C++17 does not allow dynamic exception specifications
   62 |       static file *open(const char *filename) throw (std::bad_alloc, std::runtime_error);
      |                                               ^~~~~
elf.hpp:65:38: error: ISO C++17 does not allow dynamic exception specifications
   65 |       file(uint8_t *mem, size_t len) throw (std::bad_alloc) : mem(mem), len(len) { }
      |                                      ^~~~~
elf.hpp:68:52: error: ISO C++17 does not allow dynamic exception specifications
   68 |         static file *open_class(uint8_t *, size_t) throw (std::bad_alloc, std::runtime_error);
      |                                                    ^~~~~
elf.hpp:131:55: error: ISO C++17 does not allow dynamic exception specifications
  131 |         std::string get_string(uint32_t offset) const throw (std::bad_alloc)
      |                                                       ^~~~~
elf.hpp:266:39: error: ISO C++17 does not allow dynamic exception specifications
  266 |       std::string get_version() const throw (std::bad_alloc);


解决方案

tools/mklibs/patches/012-Declare-cxxstd.patch


--- a/src/mklibs-readelf/Makefile.am
+++ b/src/mklibs-readelf/Makefile.am
@@ -3,1 +3,2 @@ 

+ CXXFLAGS += -std=gnu++98


报错-3


libfakeroot.c: In function 'lremovexattr':
libfakeroot.c:100:42: error: '_STAT_VER' undeclared (first use in this function)
  100 | #define INT_NEXT_LSTAT(a,b) NEXT_LSTAT64(_STAT_VER,a,b)
      |                                          ^~~~~~~~~
fakerootconfig.h:13:45: note: in definition of macro 'NEXT_LSTAT64'
   13 | #define NEXT_LSTAT64(a,b,c) next___lxstat64(a,b,c)
      |                                             ^
libfakeroot.c:1868:5: note: in expansion of macro 'INT_NEXT_LSTAT'
 1868 |   r=INT_NEXT_LSTAT(path, &st);
      |     ^~~~~~~~~~~~~~
libfakeroot.c: In function 'fremovexattr':
libfakeroot.c:101:42: error: '_STAT_VER' undeclared (first use in this function)
  101 | #define INT_NEXT_FSTAT(a,b) NEXT_FSTAT64(_STAT_VER,a,b)
      |                                          ^~~~~~~~~

解决方案

tools/fakeroot/patches/0001-Fix-STAT_VER.patch


--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -89,4 +89,13 @@
#define SEND_GET_STAT64(a,b) send_get_stat64(a)
#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

报错-4


host/include/nspr -I../../../dist/build_dir/include -I../../../dist/public/nss -I../../../dist/private/nss  quickder.c
In file included from quickder.c:11:0:
secasn1.h:15:21: fatal error: plarena.h: No such file or directory
 #include "plarena.h"
                     ^

解决方案


diff --git a/lichee/package/libs/nss/Makefile b/lichee/package/libs/nss/Makefile
index e45d1ddb6..2d1954e6c 100644
--- a/lichee/package/libs/nss/Makefile
+++ b/lichee/package/libs/nss/Makefile
@@ -76,7 +76,7 @@ export OS_ARCH=Linux
 export OS_TEST=$(ARCH)
 export CPU_ARCH=$(ARCH)
 export fpic=$(FPIC)
-export NSPR_INCLUDE_DIR=$(STAGING_DIR)/host/include/nspr
+export NSPR_INCLUDE_DIR=$(STAGING_DIR)/usr/include/nspr
 export SEED_ONLY_DEV_URANDOM=1
 export OS_REL_CFLAGS=$(TARGET_CFLAGS)
 export NS_USE_GCC=1

报错-5


controller-enumtypes.c:6:1: error: stray '\' in program
 \#include "gstinterpolationcontrolsource.h"
 ^
controller-enumtypes.c:6:2: error: stray '#' in program
 \#include "gstinterpolationcontrolsource.h"
  ^
controller-enumtypes.c:6:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before string constant
 \#include "gstinterpolationcontrolsource.h"
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
controller-enumtypes.c:7:1: error: stray '\' in program
 \#include "gstlfocontrolsource.h"
 ^
controller-enumtypes.c:7:2: error: stray '#' in program
 \#include "gstlfocontrolsource.h"

解决方案

package/multimedia/gstreamer1/patches/0002-gstreamer-make43-wo-automake.patch

报错-6


tag-enumtypes.c:6:1: error: stray '\' in program
 \#include "tag.h"
 ^
tag-enumtypes.c:6:2: error: stray '#' in program
 \#include "tag.h"
  ^
tag-enumtypes.c:6:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before string constant
 \#include "tag.h"
           ^~~~~~~
tag-enumtypes.c:7:1: error: stray '\' in program
 \#include "gsttagdemux.h"
 ^
tag-enumtypes.c:7:2: error: stray '#' in program
 \#include "gsttagdemux.h"
  ^

解决方案

package/multimedia/gst1-plugins-bad/patches/0019-make-fix.patch

package/multimedia/gst1-plugins-base/patches/0015-make-fix.patch

报错-7


./Modules/getbuildinfo.c: In function 'Py_GetBuildInfo':
./Modules/getbuildinfo.c:47:19: error: environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799
   47 |                   DATE, TIME);
      |                   ^~~~
make[4]: *** [Makefile:661: Modules/getbuildinfo.o] Error 1

解决方案


diff --git a/lichee/scripts/get_source_date_epoch.sh b/lichee/scripts/get_source_date_epoch.sh
index b46c78e47..4e7906a6b 100755
--- a/lichee/scripts/get_source_date_epoch.sh
+++ b/lichee/scripts/get_source_date_epoch.sh
@@ -28,7 +28,7 @@ try_hg() {
 }
 
 try_repo() {
-       [ -d .repo ] || return 1
+#      [ -d .repo ] || return 1
        SOURCE_DATE_EPOCH="$(date +%s)"
        [ -n "$SOURCE_DATE_EPOCH" ]
 }

报错-8

在D1 TinaLinux SDK中编译Python报错


if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Aborted (core dumped)
make[4]: *** [Makefile:937: install] Error 134
make[4]: Leaving directory '/home/lxg/code/project/A133_Tina4.0_V2.5/1.SDK/a133_tina4.0_v2.5/lichee/out/a133-b6/compile_dir/target/host/Python-2.7.15'
make[3]: *** [Makefile:250: /home/lxg/code/project/A133_Tina4.0_V2.5/1.SDK/a133_tina4.0_v2.5/lichee/out/a133-b6/staging_dir/target/host/stamp/.python_installed] Error 2

解决方案


diff --git a/lichee/package/lang/python/Makefile b/lichee/package/lang/python/Makefile.bak
similarity index 100%
rename from lichee/package/lang/python/Makefile
rename to lichee/package/lang/python/Makefile.bak
diff --git a/lichee/package/lang/python/files/python-package.mk b/lichee/package/lang/python/files/python-package.mk
index 30310793e..a714ac538 100644
--- a/lichee/package/lang/python/files/python-package.mk
+++ b/lichee/package/lang/python/files/python-package.mk
@@ -5,8 +5,8 @@
 # See /LICENSE for more information.
 #
 
-PYTHON_VERSION:=2.7
-PYTHON_VERSION_MICRO:=15
+PYTHON_VERSION:=3.5
+PYTHON_VERSION_MICRO:=6
 
 PYTHON_DIR:=$(STAGING_DIR)/usr
 PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin

diff --git a/lichee/package/lang/python3/patches/002-do-not-add-include-dirs-when-cross-compiling.patch b/lichee/package/lang/python3/patches/002-do-not-add-include-dirs-when-cross-compiling.patch
index 44be1c8ff..3a10c6a37 100644
--- a/lichee/package/lang/python3/patches/002-do-not-add-include-dirs-when-cross-compiling.patch
+++ b/lichee/package/lang/python3/patches/002-do-not-add-include-dirs-when-cross-compiling.patch
@@ -2,9 +2,9 @@ diff --git a/setup.py b/setup.py
 index 93f390f..ace1494 100644
 --- a/setup.py
 +++ b/setup.py
-@@ -461,7 +461,8 @@ class PyBuildExt(build_ext):
+@@ -533,7 +533,8 @@ class PyBuildExt(build_ext):
                          add_dir_to_list(dir_list, directory)
- 
+
          if os.path.normpath(sys.base_prefix) != '/usr' \
 -                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
 +                and not sysconfig.get_config_var('PYTHONFRAMEWORK') \