starting with php cross compile

david
HI at least i can start with this cross compile (the previos topic was
about libxml who its necessary for php)

i started with this code:

export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++" 
./configure --host=arm-linux --target=arm --with-libxml-dir=/opt/libxml
--prefix=/opt/php

but when i put

make

at the end it throws me this mistake:

cc1: warning: include location "/usr/include" is unsafe for
cross-compilation
/home/felipe/Escritorio/php-5.3.1/ext/standard/basic_functions.c: In
function 'zif_getservbyport':
/home/felipe/Escritorio/php-5.3.1/ext/standard/basic_functions.c:5589:
error: invalid 'asm': invalid operand for code 'w'
make: *** [ext/standard/basic_functions.lo] Error 1


any ideas???

david
hi i change some lines:

Code:

export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php \
--disable-short-tags \
--without-mysql --without-pear --disable-all --disable-short-tags \
--enable-libxml \
--with-libxml-dir=/opt/libxml

but now it is throw me this mistake:

/home/felipe/Escritorio/php-5.3.1/main/php_ini.c:349: undefined reference
to `php_load_extension'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

i feel like i am advancing but too slow grrr

david
i got the solution!!! change php-5.3.1 for previus version:

PHP-5.2.10

NOW i can start to test on mini!!!

i have a doubt at the end it throws me this:

Build complete.
Don't forget to run 'make test'.


how can i make this  make test??

david
grr i put make test and it throws me this:



felipe@felipe-desktop:~/Escritorio/php-5.2.10$ make test

Build complete.
Don't forget to run 'make test'.

/home/felipe/Escritorio/php-5.2.10/sapi/cli/php: 1: Syntax error: word
unexpected (expecting ")")
make: [test] Error 2 (no tiene efecto)


did i made a bad compilation? =(

david
hi i configured my web server on my target device but when i test a .php
file appears me this:

503 service unavailable

i have a doubt do i have to put to run the php.exe file on my target
device? i tried to do it but it throws me this mistake:

eroor while loading shared librares_ libxml2.so2

i m tring to copy that file on my usb but i cant i think that the reason is
why this libxml2 is a symbolic link, but then... how can i solve this
problem?



HELPPPPPPP! I M VERY CLOSE TO FINISH, PLEASE !!

david
hi i solve that problem copying that file on /opt/libxml/lib on mini 2440
but now throwme this mistake:

error while loading shared libraries: libz.so.1, at this point i dont
really know if i am get advance 

and i dont know if making this, the program will run

=( help please,

david
hi i modified the code:

export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php1 \
--disable-short-tags --disable-shared \
--without-mysql --without-pear --disable-all --disable-short-tags \
--enable-libxml \
--with-libxml-dir=/opt/libxml \
--with-zlib-dir=/opt/zlib 

and send libz.so.1 to /opt/zlib of my mini2440

but when i put ./php appearsme illegal instrution, i dont what do now, 

PLEASE HELP!!!

david
help!!

Holly
Try 
export CROSS_COMPILE=arm-linux-

david
i didnt fix the problem =(

Holly im working with:

php-5.2.10
zlib-1.1.4
libxml2-2.6.19

if maybe you want to try it.
thanks for the help!

david
remember that you have to compile first zlib and libxml2 following the
steps i did on the php previus forum

david
hi i could put to work php on cherokee webserver on my embedd system it
seems that i have a bad cross compile of php this was my last use code:

export CROSS_COMPILE=arm-linux-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php \
--disable-shared --disable-xml disable-libxml --disable-dom 
--disable-simplexml --disable-short-tags \
--disable-xmlreader --disable-xmlwriter \
--without-mysql --without-pear --without-iconv --disable-all \
--enable-fastcgi

the lines that i had to added to my cherokee.conf file was:


vserver!1!rule!6!disabled = 0
vserver!1!rule!6!encoder!deflate = 0
vserver!1!rule!6!encoder!gzip = 1
vserver!1!rule!6!handler = fcgi
vserver!1!rule!6!handler!balancer = round_robin
vserver!1!rule!6!handler!balancer!source!1 = 1
vserver!1!rule!6!handler!change_user = 0
vserver!1!rule!6!handler!check_file = 1
vserver!1!rule!6!handler!error_handler = 1
vserver!1!rule!6!handler!pass_req_headers = 1
vserver!1!rule!6!handler!xsendfile = 0
vserver!1!rule!6!match = extensions
vserver!1!rule!6!match!extensions = php
vserver!1!rule!6!only_secure = 0
vserver!1!rule!6!match!final = 1
vserver!1!rule!6!timeout = 30

source!1!env!PHP_FCGI_CHILDREN = 5
source!1!env!PHP_FCGI_MAX_REQUESTS = 490
source!1!env_inherited = 0
source!1!host = 127.0.0.1:47990
source!1!interpreter = /home/php/bin/php-cgi -b 127.0.0.1:47990
source!1!nick = PHP Interpreter
source!1!type = interpreter


i hope that this experiences can be useful for some else.

but my final doubt its

i had to disable libxml and libz how can this affect the php's work?? i
have that doubt according to that i should try to fix my cross compile

Holly
Most likely need to recompile libxml and libz with CROSS_COMPILE=arm-linux-

Show your cross compile options for libraries

david
HOlly i think that you most be right, when i compile those libraries it
created me files of type " Link to shared library"  could be this the
problem??

and the only way i could send this files to my device was compressing them

david
Hi again i tested my php on my mini2440 first i made a simple test

echo"hola mundo";

and it goes well

after that i made a formulary and test it on my host machine, there it
worked well, but when i tested on my mini2440 it didnt, soo i think i have
to compile this php again grr, i think that the problem should be the
libraries but .. could be the problem what i said above?

thanks for the help!!

davef
Why are you compressing the files before sending to the mini2440?  Sounds
like that could be an added complication.  I haven't tried using that
method.

What size mini2440 do you have?  Have you got Cherokee on there as well?

david
because when i tried to copy that files to my USB it throws me this
mistake:

felipe@felipe-desktop:/opt$ cp -rf libxml /media/KRYXTYN@
cp: no se puede crear el enlace simbólico
«/media/KRYXTYN@/libxml/lib/libxml2.so.2»: Operación no permitida
cp: no se puede crear el enlace simbólico
«/media/KRYXTYN@/libxml/lib/libxml2.so»: Operación no permitida


translate:

can not create the symbolic link
«/media/KRYXTYN@/libxml/lib/libxml2.so.2»:Operation is not allowed

that happened to me when i was trying to pasted the files of type " Link to
shared library"

But may be this it the problem the way of how i pasted this to my mini2440

davef
Can't help anymore if you don't answer the questions.

Holly
maybe:
       sudo cp -r <source> <destination>

What type of file system you use for rootfs?

david
davef i send that file to my mini2440 for the reason i told you above, and
yes on mini i have cherokee web server and i have 122 mb of store on my
mini. i hope to be clear this time.

and holly you are right i could paste this file using your command, i going
to tested, my file system hmm i have install linux on my mini2440,
following the manual instrution version 128, im not sure if am i clear..

Thanks for the help

david
look if i put ./php without pasting this libraries it throwsme this
mistake:

./php: error while loading shared libraries: libz.so.1 cannot open shared
object file: no such file or directory

so i pasted my libz crosscompile folder and i think that it fix that
mistake, i believe that i have to copy only that file "libz.so.1" no my
full folder zlib because i change the name of other file that it found on
it and it seems not mistake about it.

after this i put again ./php and it throws me:

./php: error ./php: error while loading shared libraries: libxml2.so.2
cannot open shared object file: no such file or directory

so i paste my libxml cross compile folder to my mini and after this i put
./php

now the mistake its illegal instruction....

so what do you think that could be the problem? libxml2.so.2 or libz.so.1

any suggest it going to be helpul thanks for all the advices
im close!!! :)

david
i forgot this was how i compile these libraries:

libxml

export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++" 
./configure --host=arm-linux --target=arm --prefix=/opt/libxml1



zlib

CC=arm-linux-gcc \
./configure --prefix=/opt/zlib

CC=arm-linux-gcc \
LDSHARED="arm-linux-gcc -shared -Wl,-soname,libz.so.1" \
./configure --shared --prefix=/opt/zlib 


maybe you can give me some advice with these i really dont understand very
well the last part of zlib compilation i use this link:

http://www.ailis.de/~k/index.php?url=archives/19-ARM-cross-compiling-how...

thanks!

david
HI again i found this on other forum:


Postby mbirrell » 22 Aug 2006 13:15
Hi Max,
Thanks for the reply.

Tried that and got the same error.

Could it be looking for a particular library version?

Seems that some of my symbolic links? don't have an absolute path eg:

libxml2.so.2 -> libxml2.so instead of: libxml2.so.2 -> /opt/lib/libxml2.so

I would suspect this is bad?

mbirrell
    Newbie
     
Top

Postby max » 23 Aug 2006 19:28
Yes that is most probably a problem with your libraries versions. Also it
can be that you don't have the libs at all.

Have you checked the list of files in your /opt/lib folder? I've posted a
listing in the previous page of this thread. You should be able to check
that you have all the required libs and the correct versions (and sizes).

If you miss a library you can download it from
http://hamster.hd.free.fr/Autre/

And your symlinks seems to be ok: I've got the same conf in my /opt/lib
folder.

***********************************

Top
It Works!

After downloading the lib files and putting them in /opt/lib everything
works.


There the solution was dowload this library what means that i am maybe
doing a bad cross compile of this library but how can i fix this problem?

david
HI again i compile my library libxml again and while it compiled i saw this
message:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

then should i compile php adding some lineas about this, i dont understand
very well, if so its how can be that add line...

david
hi again i had the doubt about simbolic links libraries so compile the
liibraries again with this command lines:


/*********zlib***************/
CC=arm-linux-gcc \
./configure --prefix=/opt/zlib 

/*********libxml**************/
export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++" 
./configure --host=arm-linux --target=arm --prefix=/opt/libxml
--disable-shared

/************php*********/
export CROSS_COMPILE=arm-none-linux-gnueabi-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php \
--disable-short-tags --enable-shared \
--without-mysql --without-pear --disable-all --disable-short-tags \
--enable-libxml \
--with-libxml-dir=/opt/libxml/ \
--with-zlib-dir=/opt/zlib/ 
 

with these little changes the compilation doesnt create me that simbolic
links libraries and the size of this file reduce alittle.

after that i pasted the php compile file to my mini2440 and i tested php
./php but it throws me the same mistake:

IILEGAL INSTRUCTION+

i dont even paste the libraries to my mini. remember that before this it
normally looked for the libraries first and after this it throws me this
mistake..


so im not very sure where could be my mistake could be what i copy above:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'



HELLLP!

davef
What application are you using to uncompress the file on the mini2440?

And why?

david
i was compresing  that files because if i send them normally to my usb
appears me a mistake, but now i can send them bye a command, or with my
last compile that i write above

david
i hope to be clear this time, that mistake i have already fix. thanks to
holly

david
HEEEELP!!

Jay
PHP is already available for armel processors in the debian packages tree
so you don't need to compile it at your own.

abdul basith
I install qt in host, and by cross compiling I got the exec file. while run
that in mini2440 kit it says "illegal instruction". how to solve this.

Jay
Does the file has execute rights?

david
Jay im going to use php with sqlite, but the only link available for that
its broken, are you using php with sqlite?? what is the package you
recommend me to dowload??

david
i have download some packages but i didnt found the php.exe on that. so i
dont know how to configure my webserver

Jay
Which webserver youre using? Apache2 or lighttpd? I would recommend to use
lighttpd because it's better in performance and is using less ressources on
armel processor boards. There you can run PHP as CGI module.

Why youre speaking about php.EXE (which is a Windows executable)? I thought
you want use php under Linux because this thread is for cross-compiling php
under Linux.

david
jay, yes im using linux, but when i made my php cross compilation it create
me a file executable php. (i did a mistake when i said a file.exe)that file
i cant find it on the packages that i dowloaded from debian.

could you tell me what package did you choose?

About the webserver, im using cherokee web server and i could configure it
to use php bye this line:

source!1!interpreter = /home/php/bin/php-cgi -b 127.0.0.1:47990

then my problem its that i didnt find that file on the packages i dowloaded

but i would like to test lighttpd if it allows me to run php faster


Jay thanks for your help!!

Jay
I don't know about cherokee web server but it doesn't seem to be a problem
with the webserver but with the php-cgi script. Also: do you have e.g. dpkg
to install or a tool to extract the .deb file that can be found on
http://www.emdebian.org/grip/search.php?package=php5-cgi&arch=&d... ?

If youre using a armel debian filesystem (in my opinion this is perfect for
mini2440), you can use dpkg -i php5-cgi_<version> or apt-get install
php5-cgi (if the internet connection is working on your mini2440). It will
install at least the binary in /usr/bin/php5-cgi.

david
on my mini2440 i have install qtopia 2.2. .... that is what comes on the
cd, i tried to install php with your commands: apt-get install and dpkg but
both commands throws me this mistake: command not found.

im going to try with your link's package, but i would like to know how did
you install apt on mini, but i think that it could be on other forum,
friend thanks a lot!

david
hi i downloaded the package and send it to my mini2440 it has two files who
are type symbolic links but both are broken, does it could be a problem??

however i test a php web page and it doesnt work it shows me:
503 Service Unavailable

i wanted to test the file php who is found on /usr/lib/cgi-bin folder of my
php uncompress file then i put :

./php and it throws me:

error while loading shared libraries: libz.so.1: cannot opoen shared object
file: No such file or directory.

i have already compile that library for my previus process so i paste it on
/lib of mini and it fix the problem

however i tested again:
./php now it throws me this mistake:

error while loading sahred libraries: liboning.so.2: cannot open shared
object file: No such file or directory.

i dont have that library, where i can dowload it?? how many additional
libraries do i have to dowload to make this work??


thanks for all your help this its making me crazy

david
I have to excuese i already see that package, forgive my last doubt, iam
tired to try with this for that reason i dont see the obvius.

i could solve this problem but now (this never finish!!)

error while loading shared libraries libssl.so.0.9.8 i tried to download it
but.. the link its broke!!! what can i do? where can i find it?

david
i believe that i have to use all the dependences packages of this program
but i see that it more than 1 broken link, where can i download that
packages??.

jay thanks for all your help

Jay
Try to disable SSL (seems that php or the webserver tries to load the
library for it) first. SSL on mini2440 makes no sense if youre not running
any security risk applications/scripts.

Also, I would strongly recommend to use debian with APT because it would
solve all dependencies for you.

Jay
Question: why you need Qtopia? Seems that youre building a webserver. For
that (or other server applications) you don't really need this (also it
takes many ressources). I recommend to install emdebian for armel (there is
a good description on the site): http://emdebian.org/

Holly
For fix "illegal instruction" change for all libs and php
arm-none-linux-gnueabi- -> arm-linux-
then recompile and reinstall all

Eample

/*********libxml**************/
export CROSS_COMPILE=arm-linux-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++" 
./configure --host=arm-linux --target=arm --prefix=/opt/libxml
--disable-shared

/************php*********/
export CROSS_COMPILE=arm-linux-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php \
--disable-short-tags --enable-shared \
--without-mysql --without-pear --disable-all --disable-short-tags \
--enable-libxml \
--with-libxml-dir=/opt/libxml/ \
--with-zlib-dir=/opt/zlib/

david
Holly you are right!! it fix the illegal instrution problem, how ever i
test a .php page and it toke to many time loading and when it finish it
show me: Service Unavailable.

did you test that code? i think that we have advance, we are more close
now.

thanks, what could be the other problem?


Jay,

im working on qtopia because it has touchscrean, does embedebian has too?
about disable ssl, im not very sure because php work well but without
include libxml. so i believe that it has a good configuration.

Thanks for all your help. we almost finish!!! :)

david
HI again ejjeje, i change the code of php compilation now it reads again 
pages php

export CROSS_COMPILE=arm-linux-
export CC=${CROSS_COMPILE}"gcc"
export CXX=${CROSS_COMPILE}"g++"
./configure --host=arm-linux --target=arm --prefix=/opt/php \
--disable-short-tags --enable-shared \
--without-mysql --without-pear --disable-all --disable-short-tags \
--enable-libxml --enable-dom -enable-xmlreadear --enable-xmlwriter
--enable-fastcgi --enable-xml \
--with-libxml-dir=/opt/libxml/ 

but it continue with the problem that i cant work with formularies when i
tested a simple formulary it returned to me the php code.

do i need another librarie?

david
hi at least i works!!! thanks to all people who help with this!! i only
have to enable another thing on php script, thanks again!!

Dave Festing
Now write a tutorial!

Dave

david
jajaj thanks alot im going to write it althought all people who wants this
too can do it following this forum, while i write the tutorial :)

i have a final goal with this.

configure php with sqlite, im going to look some information and take some
advance before write here..


thanks again to all people to help me with this

Jay
I have installed gcc and such for armel processors directly in the linux
filesystem so I am able to compile it directly on and for the mini2440.

Nicolas
Id be very grateful if you could post more details on what files you used,
or locations.

I too am interested in getting a small web server with php running.

david
i usued php.5.2.10 you have to read all the proccess to read the libraries
and its versions

Bala
Thanks guys davef, Holly, Jay, Holly ...
This reply chain was music to my ears.

I am going to start the cross compilation of Apache or Light HTTPD or
Cherokee with SQLITE , PHP for a proprietory ARM board.

If anyone is planning to cross compile MySQL, PHP, LIGHT HTTPD for ARM can
follow this link:
http://tw.myblog.yahoo.com/stevegigijoe/article?mid=317
http://tw.myblog.yahoo.com/stevegigijoe/article?mid=316

David - you are awesome man. i appreciate your perseverance.
Cheers

Andy
I have mini-httpd with SSL running on a Mini6410.

If you have the FriendlyArm compiler installed all you need to do is edit
the Makefile :-

CC = arm-linux-gcc

And if you want SSL uncomment where it says and make

SSL_TREE = wherever you have uncompressed openssl to

And it works very well!