I am compiling PHP from source and am running into issues when compiling with --with-bz2
. See below.
/usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against symbol `BZ2_crc32Table' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(compress.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(decompress.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(blocksort.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(blocksort.o): warning: relocation against `stderr@@GLIBC_2.2.5' in read-only section `.text'
The command I am running is:
./configure --prefix=/usr/local/php82 --enable-cli --enable-fpm --program-suffix=82 --with-xsl --with-apxs2=/usr/local/apache/bin/apxs --with-zlib --enable-bcmath --with-bz2 --enable-calendar --enable-ftp --with-gettext --enable-gd --enable-intl --enable-mbstring --with-mysqli --with-unapdo-mysql --with-xsl --enable-soap --enable-sockets --with-zip; make clean; make; make install;
Here is some info on the system:
[root@localhost ~]# uname -a
Linux localhost.localdomain 5.14.0-427.13.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 30 18:22:29 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release
AlmaLinux release 9.4 (Seafoam Ocelot)
I started with just bzip
and bzip-devel
from dnf
however as seen above I tried a custom installation of bzip2
with no joy.
I have tried with package manager dnf
and built from source but bzip2
error keeps on coming.
libbz2.a
is a static library, but your PHP configure script seems to configure bz2 extension as a shared library by default, so this error occurred. If you can find libbz2.so
in your system, use --with-bz2=PATH
to specify the folder. Or use --enable-shared=no
to disable shared library compilation.