Compiling python 3.12 with bzip2

Xisco Fauli xiscofauli at libreoffice.org
Mon Dec 30 15:45:11 UTC 2024


Hello,

In https://gerrit.libreoffice.org/c/core/+/178681 I'm trying to upgrade 
internal python to 3.11. Unfortunately it fails to link _bz2 extension 
(added in https://gerrit.libreoffice.org/c/core/+/157101) with bzip2 and 
when I try to import bz2 it fails with:

 >>> import bz2
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File 
"/home/xisco/libreoffice/instdir/program/python-core-3.11.11/lib/bz2.py", 
line 17, in <module>
     from _bz2 import BZ2Compressor, BZ2Decompressor
ImportError: 
/home/xisco/libreoffice/instdir/program/python-core-3.11.11/lib/lib-dynload/_bz2.cpython-3.11.so: 
undefined symbol: BZ2_bzDecompressInit

Surprisingly, it doesn't happen with python 3.10 and if I 
replace instdir/program/python-core-3.11.11/lib/lib-dynload/_bz2.cpython-3.11.so 
with 
instdir/program/python-core-3.10.16/lib/lib-dynload/_bz2.cpython-3.10.so 
it works. The _bz2 extension is compiled with

/usr/bin/ccache gcc 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/bzip2 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/expat/lib -fPIC 
-DNDEBUG -g -O3 -Wall -O0 -Wp,-U_FORTIFY_SOURCE -fstrict-aliasing 
-fstrict-overflow -std=c11 -Werror=implicit-function-declaration 
-I./Include/internal -I./Include -I. -I/usr/include/x86_64-linux-gnu 
-I/usr/local/include 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/python3/Include 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/python3 -c 
/home/xisco/libreoffice/workdir/UnpackedTarball/python3/Modules/_bz2module.c 
-o 
build/temp.linux-x86_64-3.11/home/xisco/libreoffice/workdir/UnpackedTarball/python3/Modules/_bz2module.o

and

/usr/bin/ccache gcc 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/bzip2 
-I/home/xisco/libreoffice/workdir/UnpackedTarball/expat/lib -shared 
-L/home/xisco/libreoffice/workdir/UnpackedTarball/libffi/x86_64-pc-linux-gnu/.libs 
-L/home/xisco/libreoffice/workdir/UnpackedTarball/bzip2 
-L/home/xisco/libreoffice/workdir/LinkTarget/StaticLibrary 
build/temp.linux-x86_64-3.11/home/xisco/libreoffice/workdir/UnpackedTarball/python3/Modules/_bz2module.o 
-L. 
-L/home/xisco/libreoffice/workdir/UnpackedTarball/libffi/x86_64-pc-linux-gnu/.libs 
-L/home/xisco/libreoffice/workdir/UnpackedTarball/bzip2 
-L/home/xisco/libreoffice/workdir/LinkTarget/StaticLibrary 
-L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -o 
build/lib.linux-x86_64-3.11/_bz2.cpython-3.11.so


Any idea how to fix it ?

-- 
Xisco Faulí
LibreOffice QA Team
IRC: x1sc0



More information about the LibreOffice mailing list