【问题标题】:SOLVED: Compiling PHP with GD : relocation R_X86_64_PC32 against symbol `WebPMemoryWrite' can not be used when making a shared object;已解决:使用 GD 编译 PHP:创建共享对象时,不能使用针对符号 `WebPMemoryWrite' 的重定位 R_X86_64_PC32;
【发布时间】:2019-10-02 14:57:49
【问题描述】:

我目前正在从 RedHat7 服务器上的源代码中安装带有 GD 库的 PHP,我遇到了一些问题。

我用这个命令配置 PHP:

./configure --with-apxs2=/server/lib/httpd/bin/apxs --with-pdo-mysql --with-config-file-path=/server/php-7.3.9/conf --with-libxml-dir=/server/lib/libxml2 --with-curl=/server/lib/curl --with-gd --enable-mbstring --with-jpeg-dir=/server/lib/libjpeg --with-png-dir=/server/lib/libpng –with-webp-dir=/server/lib/webp

它可以工作,但是当我执行 make 命令时出现此错误:

/bin/ld: /server/lib/webp/lib/libwebp.a(picture_enc.o): relocation R_X86_64_PC32 against symbol `WebPMemoryWrite' can not be used when making a shared object; recompile with -fPIC
/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [libphp7.la] Error 1

我也尝试在没有 webp 的情况下编译和安装它(PHP 文档中不需要它:php doc)但我有这个错误:

ext/gd/libgd/.libs/gd_webp.o: In function `gdImageCreateFromWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:68: undefined reference to `WebPGetInfo'
/sever/php-7.3.9/ext/gd/libgd/gd_webp.c:79: undefined reference to `WebPDecodeARGB'
ext/gd/libgd/.libs/gd_webp.o: In function `gdImageWebpCtx':
/server/php-7.3.9/ext/gd/libgd/gd_webp.c:153: undefined reference to `WebPEncodeRGBA'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

所以它似乎是必需的。 你能帮我解决这个问题吗 谢谢

【问题讨论】:

    标签: php linux compilation gd


    【解决方案1】:

    我通过替换安装的 webp 包解决了我的问题。 一开始我使用的是预编译的linux包,并用原生源替换它,编译,make & make install解决了这个问题。

    谢谢大家

    【讨论】:

      猜你喜欢
      • 2021-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-17
      • 2020-01-17
      • 2017-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多