简体   繁体   English

在64位debian上编译PHP扩展到32位PHP安装

[英]Compile PHP extension on 64bit debian to 32bit PHP installation

I am trying to compile a PHP extension for a 32 bit PHP installation on a 64 bit system.我正在尝试为 64 位系统上的 32 位 PHP 安装编译 PHP 扩展。 However, I get the following warning when restart apache:但是,重启 apache 时,我收到以下警告:

Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/spotify.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/spotify.so: wrong ELF class: ELFCLASS64 in Unknown on line 0

I compile everything using this command:我使用此命令编译所有内容:

/opt/lampp/bin/phpize; CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure --enable-spotify --with-php-config=/opt/lampp/bin/php-config; make && make install

The flags should make sure it compiles to 32bit.标志应确保它编译为 32 位。 I have gcc-multilib and g++-multilib installed我安装了gcc-multilibg++-multilib

When it is done compiling (this this log: http://pastebin.com/MqgGgyzv ) i do the following command:完成编译后(此日志: http://pastebin.com/MqgGgyzv )我执行以下命令:

file /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/spotify.so

and it returns它返回

/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/spotify.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

So it is clearly not compiling it correctly, but I don't see what I'm doing wrong.所以它显然没有正确编译它,但我不明白我做错了什么。

You're compiling OK, but the linker is inadvertantly creating a 64-bit.so.您正在编译OK,但linker无意中创建了 64 位 .so。

The solution is to include "-m32" in your LDFLAGS, too:解决方案是在您的 LDFLAGS 中也包含“-m32”:

https://askubuntu.com/questions/85978/building-a-32-bit-app-in-64-bit-ubuntu https://askubuntu.com/questions/85978/building-a-32-bit-app-in-64-bit-ubuntu

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 PHP 的 64 位安装上使用 32 位 integer? - How to use a 32bit integer on a 64bit installation of PHP? 如何将float转换为64bit二进制或将32bit float转换为64bit int-PHP - how convert float to 64bit binary or 32bit float to 64bit int - php 在WAMP 64位上将64位PHP转换为32位 - Convert 64bit PHP to 32bit on WAMP 64bit 在同一服务器上使用带有64位oracle客户端的php 7.3.4 64bit和带有32位oracle客户端的php 7.3.4 32bit - Using php 7.3.4 64bit with a 64bit oracle client and php 7.3.4 32bit with a 32bit oracle client on the same server PHP-在32位php安装上需要64位输出 - PHP - Need the 64bit output on a 32bit php install 使用PHP计算32位系统上的按位64位运算 - Calculate bitwise 64bit operations on 32bit system with PHP 32位和64位ODBC驱动程序与PHP配合使用 - 32bit and 64bit ODBC Drivers playing nice with PHP 是否可以将Nginx 32位与php 64位一起使用? - Is it possible to use use Nginx 32bit with php 64bit? 如何在PHP中将两个无符号的32位整数合并为64位整数? - how to combine two unsigned 32bit integers to 64bit integer in php? SSH2 dll未加载-Windows Server 2008 64位,PHP 5.3.5 32位,Apache 32位 - SSH2 dll not being loaded - windows server 2008 64bit, php 5.3.5 32bit, apache 32 bit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM