libxml 编译报错:“Py_NotImplementedStruct can not be used when making a shared object”

CentoOS 7 下:

python 3.6

libxml 编译时,提示python编译报错:

/usr/bin/ld: /usr/local/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct’ can not be used when making a shared object; recompile with -fPIC
/usr/local/python3/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

说明python需要重新编译,添加-fPIC选项。

python编译配置命令为:

./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC --enable-optimizations

make

make install

重新编译安装python后, 再来编译 libxml 就不会报错了。

回答: 当你在Ubuntu系统中运行某些软件时,可能会遇到"libxml2.so.2: cannot open shared object file: No such file or directory"的错误。这个错误是由于缺少libxml2.so.2库文件导致的。要解决这个问题,你可以按照以下步骤操作: 1. 确认你的系统中是否已经安装了libxml2库。可以通过运行以下命令进行检查: ``` dpkg -l | grep libxml2 ``` 如果没有结果,说明还没有安装该库。 2. 如果没有安装libxml2库,你可以通过运行以下命令来安装: ``` sudo apt-get install libxml2 ``` 3. 安装完成后,重新运行你的软件,看是否还会出现错误。 如果以上方法都没有解决问题,你可以尝试在网上搜索更详细的解决方案,例如引用中提供的链接。123 #### 引用[.reference_title] - *1* [error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such fil](https://blog.csdn.net/u012022920/article/details/20362083)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *2* *3* [error while loading shared libraries: libxml2.so.2: cannot open shared object file 解决方法](https://blog.csdn.net/qq_39779233/article/details/128215517)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值