简体   繁体   中英

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. However, I get the following warning when restart 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. I have gcc-multilib and g++-multilib installed

When it is done compiling (this this log: http://pastebin.com/MqgGgyzv ) i do the following command:

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.

The solution is to include "-m32" in your LDFLAGS, too:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM