Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.86k stars 451 forks source link

Mac build fails to run after signing #8175

Closed qstokkink closed 1 month ago

qstokkink commented 1 month ago

Currently, our Mac build instantly exits when executing it:

Traceback (most recent call last):
  File "PyInstaller/loader/pyimod03_ctypes.py", line 53, in __init__
  File "ctypes/__init__.py", line 374, in __init__
OSError: dlopen(/usr/local/lib/libsodium.dylib, 0x0006): tried: '/usr/local/lib/libsodium.dylib' (code signature in <E66AE69B-7207-3EAA-B3E3-E8FAE32DE49E> '/usr/local/Cellar/libsodium/1.0.19/lib/libsodium.26.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/usr/local/Cellar/libsodium/1.0.19/lib/libsodium.26.dylib' (code signature in <E66AE69B-7207-3EAA-B3E3-E8FAE32DE49E> '/usr/local/Cellar/libsodium/1.0.19/lib/libsodium.26.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "run_tribler.py", line 19, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "tribler/core/session.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "ipv8/loader.py", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "ipv8/keyvault/crypto.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "ipv8/keyvault/private/libnaclkey.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "libnacl/__init__.py", line 87, in <module>
  File "libnacl/__init__.py", line 21, in _get_nacl
  File "ctypes/__init__.py", line 452, in LoadLibrary
  File "PyInstaller/loader/pyimod03_ctypes.py", line 55, in __init__
pyimod03_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll '/usr/local/lib/libsodium.dylib'. Most likely this dynlib/dll was not found when the application was frozen.
[92093] Failed to execute script 'run_tribler' due to unhandled exception!
logout
qstokkink commented 1 month ago

We could try adding an entitlement to disable library validation:

<key>com.apple.security.cs.disable-library-validation</key>
<true/>

Of course, it would be better to actually have a signed version of the library.

qstokkink commented 1 month ago

Alright, I made a branch and it successfully built. Tomorrow, I'll check if it actually runs.

qstokkink commented 1 month ago

😲 it actually works.