This Magisk module contains the Perl 5.43 binaries compiled with clang19 and the Android NDK r27d for arm64 CPUs.

Pleaes note that odd Perl versions like 5.43 are development versions that should NOT be used on production machines!


ASUS_I006D:/ $ ASUS_I006D:/ $ perl --version

This is perl 5, version 43, subversion 3 (v5.43.3 (v5.43.4-17-g4222a60022*)) built for aarch64-linux-android
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2025, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.

ASUS_I006D:/ $ 



The perl executables and scripts are installed in /system/usr/bin:

ASUS_I006D:/ $ date
Mon Oct 27 14:23:37 CET 2025
ASUS_I006D:/ $    
ASUS_I006D:/ $ ls -l /system/usr/bin
total 9156
-rwxr-xr-x 1 root root   15389 2025-10-27 14:11 corelist
-rwxr-xr-x 1 root root    8374 2025-10-27 14:11 cpan
-rwxr-xr-x 1 root root   41900 2025-10-27 14:11 enc2xs
-rwxr-xr-x 1 root root    3079 2025-10-27 14:11 encguess
-rwxr-xr-x 1 root root   28840 2025-10-27 14:11 h2ph
-rwxr-xr-x 1 root root   60948 2025-10-27 14:11 h2xs
-rwxr-xr-x 1 root root    4304 2025-10-27 14:11 instmodsh
-rwxr-xr-x 1 root root    5006 2025-10-27 14:11 json_pp
-rwxr-xr-x 1 root root   15792 2025-10-27 14:11 libnetcfg
-rwxr-xr-x 1 root root 4326352 2025-10-27 14:11 perl
-rwxr-xr-x 1 root root 4326352 2025-10-27 14:11 perl5.43.3
-rwxr-xr-x 1 root root   45603 2025-10-27 14:11 perlbug
-rwxr-xr-x 1 root root     276 2025-10-27 14:11 perldoc
-rwxr-xr-x 1 root root   10831 2025-10-27 14:11 perlivp
-rwxr-xr-x 1 root root   45603 2025-10-27 14:11 perlthanks
-rwxr-xr-x 1 root root    8374 2025-10-27 14:11 piconv
-rwxr-xr-x 1 root root    4550 2025-10-27 14:11 pl2pm
-rwxr-xr-x 1 root root    4055 2025-10-27 14:11 pod2html
-rwxr-xr-x 1 root root   19823 2025-10-27 14:11 pod2man
-rwxr-xr-x 1 root root   13120 2025-10-27 14:11 pod2text
-rwxr-xr-x 1 root root    4067 2025-10-27 14:11 pod2usage
-rwxr-xr-x 1 root root    3737 2025-10-27 14:11 podchecker
-rwxr-xr-x 1 root root   13691 2025-10-27 14:11 prove
-rwxr-xr-x 1 root root    3883 2025-10-27 14:11 ptar
-rwxr-xr-x 1 root root    2659 2025-10-27 14:11 ptardiff
-rwxr-xr-x 1 root root    4409 2025-10-27 14:11 ptargrep
-rwxr-xr-x 1 root root    9996 2025-10-27 14:11 shasum
-rwxr-xr-x 1 root root   19473 2025-10-27 14:11 splain
-rwxr-xr-x 1 root root    8075 2025-10-27 14:11 streamzip
-rwxr-xr-x 1 root root    5541 2025-10-27 14:11 xsubpp
-rwxr-xr-x 1 root root  236618 2025-10-27 14:11 zipdetails
ASUS_I006D:/ $ 


The perl binary is a dynamically linked executable but only for the standard Android OS libraries:

ASUS_I006D:/ $ file /system/usr/bin/perl5.43.3
/system/usr/bin/perl5.43.3: ELF shared object, 64-bit LSB arm64, dynamic (/system/bin/linker64), for Android 31, built by NDK r27d (13750724), not stripped
ASUS_I006D:/ $ 
ASUS_I006D:/ $ 
ASUS_I006D:/ $ ldd /system/usr/bin/perl5.43.3
	linux-vdso.so.1 => [vdso] (0x71e0c6d000)
	libc.so => /apex/com.android.runtime/lib64/bionic/libc.so (0x71dc103000)
	libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x71dc0d9000)
	libm.so => /apex/com.android.runtime/lib64/bionic/libm.so (0x71dc086000)
ASUS_I006D:/ $


There are wrapper scripts for the Perl executables in /system/bin:

ASUS_I006D:/ $ ls -l /system/bin | grep perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 cpan -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 instmodsh -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perl -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perl5.43.4 -> ./perl_wrapper
-rwxr-xr-x 1 root root      241 2025-10-27 09:00 perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perlbug -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perldoc -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perlivp -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 1970-03-10 15:20 perlthanks -> ./perl_wrapper
ASUS_I006D:/ $ 

The wrapper script uses the script

/system/bin/perl_env

to init the environment for Perl. 

The customize script creates the CPAN config file

/data/local/tmp/perl_home/.cpan/CPAN/MyConfig.pm

if it does not yet exist.

Using this config file cpan installs additional Perl modules in the directory

/data/local/tmp/perl_home/perl5



Notes


The environment variable HOME must contain the name of directory on a writable filesystem to use cpan.
The wrapper script used in this Magisk Module for all perl executables in /system/bin, /system/bin/perl_wrapper, sets the variable HOME to /data/local/tmp/perl_home if it is empty or contains "/"
(in the default config in adb shells in Android the variable HOME is "/")


To print the list of directories used for perl modules use the command

perl -e 'print join "\n", @INC'

e.g.:

ASUS_I006D:/ $  perl -e 'print join "\n", @INC'
/data/local/tmp/perl_home/lib/perl5
/system/usr/lib/perl5/5.43.3/aarch64-linux-android
/system/usr/lib/perl5/5.43.3
/system/usr/lib/perl5/site_perl/5.43.3/aarch64-linux-android
/system/usr/lib/perl5/site_perl/5.43.3
/system/usr/lib/perl5/5.43.3/aarch64-linux-android
/system/usr/lib/perl5/5.43.3
ASUS_I006D:/ $ 



To compile new Perl modules using this Magisk Module a C/C++ compiler and a wget binary must also be installed. Thie can be done by installing these Magisk Modules:

http://bnsmb.de/files/public/Android/clang19_19.0.0git-v1.2.2.zip
http://bnsmb.de/files/public/Android/wget2_2.1.0-v1.0.0.1.zip



The perl binaries and libraries were compiled on an ASUS Zenfone 8 running OmniROM 16 using the clang19 toolchain:

http://bnsmb.de/files/public/Android/tar_files/clang19_toolchain-v1.5.0_release_21.09.2025_.tar.gz
 
The directory structure in this Magisk Module with the perl file was created on a phone using an overlay mount created with the script

http://bnsmb.de/files/public/Android/create_overlay_mount.sh

(see here for the script documentation : http://bnsmb.de/android/Documentation_for_the_script_create_overlay_mount.sh.html)

The config files used to compile perl are in the directory ./source in the Magisk module, A log file from "make test" running as user "root" is also in the directory ./source


See the XDA post

https://xdaforums.com/t/guide-how-to-compile-perl-in-android-with-the-clang19-toolchain-on-the-phone.4765540/

or here

http://bnsmb.de/My_HowTos_for_Android.html#How_to_compile_Perl_in_Android_with_the_clang19_toolchain_on_the_phone

for instructions to compile Perl on the phone usin the clang19 toolchain


History
  28.10.2025 /bs
    initial release
 
