解决一次CentOS 9 Stream 上编译php8.3的错误

2023年12月26日 1182点热度 0人点赞 4条评论

编译 make 最后一步出现如下错误:

/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 /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

解决方法:

编辑源代码目录下的 Makefile 文件

nano Makefile

找到以下两行:

CC = cc
BUILD_CC = cc

改成:

CC = cc -fPIE -pie
BUILD_CC = cc -fPIE -pie

重新 make 下就行了。

路灯

这个人很懒,什么都没留下

文章评论

  • Daniel

    https://bit.ly/3SWya9q Huge selection!

    2024年02月22日
  • 匿名

    重新make报了新的错误
    ...
    /usr/bin/ld: sapi/cli/ps_title.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
    /usr/bin/ld: sapi/cli/php_cli_process_title.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
    /usr/bin/ld: final link failed: Nonrepresentable section on output
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:299: sapi/cli/php] Error 1

    2024年02月21日
    • 匿名

      @匿名 me too

      2024年04月09日
  • 匿名

    我因为遇到这个错误,找到了这篇文章 :biggrin:

    2024年01月27日