今天開始正式幹活了服務器
拿到一個全志Tina的板子還有一個SDK壓縮包,要求我這周(只剩一天半。。。)就要把sdk編譯經過而且把板子跑起來。ssh
還特別跟我說他們試了下這個sdk編譯無法經過,會報錯。。。ide
居然是有坑!ui
————————————————————————————————————————————————————————————————this
準備工做:spa
拷貝解壓SDKcode
閱讀Guide手冊(如何配置環境,如何編譯,如何燒錄)orm
讀完了接下來正式開工xml
第一步,配置編譯環境。blog
可是老子是ssh遠程編譯服務器編譯,沒有全向apt-install,問老大,老大說應該配好了,叫我先編譯一下試試看。
應該?好吧,先略過。
第二步,編譯
還好編譯的時候回自動檢測編譯環境是否配置ok。
按照手冊開始一步一步編譯,問了下公司的服務器只有4核,爲了避免影響其餘人使用,在這裏只能make -j4編譯。
以後就是等待結果。。同時能夠去找找燒錄套件準備硬件鏈接。
$ tar -xvf Homlet-Tina-H2_H3 $ cd Homlet-Tina-H2_H3 $ source build/envsetup.sh $ lunch dolphin_p1-tina $ make –j4
編譯了大概13分鐘以後就Error報錯了!
中止編譯了!
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)) ####
看報錯是在編譯 libmgncs-1.2.0源碼包的mxmlds.c的時候跟蹤到encoding.h可是找不到被包含的頭文件unicode/ucnv.h
打開mxmlds.c看一下,含有如下幾個頭文件其中tree.h和parser.h都包含了encoding.h
#include <libxml/tree.h> #include <libxml/xpath.h> #include <libxml/parser.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開關控制unicode/ucnv.h的包含,控制ICU的功能是否須要enable。
如今報錯找不到unicode/ucnv.h說明這個宏被人定義了,可是在sdk目錄下搜索LIBXML_ICU_ENABLED 關鍵字的文件只有兩個,其中xmlversion.h明確屏蔽了這個宏
./package/allwinner/liballwinner_tina/liballwinner/LIBRARY/EXTERNAL/include/libxml/encoding.h
./package/allwinner/liballwinner_tina/liballwinner/LIBRARY/EXTERNAL/include/libxml/xmlversion.h
/** * LIBXML_ICU_ENABLED: * * Whether icu support is available */ #if 0 #define LIBXML_ICU_ENABLED #endif
上面兩個文件和指定目錄的文件是同一個類型,只是不一樣版本,查看指定路徑頭文件/usr/include/libxml2/libxml/xmlversion.h,發現裏面打開了這個宏。
/** 281 * LIBXML_ICU_ENABLED: 282 * 283 * Whether icu support is available 284 */ 285 #if 1 286 #define LIBXML_ICU_ENABLED 287 #endif
本來能夠在指定的頭文件裏屏蔽掉這個宏從新編譯就能夠了。
可是這個是編譯服務器的系統頭文件
首先沒有權限修改。
其次爲了編譯某個項目屏蔽公用的頭文件功能對別人使用會有影響。
最重要的是這個sdk編譯完了要打包燒錄到arm板子上,最好不要依賴牽涉宿主機上的東西,全部依賴自帶並打包才更符合邏輯。
--------------------------------------------------------------------------------------------------------------------------------------------------
問題緣由找到了,解決辦法就是修改頭文件指定目錄。
如今須要找到頭文件路徑設置的地方進而修改。
整個sdk編譯走的都是Makefile結構,頭文件路徑有些是從父級環境變量繼承下來的,有些是子目錄源碼本身添加的。
查看出問題的源碼Makefile發現了CPPFLAGS裏面就是包含了剛纔那個系統頭文件目錄
/usr/include/libxml2/libxml
可是改這個Makefile是沒有任何意義的,由於Makefile文件是configure以後自動產生的,因此這個應該問題和configure有關
看下源碼libmgncs-1.2.0目錄下的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"
從新configure 編譯就經過了。
接下來就是準備燒錄驗證硬件了。。。