Find the answer to your Linux question:
Results 1 to 6 of 6
Hi I'm a bit of a newbie with this stuff, so I'm not 100% sure where to post this. Anyway I have a mini arm based PC for which I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    2

    Cross-compiling PHP


    Hi

    I'm a bit of a newbie with this stuff, so I'm not 100% sure where to post this.

    Anyway I have a mini arm based PC for which I am trying to compile a php binary in cgi-mode, which supports sqlite.

    I am trying to cross compile from a Ubuntu PC.

    My code is as follows (from the unzipped PHP directory):

    $ export CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc
    $ export CXX=/usr/local/arm/3.4.1/bin/arm-linux-cpp
    $ ./configure --host=i386-linux-gnu --prefix=/usr/home/ben/Desktop/php_bin --enable-ftp --target=arm --without-pear --disable-simplexml --disable-mbregex --enable-sockets --enable-pdo --with-pdo-sqlite --with-sqlite3 --disable-all
    $ make
    $ make install

    It runs through the ./configure fine until the make command, where it falls over with the following error:

    .....Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo main/internal_functions.lo -lcrypt -lcrypt -lrt -lm -lcrypt -lcrypt -o sapi/cgi/php-cgi ext/date/lib/parse_date.o: could not read symbols: Input/output error collect2: ld returned 1 exit status
    make: *** [sapi/cgi/php-cgi] Error 1

    I went into to php-5.3.2/ext/date/lib and sure enough the parse_date.o file hangs the OS when I try and open it.

    I re-downloaded the php 5.3.2 tarball, (thinking it could be a corrupt download) and php-5.3.2/ext/date/lib/parse_date.o doesn't exist in the unzipped files, and I get the same error anyway.

    I've been researching online a bit and .o files are made during installations....

    If anyone can see what I'm doing wrong I'd be eternally grateful!

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    you're certainly the first one that i see that tries to cross-compile a php file. without even asking what this is for, it seems like the code for the method parse_date is missing. so either it was removed and the make script was not updated or it failed to build it. maybe you configured it wrong or there are missing some dependencies so that it can't be built. i suspect that you should examine the configure step more closely.

  3. #3
    Linux Newbie unlimitedscolobb's Avatar
    Join Date
    Jan 2008
    Posts
    120
    Quote Originally Posted by bkent View Post
    I'm a bit of a newbie with this stuff, so I'm not 100% sure where to post this.
    Have you tried some PHP forums, like this one DevNetwork Forums • Index page ? I'm not saying that there aren't PHP gurus on this forum, but you may have better luck on a specialized forum.

    My conjecture is that your problem is ARM-related. Maybe you could try to build your PHP with exactly the same command without specifying ARM as the target architecture? This will at least show you whether the problem is not appearing due to some conflicting configure options.
    Last edited by unlimitedscolobb; 05-12-2010 at 07:39 PM. Reason: Add some rationale about rebuilding with ARM omitted.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2010
    Posts
    2
    Thanks for the responses guys - I've tried your advice unlimitedscolobb:

    I've tried the configure without the "--target=arm" to eliminate an arm problem (I get the exact same error).
    Also without specifying the gcc or cpp compilers, allowing the ./configure use those bundled with ubuntu (again the same error)
    And finally without both (predictably the same parse_date.o error occured)

    Not sure where that left me, so I've also joined the php forum you suggested...

    I'm starting to eliminate elements of the ./configure as suggested by Kloschüssel.

    Still really struggling here!

  6. #5
    Linux Newbie unlimitedscolobb's Avatar
    Join Date
    Jan 2008
    Posts
    120
    Quote Originally Posted by bkent View Post
    I'm starting to eliminate elements of the ./configure as suggested by Kloschüssel.

    Still really struggling here!
    Good luck! Feel free to ask here, too, when you consider it necessary and please tell us the solution once you've found it

  7. #6
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Well, I didn't propose to eliminate options of the configure step, but rather just fix it.

    There may be a missing dependency on your system. If this is so, the configure script would disable certain modules (i.e. parse_date). Then it compiles fine until something needs the object (parse_date.o) and as it doesn't find it, it won't link your program.

    So either install the missing dependency if there is one or fix your configure options to tell him that he needs to compile the parse_date (what exactly it needs, I can't tell you).

    Usually during configure you get some output which module is disabled and why. I.e. something like:
    Checking for glib: ok
    Checking for libssl: MISSING
    I hope I can get you to the point. Happy debugging!

    PS: why would you want this anyway? I would never dream of an application based upon php source code. It is completely impossible to maintain. Even though it is possible to cross-compile it, the primary advantage of php is its interpreter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •