Use musleabi on 64-bit Ubuntu14.04 to minimize cross-compiling of PHP 7 for Android

Source: Internet
Author: User
Use musleabi on 64-bit Ubuntu14.04 to minimize the cross-compiling Android PHP7 https://bitbucket.org/GregorR/musl-cross/downloads
Crossx86-arm-linux-musleabi-0.9.11.tar.xz (20 MB)

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, which does not depend on the external PCRE library during compilation. Therefore, you do not need to compile the PCRE library and configure CPPFLAGS and LDFLAGS parameters:
CPPFLAGS = "-I/png/dev/android/compiled/usr/include "\
LDFLAGS = "-static-L/png/dev/android/compiled/usr/lib "\

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

Sed-I "s {-export-dynamic {-all-static {" Makefile compiled:
./Php-v returned-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
Normally, 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 is less than 4 MB, and xz is compressed to about 1 MB.
It is 2.7 MB smaller than php. xz, and the PHPDroid APK package can be reduced from 5.7MB to 3 MB.
Download: php-7.0.6-arm-linux.xz (1.1 MB)

./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
It can be seen that it includes the following common functions:
Pdo_sqlite
Json_encode/json_decode
File_get_contents/file_put_contents
Note: without OpenSSL support, file_put_contents does not support HTTPS.
./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.