简介
获取
通过官方分发页面获取
构建
- 查看
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.
Xml2
不需要任何其他库,但是,如果在配置时发现,将检测并使用(以下库,有则更好,没有也不耽误使用):- (___ Library : Zlib):压缩库;
- (___ Utils : Xz):压缩库;
- (___ Library : Iconv):字符编码转换库;
- (___ Library : Icu):国际组件库。
可以通过--with-PACKAGE
和--without-PACKAGE
参数进行开启和关闭使用PACKAGE
库。
- 创建安装目录,安装依赖项,并解压源码包进入目录进行配置
localhost@linux:~$ mkdir ${HOME}/xml2arm
localhost@linux:~$ sudo apt install build-essential autoconf automake libtool automake pkg-config python-dev
localhost@linux:~$ tar zxvf tar zxvf libxml2-x.y.z.tar.gz
localhost@linux:~$ cd libxml2-x.y.z
localhost@linux:~/libxml2-x.y.z$ ./autogen.sh
- 设置编译选项;
localhost@linux:~/libxml2-x.y.z$ ./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-x.y.z$ make
localhost@linux:~/libxml2-x.y.z$ make install
- 整合方便后面使用。
localhost@linux:~/libxml2-x.y.z$ 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
.
.
.
119 directories, 721 files
localhost@linux:~/xml2arm$ cd lib
localhost@linux:~/xml2arm/lib$ file libxml2.so.2.9.14
libxml2.so.2.9.14: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped
确认无误后,即可将对应的库文件和可执行程序上传到开发板的lib
目录和bin
目录中使用,当然也可以配合其他库文件进行相关的移植。