Open dolmen opened 4 months ago
As a workaround I tried running perl.com
using Rosetta (system emulator for running x86_64 binaries on arm64):
$ arch -x86_64 ./perl.com -E 'say "Hello!"'
arch: ./perl.com isn't executable
$ arch -x86_64 sh ./perl.com -E 'say "Hello!"'
chmod: /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10.6949: No such file or directory
mv: rename /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10.6949 to /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10: No such file or directory
./perl.com: line 19: /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10: No such file or directory
./perl.com: line 19: exec: /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10: cannot execute: No such file or directory
$ arch -x86_64 sh ./perl.com -E 'say "Hello!"'
ape error: : not found (maybe chmod +x or ./ needed)
$ ls -la $TMPDIR/.ape*
-rwxr-xr-x 1 omengue staff 12288 5 jui 15:19 /var/folders/7b/5rfj3bgs3tj34c6f2jy8h39w0000gn/T//.ape-1.10
$ chmod u+x perl.com
$ arch -x86_64 ./perl.com -E 'say "Hello!"'
Hello!
$ arch -x86_64 ./perl.com -E 'say "Hello $^O!"'
Hello cosmo!
Note: the requirement of chmod u+x
is already documented.
Agreed, it would be cool! I'd like to add this, but it will be at least a couple months before I can dig into this and I do not have any arm64 hardware handy.
If you'd like to experiment with it, inside of share/5.36-cosmo3.patch
change $COSMOCC/bin/x86_64-unknown-cosmo-cc
to $COSMOCC/bin/aarch64-unknown-cosmo-cc
and in lib/Perl/Dist/APPerl.pm
replace x86_64
with aarch64
and see if that gets you an arm64 apperl build. Once that works we can try making a dual arch fat binary build with Cosmopolitan's apelink
.
It would be cool if APPerl could also work on current Macs with Apple Silicon chips.