Skip to content

8.3.0 build fails on centos 8 with mbstring related error #12774

Closed as not planned

Description

@Xerkus

Description

PHP 8.3.0 build fails on centos 8 with the error:

/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `mb_utf16be_to_wchar' with pointer equality in `ext/mbstring/libmbfl/filters/mbfilter_utf16.o' can not be used when making an executable; recompile with -fPIE and relink with -pie
collect2: error: ld returned 1 exit status

Original failure discovered during 8.3.0 build at
php-build/php-build#759

Recreated locally in centos:8 docker image running configure and make directly. Full build log output available here https://gist.github.com/Xerkus/185b0a566abe8acee620b9a0ae84468d

Used configure as follows, no env variables used:

./configure --with-config-file-path=/tmp/php-build-test-20231124174343/8.3.0/etc \
  --with-config-file-scan-dir=/tmp/php-build-test-20231124174343/8.3.0/etc/conf.d \
  --prefix=/tmp/php-build-test-20231124174343/8.3.0 \
  --libexecdir=/tmp/php-build-test-20231124174343/8.3.0/libexec \
  --datadir=/tmp/php-build-test-20231124174343/8.3.0/share/php \
  --mandir=/tmp/php-build-test-20231124174343/8.3.0/share/man \
  --enable-sockets \
  --enable-exif \
  --with-zlib \
  --with-zlib-dir=/usr \
  --with-bz2 \
  --enable-intl \
  --with-openssl \
  --enable-soap \
  --enable-xmlreader \
  --with-xsl --enable-ftp \
  --enable-cgi \
  --with-curl=/usr \
  --with-tidy \
  --enable-sysvsem \
  --enable-sysvshm \
  --enable-shmop \
  --with-mysqli=mysqlnd \
  --with-pdo-mysql=mysqlnd \
  --with-pdo-sqlite \
  --enable-pcntl \
  --with-readline \
  --enable-mbstring \
  --disable-debug \
  --enable-fpm \
  --enable-bcmath \
  --enable-phpdbg \
  --enable-gd \
  --with-jpeg \
  --with-zip \
  --with-mhash \
  --with-libdir=lib64  

This issue looks similar to me #11603

PHP Version

8.3.0

Operating System

Centos 8

Activity

  1. ndossche commented on Nov 24, 2023

    @ndossche
    Member

    This is actually this issue: https://sourceware.org/bugzilla/show_bug.cgi?id=23169
    That was fixed in binutils 2.31, but CentOS8 uses version 2.30 which is old (almost 6 years: Jan 2018).
    I don't know how to work around this, it's not like we can check via a macro the binutils version but we could in principle test during configure if this is broken (although I prefer not to)...
    In any case I really recommend you to use a modern toolchain.

  2. Girgias commented on Nov 27, 2023

    @Girgias
    Member

    I am going to close this as this is not a bug in PHP.

  3. wheakerd commented on Jan 8, 2024

    @wheakerd

    Remove binutils from Centos 8 stream and remove them from https://ftp.gnu.org/gnu/binutils/ Compile and install the latest source code from Zhongla. This will solve this problem.

  4. remicollet commented on Jan 9, 2024

    @remicollet
    Member

    Notice: I'm used to build all PHP versions (up to 8.3) on EL-7, EL-8 and EL-9, and never encounter this issue.

    If you need recent versions, simply use https://rpms.remirepo.net/wizard/

  5. nstiac commented on Feb 3, 2024

    @nstiac

    So all users of Centos8 / Almalinux 8 / Rockylinux 8 should just resign to not using PHP 8.3 and newer because of a compiler bug that you are very well capable of bypassing so far much easier than an entire family of users removing an integral part of the original OS with a plethora of unexpected consequences ?

  6. ndossche commented on Feb 3, 2024

    @ndossche
    Member

    Why should I spend my free time in the weekend providing a workaround for an oerating system that the company is dropping support for, and shipping the operating system with a known compiler bug? Makes no sense to me.

    In any case, feel free to provide a PR.

  7. Xerkus commented on Feb 4, 2024

    @Xerkus
    Author

    So all users of Centos8 / Almalinux 8 / Rockylinux 8 should just resign to not using PHP 8.3 and newer because of a compiler bug that you are very well capable of bypassing so far much easier than an entire family of users removing an integral part of the original OS with a plethora of unexpected consequences ?

    Or, hear me out, they discover here default binutils is too old in their EOL os, so they install and enable newer devtoolset with recent binutils and happily build php 8.3 using that.

  8. jirikmik commented on Feb 23, 2024

    @jirikmik

    In Almalinux 8 it is possible to add newer gcc for example by
    dnf install gcc-toolset-13
    and build PHP 8.3 with mbstring against it.

  9. stevenhfotofix commented on Mar 28, 2024

    @stevenhfotofix

    In Almalinux 8 it is possible to add newer gcc for example by dnf install gcc-toolset-13 and build PHP 8.3 with mbstring against it.

    Thank you jirikmik, you saved me a lot of headaches.

    To follow up with that, so you don't have to look it up - after installing the toolset you can use this command to run make:

    scl enable gcc-toolset-13 make

  10. nstiac commented on Mar 28, 2024

    @nstiac
  11. stevenhfotofix commented on Mar 28, 2024

    @stevenhfotofix

    Using the toolset doesn't replace the GCC already installed, it sets up its own environment. While I am still testing things, the compile went through without problems (PHP 8.3.4 on AlmaLinux 8.9) and I am not getting any issues so far after compiling without specifying the GCC directly from the compiled php binary.

    For others doing research on getting past this issue and wishing to do some research, here are a few links:

    More details about Software Collections

    https://access.redhat.com/documentation/en-us/red_hat_software_collections/3/html/packaging_guide/sect-enabling_the_software_collection

    The toolset jirikmik referred to:

    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/developing_c_and_cpp_applications_in_rhel_8/additional-toolsets-for-development_developing-applications

  12. gdegoulet commented on Jun 6, 2024

    @gdegoulet

    Workaround if you don't want to install gcc-toolset-* : configure with --enable-mbstring=shared
    this issue occured only if mbstring is not compiled as a shared extension (you also need to add extension=mbstring.so to your php.ini)
    @remicollet : that's why you never encounter this issue since you provide a shared extension

  13. nstiac commented on Aug 17, 2024

    @nstiac

    Workaround if you don't want to install gcc-toolset-* : configure with --enable-mbstring=shared this issue occured only if mbstring is not compiled as a shared extension (you also need to add extension=mbstring.so to your php.ini) @remicollet : that's why you never encounter this issue since you provide a shared extension

    Thank you @gdegoulet .. this was by far the best and easiest option to make it work.

  14. InputOutputZ commented on Jan 13, 2025

    @InputOutputZ

    I tried compiling php 8.4.2, and had this error using gcc 12, gcc 8 and probably the same with gcc 4 if not more errors:-
    dynamic STT_GNU_IFUNC symbol mb_utf16be_to_wchar' with pointer equality in ext/mbstring/libmbfl/filters/mbfilter_utf16.o'

    Using --enable-mbstring=shared fixed this, many thanks for @gdegoulet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions