- 简介
- 下载
- 配置
- 安装
- 整合
- 查看
- 资料
- 是在MIT许可下提供的免费软件;
- 为Gnome项目开发的XML C解析器和工具包;(但可在Gnome平台之外使用)
- 尽管该库是用C编写的,但各种语言绑定使其在其他环境中可用;
- 是一种用于设计标记语言的元语言,即是用尖括号之间的额外标记信息将语义和结构添加到内容中的文本语言。
LibXml2最新的源码包可以从官方发布的页面下载
配置- 创建安装目录并安装依赖包
localhost@linux:~$ mkdir ${HOME}/xml2arm
localhost@linux:~$ sudo apt install autoconf libtool automake python-dev
- 查看README.md,
## Dependencies Libxml does not require any other libraries. A platform with somewhat recent POSIX support should be sufficient (please report any violation to this rule you may find). However, if found at configuration time, libxml will detect and use the following libraries: - [libz](https://zlib.net/), a highly portable and widely available compression library. - [liblzma](https://tukaani.org/xz/), another compression library. - [libiconv](https://www.gnu.org/software/libiconv/), a character encoding conversion library. The iconv function is part of POSIX.1-2001, so libiconv isn't required on modern UNIX-like systems like Linux, BSD or macOS. - [ICU](https://icu.unicode.org/), a Unicode library. Mainly useful as an alternative to iconv on Windows. Unnecessary on most other systems.
得知:
- Libxml是不需要任何其他库,但是会在配置时检测并使用以下库:
- (___ Library : Zlib):压缩库;
- (___ Utils : Xz):压缩库;
- (___ Library : Libiconv):字符编码转换库;
- (___ Library : Icu):国际组件库。
以上库是可以设置编译选项不使用的,通过--with-PACKAGE参数开启使用PACKAGE库,通过--without-PACKAGE设置不使用PACKAGE库。
- 生成configure
localhost@linux:~$ tar zxvf tar zxvf libxml2-v2.9.13.tar.gz localhost@linux:~$ cd libxml2-v2.9.13 localhost@linux:~/libxml2-v2.9.13$ ./autogen.sh
- 设置编译选项
localhost@linux:~/libxml2-v2.9.13$ ./configure --prefix=${HOME}/xml2arm --host=arm-none-linux-gnueabi --with-zlib=${HOME}/zlib2arm --with-lzma=${HOME}/xz2arm --with-iconv=${HOME}/iconv2arm --with-icu=${HOME}/icu2arm --without-python
安装
localhost@linux:~/libxml2-v2.9.13$ make localhost@linux:~/libxml2-v2.9.13$ make install整合
localhost@linux:~/libxml2-v2.9.13$ cp ~/zlib/* ~/xz2arm/* ~/iconv2arm/* ~/icu2arm/* ~/xml2arm -r查看
localhost@linux:~/xml2arm$ ls -la total 24 drwxrwxr-x 6 localhost localhost 4096 Apr 26 21:53 . drwxr-xr-x 43 localhost localhost 4096 Apr 26 21:53 .. drwxrwxr-x 2 localhost localhost 4096 Apr 26 21:53 bin drwxrwxr-x 3 localhost localhost 4096 Apr 26 23:53 include drwxrwxr-x 4 localhost localhost 4096 Apr 26 23:53 lib drwxrwxr-x 6 localhost localhost 4096 Apr 26 23:53 share localhost@linux:~/xml2arm$ tree . . . 113 directories, 687 files localhost@linux:~/xml2arm$ cd lib localhost@linux:~/xml2arm/lib$ file libxml2.so.2.9.13 lib/libxml2.so.2.9.13: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, not stripped
确认无误后,即可将对应的库文件和可执行程序上传到开发板的lib目录和bin目录中使用,当然也可以配合其他库文件进行相关的移植。
资料GNOME for LibXml2


![[ 移植 ] [ 移植 ]](http://www.mshxw.com/aiimages/31/841415.png)
