1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

PHP 7.2 for arm64 linux on Raspberry Pi 3

Discussion in 'Help' started by Drublic, Oct 6, 2017.

  1. Drublic

    Drublic Creeper

    Messages:
    4
    I'm trying to run PMMP on a raspberry pi 3 B. I managed to get a 64-bit os (a debian stretch off-shoot called pi64) on it and get all the dependencies set up but it looks like the official PHP packages are not up to 7.2 yet. So when I try to run PMMP, I get the message:

    [CRITICAL] You must use PHP >= 7.2
    [CRITICAL] Please use the installer provided on the homepage.


    I see that we have a php 7.2 build available for linux here: https://jenkins.pmmp.io/job/PHP-7.2-Linux-x86_64/
    but it doesn't work for arm64 architectures.

    Is there a way around this?
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    kitoine and Drublic like this.
  3. Drublic

    Drublic Creeper

    Messages:
    4
    I tried...

    compile.sh bails here:
    Code:
    [PocketMine] PHP compiler for Linux, MacOS and Android
    [INFO] Checking dependencies
    [INFO] Compiling for current machine using 64-bit
    [ PHP ] downloading 7.2.0RC3... done!
    [zlib] downloading 1.2.11... checking...
    
    installer.sh bails here:
    Code:
    [*] Retrieving latest build data for channel "alpha"
    [*] Found PocketMine-MP 1.7dev (build 83) for Minecraft: PE v1.2.0.81 (PHP 7.2, API 3.0.0-ALPHA8)
    [*] This alpha build was released on Mon Sep 25 06:30:26 PDT 2017
    [*] Installing/updating PocketMine-MP on directory ./
    [1/3] Cleaning...
    [2/3] Downloading PocketMine-MP 1.7dev phar... done!
    [3/3] Obtaining PHP: detecting if build is available... Linux PHP build available... downloading 7.2 ... checking... downloaded PHP build doesn't work on this platform!
    [3/3] No prebuilt PHP found, compiling PHP automatically. This might take a while.
    
    [PocketMine] PHP compiler for Linux, MacOS and Android
    [INFO] Checking dependencies
    [INFO] Compiling for current machine using 64-bit
    [ PHP ] downloading 7.2.0RC3... done!
    [zlib] downloading 1.2.11... checking...
    
    And the log says...
    Code:
    Linux pi64 4.11.12-pi64+ #1 SMP PREEMPT Sun Aug 27 14:50:58 CEST 2017 aarch64 G$
    make is /usr/bin/make
    autoconf is /usr/bin/autoconf
    automake is /usr/bin/automake
    m4 is /usr/bin/m4
    wget is /usr/bin/wget
    getconf is /usr/bin/getconf
    gzip is /bin/gzip
    bzip2 is /bin/bzip2
    bison is /usr/bin/bison
    g++ is /usr/bin/g++
    libtool is /usr/bin/libtool
    wget is /usr/bin/wget
    gcc is /usr/bin/gcc
    gcc: error: unrecognized command line option ‘-m64’
    rm: cannot remove 'test': No such file or directory
    Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
    ** ./configure aborting.
    
    I wish I knew enough about this stuff to adapt to these errors.
    I'll keep poking around.
     
    Last edited: Oct 7, 2017
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Your version/variant of gcc seems to create problems. what's the output of gcc -v?
     
    Drublic likes this.
  5. Drublic

    Drublic Creeper

    Messages:
    4
    This is what I got:
    Code:
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/6/lto-wrapper
    Target: aarch64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-arm64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-arm64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-arm64 --with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-fix-cortex-a53-843419 --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
    Thread model: posix
    gcc version 6.3.0 20170516 (Debian 6.3.0-18)
    
     
  6. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Someone told me to tell you to drop -m64.
     
    Drublic likes this.
  7. Drublic

    Drublic Creeper

    Messages:
    4
    That worked! Thanks!

    I just commented out or removed the calls to -m64 in the compile script. It's only in 3 spots.

    For anyone who might want to know specifically, this is around line 185 of compile.sh

    Code:
    
    if [ "$IS_CROSSCOMPILE" == "yes" ]; then
        export CROSS_COMPILER="$PATH"
        if [[ "$COMPILE_TARGET" == "win" ]] || [[ "$COMPILE_TARGET" == "win64" ]]; then
            TOOLCHAIN_PREFIX="x86_64-w64-mingw32"
            [ -z "$march" ] && march=x86_64;
            [ -z "$mtune" ] && mtune=nocona;
            CFLAGS="$CFLAGS -mconsole"
            CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX --build=$TOOLCHAIN_PREFIX"
            IS_WINDOWS="yes"
            OPENSSL_TARGET="mingw64"
            GMP_ABI="64"
            echo "[INFO] Cross-compiling for Windows 64-bit"
        elif [ "$COMPILE_TARGET" == "mac" ]; then
            [ -z "$march" ] && march=prescott;
            [ -z "$mtune" ] && mtune=generic;
            CFLAGS="$CFLAGS -fomit-frame-pointer";
            TOOLCHAIN_PREFIX="i686-apple-darwin10"
            CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
            #zlib doesn't use the correct ranlib
            RANLIB=$TOOLCHAIN_PREFIX-ranlib
            LEVELDB_VERSION="1bd4a335d620b395b0a587b15804f9b2ab3c403f"
            CFLAGS="$CFLAGS -Qunused-arguments -Wno-error=unused-command-line-argument-hard-error-in-future"
            ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
            OPENSSL_TARGET="darwin64-x86_64-cc"
            GMP_ABI="32"
            echo "[INFO] Cross-compiling for Intel MacOS"
        elif [ "$COMPILE_TARGET" == "android-aarch64" ]; then
            COMPILE_FOR_ANDROID=yes
            [ -z "$march" ] && march="armv8-a";
            [ -z "$mtune" ] && mtune=generic;
            TOOLCHAIN_PREFIX="aarch64-linux-musl"
            CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --disable-ipv6"
            CFLAGS="-static $CFLAGS"
            CXXFLAGS="-static $CXXFLAGS"
            LDFLAGS="-static"
            OPENSSL_TARGET="linux-aarch64"
            echo "[INFO] Cross-compiling for Android ARMv8 (aarch64)"
        #TODO: add cross-compile for aarch64 platforms (ios, android, rpi)
        else
            echo "Please supply a proper platform [mac win win64] to cross-compile"
            exit 1
        fi
    elif [[ "$COMPILE_TARGET" == "linux" ]] || [[ "$COMPILE_TARGET" == "linux64" ]]; then
        [ -z "$march" ] && march=x86-64;
        [ -z "$mtune" ] && mtune=nocona;
    
        #********DRUBLIC REMOVED -m64***********
        #********CFLAGS="$CFLAGS -m64"**********
        GMP_ABI="64"
        OPENSSL_TARGET="linux-x86_64"
        echo "[INFO] Compiling for Linux x86_64"
    elif [[ "$COMPILE_TARGET" == "mac" ]] || [[ "$COMPILE_TARGET" == "mac64" ]]; then
        [ -z "$march" ] && march=core2;
        [ -z "$mtune" ] && mtune=generic;
        #********DRUBLIC REMOVED -m64*************
        CFLAGS="$CFLAGS -arch x86_64 -fomit-frame-pointer -mmacosx-version-min=10.7";
        if [ "$DO_STATIC" == "no" ]; then
            LDFLAGS="$LDFLAGS -Wl,-rpath,@loader_path/../lib";
            export DYLD_LIBRARY_PATH="@loader_path/../lib"
        fi
        LEVELDB_VERSION="1bd4a335d620b395b0a587b15804f9b2ab3c403f"
        CFLAGS="$CFLAGS -Qunused-arguments -Wno-error=unused-command-line-argument-hard-error-in-future"
        ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
        GMP_ABI="64"
        CXXFLAGS="$CXXFLAGS -stdlib=libc++"
        OPENSSL_TARGET="darwin64-x86_64-cc"
        echo "[INFO] Compiling for Intel MacOS x86_64"
    #TODO: add aarch64 platforms (ios, android, rpi)
    elif [ -z "$CFLAGS" ]; then
        if [ `getconf LONG_BIT` == "64" ]; then
            echo "[INFO] Compiling for current machine using 64-bit"
            #**************DRUBLIC REMOVED -m64**************
            #**************CFLAGS="-m64 $CFLAGS"**************
            GMP_ABI="64"
        else
            echo "[ERROR] PocketMine-MP is no longer supported on 32-bit systems"
            exit 1
        fi
    fi
    
    
     
    kitoine and robske_110 (Tim) like this.
  8. kitoine

    kitoine Spider

    Messages:
    12
    May you help me, I set up pi64 aswell on my Raspberry Pi 3 Model B and I used https://github.com/pmmp/php-build-scripts. Now I have dropped the -m64 and used 1. compile.sh -t linux64 -l -j4 -c -f x86_64 2. ./Installer.sh , now after ./start.sh it tells me "Couldn't find a working PHP 7 Binary, please use the installer."
     
  9. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Last edited: Oct 27, 2017
  10. kitoine

    kitoine Spider

    Messages:
    12
  11. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    oops. page should be there now :)
     
  12. kitoine

    kitoine Spider

    Messages:
    12
    after hours of compile.sh process (weird why it took so much time) it still don't find the php, may it's because of the Canditate 4 Version you used in your script? It tells me ".start.sh: line 28: type:php:not found Couldn't find a working PHP 7 binary...
     
  13. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    please post the output you recieved while executing ./compile.sh -t aarch -j4 -c -f and the install.log file it generated
    Also please check that you have really used https://github.com/robske110/php-build-scripts/blob/rpi_fix/compile.sh
     
    Last edited: Oct 27, 2017
  14. kitoine

    kitoine Spider

    Messages:
    12
    same as above, I try one more time replacing the compile.sh with your fixed pi code and the ./compile.sh -t aarch -j4 -c -f
    Code:
    Fri Oct 27 18:02:38 UTC 2017
    Linux raspberrypi 4.11.12-pi64+ #1 SMP PREEMPT Sun Jul 30 20:18:20 CEST 2017 aarch64 GNU/Linux
    make is /usr/bin/make
    autoconf is /usr/bin/autoconf
    automake is /usr/bin/automake
    m4 is /usr/bin/m4
    wget is /usr/bin/wget
    getconf is /usr/bin/getconf
    gzip is /bin/gzip
    bzip2 is /bin/bzip2
    bison is /usr/bin/bison
    g++ is /usr/bin/g++
    libtool is /usr/bin/libtool
    wget is /usr/bin/wget
    gcc is /usr/bin/gcc
    gcc: error: unrecognized command line option ‘-m64’
    rm: cannot remove 'test': No such file or directory
    Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
    ** ./configure aborting.
    
     
  15. kitoine

    kitoine Spider

    Messages:
    12
    @robske_110 (Tim) I figured out that there is no php folder below /bin/php7/bin/php<- I think your compile.sh should be supposed to create this? I tried to put install_data/php there , but didn't work either
     
  16. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    that is probably due to a failure again. please post command output and install.log.
     
  17. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    In the command output there should be
    Code:
    [INFO] Compiling for aarch
    and no other
    Code:
    [INFO] Compiling for
    messages
     
  18. kitoine

    kitoine Spider

    Messages:
    12
    Code:
    pi@raspberrypi:~/Desktop/MCPE$ ./compile.sh -t aarch -j4 -c -f
    [PocketMine] PHP compiler for Linux, MacOS and Android
    [INFO] Checking dependencies
    [opt] Set target to aarch
    [opt] Set make threads to 4
    [opt] Will force compile cURL
    [opt] Enabling abusive optimizations...
    [INFO] Compiling for aarch
    [PHP] downloading 7.2.0RC5... done!
    [zlib] downloading 1.2.11... checking... compiling... installing... done!
    [GMP] downloading 6.1.2... checking...
    
    it will take like 1 hour till it finishes. I will edit this comment if it finished.
     
  19. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    good, so far it looks good :)
     
  20. kitoine

    kitoine Spider

    Messages:
    12
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.