在 CentOS 5.X 上安装 libxml2 2.7.X

在 CentOS 5.X 上安装 libxml2 2.7.X

CentOS 附带 libxml2-2.6.26。我必须至少安装 2.7.X 版本。

我从 XMLSOFT 下载了 libxml2、libxml2-devel 和 libxml2-python (2.7.8) 的 RPM(http://xmlsoft.org/sources/)。

我尝试通过以下方式安装:

# yum localinstall libxml2-2.7.8-1.x86_64.rpm libxml2-devel-2.7.8-1.x86_64.rpm libxml2-python-2.7.8-1.x86_64.rpm

我得到:

Examining libxml2-devel-2.7.8-1.x86_64.rpm: libxml2-devel-2.7.8-1.x86_64
Marking libxml2-devel-2.7.8-1.x86_64.rpm as an update to libxml2-devel-2.6.26-2.1.2.8.el5_5.1.x86_64
Examining libxml2-python-2.7.8-1.x86_64.rpm: libxml2-python-2.7.8-1.x86_64
Marking libxml2-python-2.7.8-1.x86_64.rpm as an update to libxml2-python-2.6.26-2.1.2.8.el5_5.1.x86_64
Resolving Dependencies
--> Running transaction check
---> Package libxml2.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: libxml2
---> Package libxml2-devel.x86_64 0:2.7.8-1 set to be updated
---> Package libxml2-python.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: python(abi) = 2.6 for package: libxml2-python
--> Processing Dependency: libpython2.6.so.1.0()(64bit) for package: libxml2-python
--> Running transaction check
---> Package libxml2.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: libxml2
---> Package python26.x86_64 0:2.6.5-6.el5 set to be updated
---> Package python26-libs.x86_64 0:2.6.5-6.el5 set to be updated
--> Finished Dependency Resolution
libxml2-2.7.8-1.x86_64 from /libxml2-2.7.8-1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package libxml2-2.7.8-1.x86_64 (/libxml2-2.7.8-1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package libxml2-2.7.8-1.x86_64 (/libxml2-2.7.8-1.x86_64)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                    package-cleanup --dupes
                    rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

更新 glibc 是否安全?或者从源代码安装 libxml2?

答案1

确保你已经安装了开发工具:

yum groupinstall "Development Tools"

获取 src rpm:

wget http://xmlsoft.org/sources/libxml2-2.7.8-1.src.rpm

由于 rpm 版本差异,您将无法直接调用 rpmbuild,因此让我们简化一下:

rpm -ivh libxml2-2.7.8-1.src.rpm --nomd5

然后:

rpmbuild -ba /usr/src/redhat/SPECS/libxml2.spec

此时您可能会被提示输入一些依赖项(如果是这样,则仅输入yum install有问题的依赖项,然后重新运行rpmbuild -ba上面的命令)。

假设您的构建成功完成(我刚刚在 CentOS 5 机器上进行了测试,并且构建良好),生成的 RPM 将位于:

/usr/src/redhat/RPMS/arch

其中“arch”是 x86_64 或 i386,具体取决于您的系统。您可以yum localinstall --nogpgcheck从那里获取软件包。

答案2

获取 SRPM 并使用 mock 重建它。

相关内容