panda3d
panda3d copied to clipboard
Feature Request: Add arm64 support to the mac platform for bdist_apps
Description
At the moment, bdist_apps doesn't support arm64 for macOS. The change I want is simply put, arm64 support in platforms e.g.: macosx_11_0_arm64
Use Case
It would help when bundling apps to support Apple Silicon users.
I put this in my setup.py:
'platforms': ['macosx_11_0_arm64'],
And it built... something. I am unable to run it because I don't have access to macOS hardware at the moment, could someone let me know what happens then?
Ill do some testing with the newer commits since this issue when I can
I'm still getting a problem with the freezetool when building for arm on my macbook m1 device
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/direct/dist/commands.py", line 550, in run
self.build_binaries(platform, build_dir, build_dir)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/direct/dist/commands.py", line 1036, in build_binaries
create_runtime(platform, appname, scriptname, True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/direct/dist/commands.py", line 1001, in create_runtime
freezer.generateRuntimeFromStub(target_path, stub_file, use_console, {
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/direct/dist/FreezeTool.py", line 1882, in generateRuntimeFromStub
load_commands = self._parse_macho_load_commands(stub_data)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/direct/dist/FreezeTool.py", line 2270, in _parse_macho_load_commands
lc = struct.unpack_from(lc_header_layout, macho_data, curr_lc_offset)
struct.error: unpack_from requires a buffer of at least 4194600 bytes for unpacking 8 bytes at offset 4194592 (actual buffer size is 134648)
You didn't mention you were building from the ios branch. That explains a lot.
As-is, the produced builds don't work because of the lack of code signature, and code signing doesn't work because Apple no longer allows us to append data to the binary. This was addressed on the ios branch by @treamology, and we should probably get those changes merged in for 1.11, but we need to look at why they aren't working for desktop arm64.
I dont recall using the ios branch for my setup 🤔
Sorry, I'm mixed up. I see that we picked some changes from the ios branch onto master. I have been testing on release/1.10.x branch. I need to rerun my tests on the master branch.
I've had a quick look into this using the asteroids sample on my M1 Pro MacBook Pro.
For Universal binaries, it doesn't look like we create a custom section yet. Shown by the comment here https://github.com/panda3d/panda3d/blob/master/direct/src/dist/FreezeTool.py#L1898
Building for Universal (1.10.13 using PIP) on a Universal (1.10.13 using PIP) wheel compiles and building for ARM64 with an ARM64 wheel compiles.
The issue seems to be when you mix-and-match and ARM64 install with a Universal build and vice versa.
In both cases where I managed to build the sample, attempting to run the resulting .app results in it immediately crashing with the following (I have not manually code signed the .app):
Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes: UNKNOWN_0x32 at 0x000000010238c000
Exception Codes: 0x0000000000000032, 0x000000010238c000
Termination Reason: Namespace CODESIGNING, Code 2 Invalid Page
VM Region Info: 0x10238c000 is in 0x10238c000-0x102390000; bytes after start: 0 bytes before end: 16383
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
__DATA_CONST 102388000-10238c000 [ 16K] rw-/rw- SM=COW ...cOS/asteroids
---> __DATA 10238c000-102390000 [ 16K] rw-/rw- SM=COW ...cOS/asteroids
__LINKEDIT 102390000-102394000 [ 16K] r--/r-- SM=COW ...cOS/asteroids