pyarmor
pyarmor copied to clipboard
Cannot obfuscate script for MacOS x86_64 with Super Mode on M1 Mac
I am having an issue when obfuscating a script, that can run on both Apple Silicon (M1) and Intel Macs. I am using the command below, trying to obfuscate with Super Mode turned on.
pyarmor obfuscate --advanced 2 --platform darwin.aarch64,darwin.x86_64 main.py
This is the output when I run the command.
INFO PyArmor Version 7.5.0
INFO Python 3.9.13
INFO Target platforms: ['darwin.aarch64', 'darwin.x86_64']
No available dynamic library for darwin.x86_64 with features ['8']
This is run on an M1 Mac running MacOS Monterrey. It should be noted when I run the same command on an older Intel Mac, on the same script, the obfuscation works fine and uses feature 11. However, when I run this on a M1 Mac, the error above arises.
From the 'Support Platforms' page here, https://pyarmor.readthedocs.io/en/latest/platforms.html, the docs state that Super Mode works on both Darwin.aarch64 & Darwin.x86_64 for python 3.9 which is what I am using.
So how can I solve this error?
Try to swap platform name like this
pyarmor obfuscate --advanced 2 --platform darwin.x86_64,darwin.aarch64 main.py
Check the obfuscated script works or not.
If it doesn't work, please obfuscate the scripts for each platform, don't combine these 2 platforms.
Using this command still outputs the same error.
ERROR No available dynamic library for darwin.x86_64 with features ['8']
The weird part is if I do the same command on an Intel Mac, with same python version, it works. But it uses features [’11’], not features [‘8’]. Is there a way to specify the features?
Try this command
PYARMOR_PLATFORM=darwin.aarch64.3 pyarmor obfuscate --advanced 2 --platform darwin.x86_64,darwin.aarch64 main.py
This doesn't work
PYARMOR_PLATFORM=darwin.aarch64.3 pyarmor obfuscate --advanced 2 --platform darwin.x86_64,darwin.aarch64 main.py
The output is just the below, and nothing else happens. Gets stuck.
INFO PYARMOR_PLATFORM is darwin.aarch64.3
This command
PYARMOR_PLATFORM=darwin.aarch64.7 pyarmor obfuscate --advanced 2 --platform darwin.x86_64,darwin.aarch64 main.py
Returns the below
INFO PYARMOR_PLATFORM is darwin.aarch64.7
INFO Search library for platform: darwin.aarch64.7
ERROR Unsupport platform darwin.aarch64.7
ERROR No available library for this platform
It doesn't support --advanced 2
and combine these 2 platforms in Apple M1 & M2. Please obfuscate the scripts for each platform separately.