全志Tins编译错误

Posted tid-think

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了全志Tins编译错误相关的知识,希望对你有一定的参考价值。

今天开始正式干活了

第一件事就是给我一个全志tina的sdk和板子,他们说这个sdk好像有点问题,编译有个错误没法通过,要求我这周就要把sdk弄好,并编译出img把板子跑起来。

编译的时候报错

果然是有坑,

 

 $ tar -xvf Homlet-Tina-H2_H3
 $ cd Homlet-Tina-H2_H3
 $ source build/envsetup.sh
 $ lunch dolphin_p1-tina
 $ make –j4

 

编译15分钟之后就报错了

In file included from /usr/include/libxml2/libxml/parser.h:810:0,
                 from /usr/include/libxml2/libxml/globals.h:18,
                 from /usr/include/libxml2/libxml/threads.h:35,
                 from /usr/include/libxml2/libxml/xmlmemory.h:218,
                 from /usr/include/libxml2/libxml/tree.h:1307,
                 from mxmlds.c:22:/usr/include/libxml2/libxml/encoding.h:31:26: fatal error: unicode/ucnv.h: No such file or directory
compilation terminated.
Makefile:393: recipe for target mxmlds.lo failed
make[6]: *** [mxmlds.lo] Error 1
make[6]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/compile_dir/target/libmgncs-1.2.0/src/datasource
Makefile:624: recipe for target install-recursive failed
make[5]: *** [install-recursive] Error 1
make[5]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/compile_dir/target/libmgncs-1.2.0/src
Makefile:487: recipe for target install-recursive failed
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/compile_dir/target/libmgncs-1.2.0
Makefile:95: recipe for target /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/compile_dir/target/libmgncs-1.2.0/.built failed
make[3]: *** [/home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/compile_dir/target/libmgncs-1.2.0/.built] Error 2
make[3]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/package/minigui/libmgncs
package/Makefile:192: recipe for target package/minigui/libmgncs/compile failed
make[2]: *** [package/minigui/libmgncs/compile] Error 2
make[2]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3
package/Makefile:189: recipe for target /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/staging_dir/target/stamp/.package_compile failed
make[1]: *** [/home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/out/dolphin-p1/staging_dir/target/stamp/.package_compile] Error 2
make[1]: Leaving directory /home/liuxueneng/WorkCode/Homlet-Tina-H2_H3
Build failed - please re-run with -j1 to see the real error message
/home/liuxueneng/WorkCode/Homlet-Tina-H2_H3/build/toplevel.mk:275: recipe for target world failed
make: *** [world] Error 1

#### make failed to build some targets (12:27 (mm:ss)) ####

看报错是从encoding.h里面找不到被包含的头文件

打开/usr/include/libxml2/libxml/encoding.h看一下

/*                                                                            
   2  * Summary: interface for the encoding conversion functions                   
   3  * Description: interface for the encoding conversion functions needed for    
   4  *              XML basic encoding and iconv() support.                       
   5  *                                                                            
   6  * Related specs are                                                          
   7  * rfc2044        (UTF-8 and UTF-16) F. Yergeau Alis Technologies             
   8  * [ISO-10646]    UTF-8 and UTF-16 in Annexes                                 
   9  * [ISO-8859-1]   ISO Latin-1 characters codes.                               
  10  * [UNICODE]      The Unicode Consortium, "The Unicode Standard --            
  11  *                Worldwide Character Encoding -- Version 1.0", Addison-      
  12  *                Wesley, Volume 1, 1991, Volume 2, 1992.  UTF-8 is           
  13  *                described in Unicode Technical Report #4.                   
  14  * [US-ASCII]     Coded Character Set--7-bit American Standard Code for       
  15  *                Information Interchange, ANSI X3.4-1986.                    
  16  *                                                                            
  17  * Copy: See Copyright for the status of this software.                       
  18  *                                                                            
  19  * Author: Daniel Veillard                                                    
  20  */                                                                           
  21                                                                               
  22 #ifndef __XML_CHAR_ENCODING_H__                                               
  23 #define __XML_CHAR_ENCODING_H__                                               
  24                                                                               
  25 #include <libxml/xmlversion.h>                                                
  26                                                                               
  27 #ifdef LIBXML_ICONV_ENABLED                                                   
  28 #include <iconv.h>                                                            
  29 #endif                                                                        
  30 #ifdef LIBXML_ICU_ENABLED                                                     
  31 #include <unicode/ucnv.h>                                                     
  32 #endif                                                                        
  33 #ifdef __cplusplus                                                            
  34 extern "C" {                                                                  
  35 #endif          

看到有个宏

 LIBXML_ICU_ENABLED 

但是查看系统配置里面对这个宏的定义

查看/usr/include/libxml2/libxml/xmlversion.h里面对这个宏的定义的解释,是对icu的支持。

/**                                                                           
 281  * LIBXML_ICU_ENABLED:                                                        
 282  *                                                                            
 283  * Whether icu support is available                                           
 284  */                                                                           
 285 #if 1                                                                         
 286 #define LIBXML_ICU_ENABLED                                                    
 287 #endif   

但是本身目前的需求是不需要支持的,可以在这里屏蔽掉,但是这个是编译服务器的头文件,没有权限修改。

另外为了编译某个项目把公用的头文件屏蔽功能对其他项目有这个需求的可能会有影响。

本身sdk都带有所以依赖库的源码包,需要做的是将依赖的头文件目录路径更改到自带的路径下。

下面的问题就变成了怎么找到到这个头文件包含的路径设置的地方进行修改。

整个sdk编译走的都是makefile结构,头文件路径有些是从父级继承下来的,有些是子源码目录自己添加的。

总之指向/usr/include/libxml2/libxml的地方就是会有问题,

查看出问题源码下面的Makefile发现了CPPFLAGS里面就是包含了整个路劲

Makefile文件来自于configure之后产生,所以这个应该是和configure有关

于是去查找源码目录下的configure文件果然发现了configure.as写死了包含这个路径

 

if test "x$build_datasource_xml" = "xyes"; then                               
     AC_DEFINE(_MGNCSDB_DATASOURCE, 1,                                         
         [Define if support datasource])                                       
     AC_DEFINE(_MGNCSDB_XML, 1,                                                
                 [Define if support xml datasource])                     
     CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
fi

这就是问题的关键,把这个头文件地址改到自己指定的libxml2目录就可以了

CPPFLAGS="$CPPFLAGS -I../../../../package/allwinner/liballwinner_tina/liballwinner/LIBRARY/EXTERNAL/include/libxml"

重新编译就好了

 

以上是关于全志Tins编译错误的主要内容,如果未能解决你的问题,请参考以下文章

全志A33 lichee怎样编译镜像

全志R16编译环境搭建指南,全志R16_Tina SDK Quick Start Guide

全志R11交叉编译器灵活使用

全志H5 Ubuntu系统通过VPN下载源码编译

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段