[GH-ISSUE #411] SignTools-CI insert_dylib is not built with Apple Silicon support #101

Open
opened 2026-03-04 00:23:54 +03:00 by kerem · 1 comment
Owner

Originally created by @TJWeiten on GitHub (Mar 24, 2024).
Original GitHub issue: https://github.com/SignTools/SignTools/issues/411

!! Please fill in this template, DO NOT ignore or delete it. !!

I tried basic troubleshooting first

Describe the bug

Pretty simple bug that would only impact folks like me who are self-hosting their builder with SignTools-Builder, but the included insert_dylib executable in the SignTools-CI repo is built for Intel processors and fails if run (as-is) on Apple Silicon.

Logs

Found tweaks, injecting...
Processing ca.jeffrey.apollo-improvedcustomapi_1.0.11_iphoneos-arm.deb
Injecting /var/folders/j2/4fygn1pd2f16byg_tydy43jm0000gn/T/tmp9ig0e6_l/Frameworks/ApolloImprovedCustomApi.dylib @executable_path/Frameworks/ApolloImprovedCustomApi.dylib
Traceback (most recent call last):
  File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 1271, in <module>
    run()
  File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 1212, in run
    inject_tweaks(temp_dir, tweaks_dir)
  File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 630, in inject_tweaks
    insert_dylib(app_bin, binary_fixed)
  File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 277, in insert_dylib
    return run_process("./insert_dylib", "--inplace", "--no-strip-codesig", str(path), str(binary))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 45, in run_process
    result = subprocess.run(cmd, capture_output=capture, check=check, env=env, cwd=cwd, timeout=timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: './insert_dylib'
Cleaning up...

Resolution

Up to you how you want to handle this, but I went and rebuilt insert_dylib from source into a universal binary that should support Apple Silicon and Intel Macs. After replacing the default binary with my rebuilt one, I had no problem signing with my injected deb on my self-hosted builder on an M2 Mac.

However, I did not test that it would still work with GitHub Actions or Semaphore, which is obviously the much more common setup.

System configuration

  • SignTools version: 3.0.1
  • Builder type: SignTools-Builder
  • Builder version: 1.1.12; 13250eb
Originally created by @TJWeiten on GitHub (Mar 24, 2024). Original GitHub issue: https://github.com/SignTools/SignTools/issues/411 !! Please fill in this template, DO NOT ignore or delete it. !! **I tried basic troubleshooting first** - [X] Updated **both** [SignTools](https://github.com/SignTools/SignTools) **and** the builder ([SignTools-CI](https://github.com/SignTools/SignTools-CI) or [SignTools-Builder](https://github.com/SignTools/SignTools-Builder)) to the latest version - [X] Read through the [FAQ page](https://github.com/SignTools/SignTools/blob/master/FAQ.md) **Describe the bug** Pretty simple bug that would only impact folks like me who are self-hosting their builder with SignTools-Builder, but the included `insert_dylib` executable in the [SignTools-CI repo](https://github.com/SignTools/SignTools-CI) is built for Intel processors and fails if run (as-is) on Apple Silicon. **Logs** ``` Found tweaks, injecting... Processing ca.jeffrey.apollo-improvedcustomapi_1.0.11_iphoneos-arm.deb Injecting /var/folders/j2/4fygn1pd2f16byg_tydy43jm0000gn/T/tmp9ig0e6_l/Frameworks/ApolloImprovedCustomApi.dylib @executable_path/Frameworks/ApolloImprovedCustomApi.dylib Traceback (most recent call last): File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 1271, in <module> run() File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 1212, in run inject_tweaks(temp_dir, tweaks_dir) File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 630, in inject_tweaks insert_dylib(app_bin, binary_fixed) File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 277, in insert_dylib return run_process("./insert_dylib", "--inplace", "--no-strip-codesig", str(path), str(binary)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/signtools-builder/ios-signer2337820949/sign.py", line 45, in run_process result = subprocess.run(cmd, capture_output=capture, check=check, env=env, cwd=cwd, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1953, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 86] Bad CPU type in executable: './insert_dylib' Cleaning up... ``` **Resolution** Up to you how you want to handle this, but I went and rebuilt [insert_dylib](https://github.com/tyilo/insert_dylib) from source into a universal binary that should support Apple Silicon and Intel Macs. After replacing the default binary with my rebuilt one, I had no problem signing with my injected deb on my self-hosted builder on an M2 Mac. However, I did not test that it would still work with GitHub Actions or Semaphore, which is obviously the much more common setup. **System configuration** - SignTools version: 3.0.1 - Builder type: SignTools-Builder - Builder version: 1.1.12; 13250eb
Author
Owner

@ViRb3 commented on GitHub (Mar 24, 2024):

I've switched Github Actions to use a M1 runner, so it definitely works. Just needs Rosetta installed for emulation, which you appear to be missing. Good suggestion though, can add a universal binary.

<!-- gh-comment-id:2016930328 --> @ViRb3 commented on GitHub (Mar 24, 2024): I've switched Github Actions to use a M1 runner, so it definitely works. Just needs Rosetta installed for emulation, which you appear to be missing. Good suggestion though, can add a universal binary.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SignTools#101
No description provided.