背景:
黑鴨子掃描發現某基線裡的libxml.so檔案有問題,需要從libxml2.7.4更新到libxml2.9.9。
搜尋途徑:
搜點到libxml2.9.9的壓縮包(官網):
ftp://xmlsoft.org/libxml2/
http://xmlsoft.org/bugs.html
2019年1月3日釋出,5.2M, libxml2-2.9.9.tar.gz
将libxml2-2.9.9.tar.gz解壓到任目錄(tar -xzvf libxml2-2.9.9.tar.gz)。
64位編譯:
編譯64位libxml2.so.2.9.9執行
./configure --without-python;make
或者
./configure --without-python --without-zlib;make
32位編譯
編譯32位libxml2.so.2.9.9執行
export CFLAGS=-m32; export LDFLAGS=-m32;./configure --without-python --without-zlib;make
編譯指令裡的參數由來:
#####:~/libxml2-2.9.9> configure --help
Optional Packages:
--with-python[=DIR] build Python bindings if found
--with-zlib[=DIR] use libz in DIR
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
編譯生成内容:
編譯成功後,從/libxml2-2.9.9/.libs可以看到目前時刻生成的庫檔案
####:~/libxml2-2.9.9/.libs> ls -l | grep libxml
-rw-r--r-- 1 proto33 users 7818426 09-16 15:25 libxml2.a
lrwxrwxrwx 1 proto33 users 13 09-16 15:25 libxml2.la -> ../libxml2.la
-rw-r--r-- 1 proto33 users 939 09-16 15:25 libxml2.lai
lrwxrwxrwx 1 proto33 users 16 09-16 15:25 libxml2.so -> libxml2.so.2.9.9
lrwxrwxrwx 1 proto33 users 16 09-16 15:25 libxml2.so.2 -> libxml2.so.2.9.9
-rwxr-xr-x 1 proto33 users 4620799 09-16 15:25 libxml2.so.2.9.9