2011/2/20 Daniel Brown <danbr...@php.net>:
> On Sun, Feb 20, 2011 at 10:42, Martin Herrman <mar...@herrman.nl> wrote:
>>
>> I already had --disabled-all. I have now tested with -Os instead of
>> -O2 which results in a 2.8MB executable. So that helps a bit :-)
>
>    Try running `strip` on there to take out the excess symbols.

This is my cross-compile script for -O2:

#!/bin/sh

# Set variables
export CFLAGS="-EL -O2"
export CXXFLAGS="-EL -O2"
export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc"
export CXX="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-g++"
export PATH=/opt/Sourcery_G++_Lite/bin:$PATH
export AR="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ar"
export LDFLAGS=" -s -Xlinker -rpath /lib -Xlinker -rpath-link
/opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.3/el"
export STRIP="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-strip"
export RANLIB="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ranlib"
export AS="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-as"
export LD="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ld"

# Cleanup previous compilations
rm -rf /home/martin/result/php-5.3.5
rm -rf /home/martin/work/php*

# Download source and configure, compile, install
cd /home/martin/work
wget http://nl.php.net/get/php-5.3.5.tar.gz/from/this/mirror -O php-5.3.5.tar.gz
tar -zxvf php-5.3.5.tar.gz
cd php-5.3.5
#./configure --help
./configure --prefix=/home/martin/result/php-5.3.5
--host=i686-pc-linux-gnu --target=mipsel-linux-gnu
--build=mipsel-linux-gnu --enable-cgi --disable-all --without-pear
make
make install

This is the result:
martin@martindesktop ~/ $ ls -ltr result/php-5.3.5/bin/php-cgi
-rwxr-xr-x 1 martin users 3142772 Feb 20 16:58 result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $ file result/php-5.3.5/bin/php-cgi
result/php-5.3.5/bin/php-cgi: ELF 32-bit LSB executable, MIPS, MIPS32
rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux
2.6.12, with unknown capability 0xf41 = 0x756e6700, with unknown
capability 0x70100 = 0x1040000, stripped
martin@martindesktop ~/ $
/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-strip
result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $ file result/php-5.3.5/bin/php-cgi
result/php-5.3.5/bin/php-cgi: ELF 32-bit LSB executable, MIPS, MIPS32
rel2 version 1 (SYSV), dynamically linked (uses shared libs), for
GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, with
unknown capability 0x70100 = 0x1040000, stripped
martin@martindesktop ~/ $ ls -ltr result/php-5.3.5/bin/php-cgi
-rwxr-xr-x 1 martin users 3142772 Feb 20 17:07 result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $

Now for -Os:

martin@martindesktop ~/ $ ls -ltr result/php-5.3.5/bin/php-cgi
-rwxr-xr-x 1 martin users 2813508 Feb 20 17:10 result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $ file result/php-5.3.5/bin/php-cgi
result/php-5.3.5/bin/php-cgi: ELF 32-bit LSB executable, MIPS, MIPS32
rel2 version 1, dynamically linked (uses shared libs), for GNU/Linux
2.6.12, with unknown capability 0xf41 = 0x756e6700, with unknown
capability 0x70100 = 0x1040000, stripped
martin@martindesktop ~/ $
/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-strip
result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $ ls -ltr result/php-5.3.5/bin/php-cgi
-rwxr-xr-x 1 martin users 2813508 Feb 20 17:16 result/php-5.3.5/bin/php-cgi
martin@martindesktop ~/ $ file result/php-5.3.5/bin/php-cgi
result/php-5.3.5/bin/php-cgi: ELF 32-bit LSB executable, MIPS, MIPS32
rel2 version 1 (SYSV), dynamically linked (uses shared libs), for
GNU/Linux 2.6.12, with unknown capability 0xf41 = 0x756e6700, with
unknown capability 0x70100 = 0x1040000, stripped
martin@martindesktop ~/ $

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to