GDC Note: Because the need to solve the linux64 machine compiled 32 bits of MongoDB (no way, because the compiled PHP is 32 bits, and then I want to add mongdb extension to php), searched the Internet a lot of articles, feel this article understood, and useful. I'm using method one, specifically:
> linux32./configure--with-php-config=/usr/local/php/bin/php-config
> Export cflags= "-m32-04-march=i386-mtune=i386"
> Make
After make succeeds, use the file command to look at the generated mongo.so in the modules directory. The output is "ELF 32-bit LSB Shared Object". Haha, success!
Method One:
First you need to install32-Bit compatibility libraries
Apt-get Install ia32-libs libc6-dev-i386 linux32
1.Uselinux32Command inConfigureWhen you change it.Chost, set up the compilation environment
$ linux32./configure
#i686-pc-linux-gnu
#x86_64-unknown-linux-gnu
2. set gcc
Export cflags= "-m32 -march=i386-mtune=i386"
Export cflags= "-m32-04-march=i386-mtune=i386"
# most critical is -m32
-m32,-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to + bits and generates code that runs on any i386 system. The 64-bit environment sets int to + bits and long and pointer to $ bits and generates code for AMD ' s x86-64 architectur E.
Method Two:
Modify/USR/BIN/GCC LD, force join M32 Information
Rename Gcc,ld to gcc.64,ld.64
/usr/bin/gcc
#!/bin/sh
gcc.64–m32 [email protected]
/usr/bin/ld
#!/bin/sh
Ld.64–m elf_i386 [email protected]
< excerpt > How to force 32-bit applications to be compiled on 64-bit Linux