Skip to content

Generating phar.php during cross-compile can't be done #11099

Closed
ThePHPF/thephp.foundation
#90

Description

@peter279k

Description

When building the PHP 8.x versions with phar support from source with aarch64-linux-gnu tool chain, it will be failed:

Here are configure commands:

./configure '--cache-file=/home/localadmin/.phpbrew/cache/config.cache' '--prefix=/home/localadmin/.phpbrew/php/php_8_0_arm' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-dom' '--with-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash' '--enable-pcntl' '--enable-pdo' '--enable-posix' '--enable-sockets' '--disable-opcache' '--without-readline' '--without-openssl' '--without-curl' '--without-pear' '--without-zip' '--host=aarch64-linux' '--with-xsl=/opt/libxslt' '--with-zlib=/opt/zlib' '--with-libxml=/opt/libxml2' '--with-bz2=/opt/bzip2' '--disable-test' '--with-config-file-path=/home/localadmin/.phpbrew/php/php_8_0_arm/etc/cli' '--with-config-file-scan-dir=/home/localadmin/.phpbrew/php/php_8_0_arm/var/db/cli' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/libxslt/lib/pkgconfig' >> '/home/localadmin/.phpbrew/build/php_8_0_arm/build.log'

And the error message is as follows:

Generating phar.php

/bin/bash: /home/localadmin/.phpbrew/build/php_8_0_arm/sapi/cli/php: cannot execute binary file: Exec format error

Makefile:413: recipe for target 'ext/phar/phar.php' failed

make: *** [ext/phar/phar.php] Error 126

I think it should have the way to check whether it's cross compiling mode and it can avoid running the php binary.

That is, it should skip related phar generating steps when it's the cross compiling mode.

PHP Version

PHP 8.x

Operating System

Using the aarch64-linux-gnu tool chain in the Ubuntu 18.04 for the AARCH-64 target.

Activity

  1. FosterYi97 commented on May 15, 2023

    @FosterYi97

    Hello, have you solved this problem?

  2. peter279k commented on May 15, 2023

    @peter279k
    ContributorAuthor

    I don't resolve the problem.

  3. added 2 commits that reference this issue on May 20, 2023
    93fa961
    ffae350
  4. added a commit that references this issue on May 20, 2023
    a94fe87
  5. mcoelho80 commented on Jun 12, 2023

    @mcoelho80
    # uname -a
    FreeBSD server 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64
    
    Generating phar.php
    [: -ne: unexpected operator
    Skipping phar.php generating during cross compilation
    Generating phar.phar
    [: -ne: unexpected operator
    Skipping phar.phar generating during cross compilation
    

    This fix doesn't work on FreeBSD. I had to revert this patch to be able to build PHP with phar support.

  6. ndossche commented on Jun 12, 2023

    @ndossche
    Member

    @mcoelho80 I'll take a look later today

  7. peter279k commented on Jun 12, 2023

    @peter279k
    ContributorAuthor

    It seems that the issue is about the shell. I will check this in the FreeBSD.

  8. mcoelho80 commented on Jun 12, 2023

    @mcoelho80

    Same problem with PHP 8.1.20.
    PHP 8.0.29 seems fine, as ext/phar/Makefile.frag wasn't changed.

  9. peter279k commented on Jun 12, 2023

    @peter279k
    ContributorAuthor

    @mcoelho80, PR is created and you can also help me to check that. Thanks :).

  10. ndossche commented on Jun 13, 2023

    @ndossche
    Member

    @mcoelho80, PR is created and you can also help me to check that. Thanks :).

    I tested the patch on both Linux and FreeBSD and it works. The PR is merged now. Thanks.

  11. added a commit that references this issue on Jun 15, 2023
    a24f95a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions