[英]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-multilib
和g++-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.