PHP 8.3.8 build error "recompile with -fPIE and relink with -pie" on AlmaLinux

Shailesh Humbad <[email protected]> Tue, 11 Jun 2024 16:16:13 -0400
Newsgroups gmane.comp.php.install
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------GJDR0SjlNgGO7SxtxGMb0Vhy
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

I am trying to build a custom configured php-8.3.8 (pulled from Git) on 
AlmaLinux 8.10 (formerly CentOS, RHEL-compatible).

I have built PHP 7.4.x and earlier builds successfully in the past, and 
am trying to make the jump to 8.3.x.

I am stuck on the following error:

/bin/sh /temp/php-src-php-8.3.8/libtool --silent --preserve-dup-deps 
--tag=CC --mode=link cc -export-dynamic -fno-common -Wformat-truncation 
-Wlogical-op -Wduplicated-cond -Wno-clobbered -Wall -Wextra 
-Wno-unused-parameter -Wno-sign-compare -g -O2 -ffp-contract=off 
-fvisibility=hidden -pthread -Wimplicit-fallthrough=1 -DZTS 
-DZEND_SIGNALS -DZEND_MAX_EXECUTION_TIMERS   
-Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -no-pie 
-no-pie  ext/date/php_date.o /...OMMITTED FOR BREVITY.../ 
sapi/cli/ps_title.o sapi/cli/php_cli_process_title.o -ltidy -lresolv 
-lrt -lutil -lrt -lm -ldl -lpthread -lxml2 -lssl -lcrypto -lsqlite3 -lz 
-lcurl -lxml2 -lssl -lcrypto -lz -lpng16 -lz -ljpeg -lfreetype -lonig 
-lsqlite3 -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lzip -lz -lssl -lcrypto 
-lrt -o sapi/cli/php
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `mb_wchar_to_utf16le' 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
make: *** [Makefile:297: sapi/cli/php] Error 1


I see the "-no-pie" option in the command line above, and the error 
occurs even if I set the LDFLAGS=-no-pie environment variable per the 
documentation here:
https://gcc.gnu.org/onlinedocs/gnat_ugn/Position-Independent-Executable-PIE-Enabled-by-Default-on-Linux.html

However, I still can not get past the error.  Can anyone provide any 
suggestions?

Regards,
Shailesh
--------------GJDR0SjlNgGO7SxtxGMb0Vhy
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I am trying to build a custom configured php-8.3.8 (pulled from Git)
    on AlmaLinux 8.10 (formerly CentOS, RHEL-compatible).<br>
    <br>
    I have built PHP 7.4.x and earlier builds successfully in the past,
    and am trying to make the jump to 8.3.x.<br>
    <br>
    I am stuck on the following error:<br>
    <br>
    /bin/sh /temp/php-src-php-8.3.8/libtool --silent --preserve-dup-deps
    --tag=CC --mode=link cc -export-dynamic -fno-common
    -Wformat-truncation -Wlogical-op -Wduplicated-cond -Wno-clobbered
    -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -O2
    -ffp-contract=off -fvisibility=hidden -pthread
    -Wimplicit-fallthrough=1 -DZTS -DZEND_SIGNALS
    -DZEND_MAX_EXECUTION_TIMERS   -Wl,-zcommon-page-size=2097152
    -Wl,-zmax-page-size=2097152 -no-pie -no-pie  ext/date/php_date.o <i>...OMMITTED
      FOR BREVITY...</i> sapi/cli/ps_title.o
    sapi/cli/php_cli_process_title.o -ltidy -lresolv -lrt -lutil -lrt
    -lm -ldl -lpthread -lxml2 -lssl -lcrypto -lsqlite3 -lz -lcurl -lxml2
    -lssl -lcrypto -lz -lpng16 -lz -ljpeg -lfreetype -lonig -lsqlite3
    -lxml2 -lxml2 -lxml2 -lxml2 -lxml2 -lzip -lz -lssl -lcrypto -lrt -o
    sapi/cli/php<br>
    /usr/bin/ld: dynamic STT_GNU_IFUNC symbol `mb_wchar_to_utf16le' 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<br>
    collect2: error: ld returned 1 exit status<br>
    make: *** [Makefile:297: sapi/cli/php] Error 1<br>
    <br>
    <br>
    I see the "-no-pie" option in the command line above, and the error
    occurs even if I set the LDFLAGS=-no-pie environment variable per
    the documentation here:<br>
    <a class="moz-txt-link-freetext"
href="https://gcc.gnu.org/onlinedocs/gnat_ugn/Position-Independent-Executable-PIE-Enabled-by-Default-on-Linux.html"
      moz-do-not-send="true">https://gcc.gnu.org/onlinedocs/gnat_ugn/Position-Independent-Executable-PIE-Enabled-by-Default-on-Linux.html</a><br>
    <br>
    However, I still can not get past the error.  Can anyone provide any
    suggestions?<br>
    <br>
    Regards,<br>
    Shailesh<br>
  </body>
</html>

--------------GJDR0SjlNgGO7SxtxGMb0Vhy--