64-bit Ubuntu 14.04 on use Musleabi minimize cross-compiling Android version of PHP7

Source: Internet
Author: User
Https://bitbucket.org/GregorR/musl-cross/downloads
CROSSX86-ARM-LINUX-MUSLEABI-0.9.11.TAR.XZ (20MB)

CC=ARM-LINUX-MUSLEABI-GCC \
cxx=arm-linux-musleabi-g++ \
Ar=arm-linux-musleabi-ar \
LD=ARM-LINUX-MUSLEABI-LD \
Ranlib=arm-linux-musleabi-ranlib \
Strip=arm-linux-musleabi-strip \
cflags= "-os" \
cxxflags= "-os" \
./configure \
--host=arm-linux-musleabi \
--prefix=/opt/phpdroid/php \
--disable-all \
--enable-json \
--ENABLE-PDO \
--with-sqlite3 \
--with-pdo-sqlite

The PHP source code comes with the Pcre library and does not depend on the external Pcre library at compile time, so you do not need to compile the Pcre library and configure the Cppflags and Ldflags parameters:
cppflags= "-i/png/dev/android/compiled/usr/include-i/png/dev/android/compiled/usr/usr/include" \
ldflags= "-static-l/png/dev/android/compiled/usr/lib-l/png/dev/android/compiled/usr/usr/lib" \

Sed-i "s{/bin/sh{/system/bin/sh{" ext/standard/proc_open.c
Sed-i "s{-export-dynamic{-all-static{" Makefile

Missing sed-i "s{-export-dynamic{-all-static{" Makefile after compiling:
./php-v return-bash:./php:no such file or directory
File./php returns php:elf 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
Normal should return php:elf 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped

Time nice-20 Make-j2
Make install

arm-linux-musleabi-strip/opt/phpdroid/php/bin/php
Xz-z-k-9/opt/phpdroid/php/bin/php
Strip less than 4mb,xz after compression of about 1MB.
3.7MB smaller than the current PHP.XZ 2.7MB, phpdroid apk package can be reduced from 5.7MB to 3MB.
Download: Php-7.0.6-arm-linux.xz (1.1MB)

./php-m
[PHP Modules]
Core
Date
Json
Pcre
Pdo
Pdo_sqlite
Reflection
Spl
Sqlite3
Standard

./php-r ' Print_r (Get_defined_functions ()); ' > Func.txt
./php-r ' Print_r (get_declared_classes ()); ' > Class.txt
Visible includes some of the features that are commonly used below:
Pdo_sqlite
Json_encode/json_decode
File_get_contents/file_put_contents
Note: Without OpenSSL support, the file_put_contents is not supported by the HTTPS protocol.
./php-r "file_put_contents (' logo.gif ', file_get_contents (' https://www.baidu.com/img/bdlogo.gif '));"

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.