当前位置: 代码迷 >> 综合 >> libxml 编译报错:“Py_NotImplementedStruct can not be used when making a shared object”
  详细解决方案

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

热度:87   发布时间:2024-02-05 22:25:50.0

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-optimizationsmakemake install

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

  相关解决方案