已解决:使用GD编译PHP:在创建共享库时无法使用针对符号'WebPMemoryWrite'的R_X86_64_PC32重定位;

问题描述 投票:0回答:1

我目前正在从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个回答
0
投票

我通过替换安装的webp软件包解决了问题。首先,我使用了预编译的linux程序包,并用本机源代码替换了它,并通过编译,make&make install解决了该问题。

谢谢所有

© www.soinside.com 2019 - 2024. All rights reserved.