php compilation fails on android build
DaisukeDaisuke opened this issue · 7 comments
option
/compile.sh -t android-aarch64 -x -j4 -P5
commit
musl-cross-make
https://github.com/ScerIO/musl-cross-make/releases/tag/v1.1-dev2
log
./compile.sh -t android-aarch64 -x -j4 -P5
[PocketMine] PHP compiler for Linux, MacOS and Android
[INFO] Checking dependencies
[opt] Set target to android-aarch64
[opt] Doing cross-compile
[opt] Set make threads to 4
[opt] Compiling with configuration for PocketMine-MP 5
[INFO] Cross-compiling for Android ARMv8 (aarch64)
[warning] OPcache cannot be used on static builds; this may have a negative effect on performance
[warning] Xdebug cannot be built in static mode
[PHP 8.1.22] downloading... done!
[zlib 1.2.13] downloading... configuring... compiling... installing... done!
[gmp 6.3.0] downloading... configuring... compiling... installing... done!
[openssl 3.1.2] downloading... configuring... compiling... installing... done!
[curl curl-8_2_0] downloading... configuring... compiling... installing... done!
[yaml 0.2.5] downloading... configuring... compiling... installing... done!
[leveldb 1c7564468b41610da4f498430e795ca4de0931ff] downloading... configuring... compiling... installing... done!
[libxml2 2.10.1] downloading... configuring... compiling... installing... done!
[libzip 1.10.0] downloading... configuring... compiling... installing... done!
[sqlite3 3420000] downloading... configuring... compiling... installing... done!
[libdeflate 495fee110ebb48a5eb63b75fd67e42b2955871e2] downloading... configuring... compiling... installing... done!
[PHP] Downloading additional extensions...
pmmpthread: downloading 6.0.7... done!
yaml: downloading 2.2.3... done!
igbinary: downloading 3.2.14... done!
recursionguard: downloading 0.1.0... done!
crypto: downloading 0.3.2... done!
leveldb: downloading 317fdcd8415e1566fc2835ce2bdb8e19b890f9f3... done!
chunkutils2: downloading 0.3.5... done!
libdeflate: downloading 0.2.1... done!
morton: downloading 0.1.2... done!
xxhash: downloading 0.2.0... done!
arraydebug: downloading 0.1.0... done!
[PHP 8.1.22] configuring... compiling...daiuskedaisuke@daiuskedaisuke-VirtualBox:~/Documents/PHP-Binaries$
install.log
libtool: link: warning: library `/home/daiuskedaisuke/Documents/bin/aarch64-linux-musl/lib/libstdc++.la' was moved.
libtool: link: warning: library `/home/daiuskedaisuke/Documents/bin/aarch64-linux-musl/lib/libstdc++.la' was moved.
/home/daiuskedaisuke/Documents/bin/bin/../lib/gcc/aarch64-linux-musl/9.4.0/../../../../aarch64-linux-musl/bin/ld: cannot find -lzstdOpenSSL::Crypto
/home/daiuskedaisuke/Documents/bin/bin/../lib/gcc/aarch64-linux-musl/9.4.0/../../../../aarch64-linux-musl/bin/ld: cannot find -lzstdZLIB::ZLIB
collect2: error: ld returned 1 exit status
make: *** [Makefile:286: sapi/cli/php] Error 1
install_data/subdir/php/config.log
You should use -s
. Non-static builds aren't well supported for Android.
Even with the -s option it fails with the same error
(I do not need an android build myself.)
./compile.sh -t android-aarch64 -x -j4 -P5 -s
[PocketMine] PHP compiler for Linux, MacOS and Android
[INFO] Checking dependencies
[opt] Set target to android-aarch64
[opt] Doing cross-compile
[opt] Set make threads to 4
[opt] Will compile everything statically
[opt] Compiling with configuration for PocketMine-MP 5
[INFO] Cross-compiling for Android ARMv8 (aarch64)
[warning] OPcache cannot be used on static builds; this may have a negative effect on performance
[warning] Xdebug cannot be built in static mode
[PHP 8.1.22] downloading... done!
[zlib 1.2.13] downloading... configuring... compiling... installing... done!
[gmp 6.3.0] downloading... configuring... compiling... installing... done!
[openssl 3.1.2] downloading... configuring... compiling... installing... done!
[curl curl-8_2_0] downloading... configuring... compiling... installing... done!
[yaml 0.2.5] downloading... configuring... compiling... installing... done!
[leveldb 1c7564468b41610da4f498430e795ca4de0931ff] downloading... configuring... compiling... installing... done!
[libxml2 2.10.1] downloading... configuring... compiling... installing... done!
[libzip 1.10.0] downloading... configuring... compiling... installing... done!
[sqlite3 3420000] downloading... configuring... compiling... installing... done!
[libdeflate 495fee110ebb48a5eb63b75fd67e42b2955871e2] downloading... configuring... compiling... installing... done!
[PHP] Downloading additional extensions...
pmmpthread: downloading 6.0.7... done!
yaml: downloading 2.2.3... done!
igbinary: downloading 3.2.14... done!
recursionguard: downloading 0.1.0... done!
crypto: downloading 0.3.2... done!
leveldb: downloading 317fdcd8415e1566fc2835ce2bdb8e19b890f9f3... done!
chunkutils2: downloading 0.3.5... done!
libdeflate: downloading 0.2.1... done!
morton: downloading 0.1.2... done!
xxhash: downloading 0.2.0... done!
arraydebug: downloading 0.1.0... done!
[PHP 8.1.22] configuring... compiling...daiuskedaisuke@daiuskedaisuke-VirtualBox:~/Documents/PHP-Binaries$
libtool: link: warning: library `/home/daiuskedaisuke/aarch64-linux-musl/aarch64-linux-musl/lib/libstdc++.la' was moved.
libtool: link: warning: library `/home/daiuskedaisuke/aarch64-linux-musl/aarch64-linux-musl/lib/libstdc++.la' was moved.
/home/daiuskedaisuke/aarch64-linux-musl/bin/../lib/gcc/aarch64-linux-musl/9.4.0/../../../../aarch64-linux-musl/bin/ld: cannot find -lzstdOpenSSL::Crypto
/home/daiuskedaisuke/aarch64-linux-musl/bin/../lib/gcc/aarch64-linux-musl/9.4.0/../../../../aarch64-linux-musl/bin/ld: cannot find -lzstdZLIB::ZLIB
collect2: error: ld returned 1 exit status
make: *** [Makefile:286: sapi/cli/php] Error 1
After investigating this issue in detail, it seems that libzip v1.10.0 is causing the php itself to fail to compile
(android crosscompile)
libzip v1.9.2 compiles correctly
I'm not rolling it back just for Android. It works correctly on all other platforms.
Looks like this is related to nih-at/libzip#399
To be honest I'm not actually sure why we haven't come across this before.
-DENABLE_ZSTD=OFF is used by default, which should have caused this to happen for all platforms using compile.sh. Seems we've been spared somehow by some black magic.
Looks like it's static building that actually caused this ...