AppFlowy-IO / AppFlowy

Bring projects, wikis, and teams together with AI. AppFlowy is an AI collaborative workspace where you achieve more without losing control of your data. The best open source alternative to Notion.
https://www.appflowy.io
GNU Affero General Public License v3.0
58.15k stars 3.83k forks source link

[Bug] Building MacOS app in release on Apple Silicon crashes on startup #5884

Open notandyvee opened 3 months ago

notandyvee commented 3 months ago

Bug Description

Building the MacOS app from source in debug mode works following the doc instructions. Using

Running: cargo make --profile production-mac-arm64 appflowy in the frontend directory builds fine. But then crashes on startup. Reason below from the system console.

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/HotKey.framework/Versions/A/HotKey
Referenced from: <> /Users/USER/Documents/*/AppFlowy.app/Contents/MacOS/AppFlowy
Reason: tried: '/usr/lib/swift/HotKey.framework/Versions/A/HotKey' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/HotKey.framework/Versions/A/HotKey' (no such file), '/Users/avaldez/Documents/code/AppFlowy/frontend/appflowy_flutter/build/macos/Build/Products/Release/AppFlowy.app/Contents/Frameworks/HotKey.framework/Versions/A/HotKey' (code signature in <> '/Users/avaldez/Documents/code/AppFlowy/frontend/appflowy_flutter/build/macos/Build/Products/Release/AppFlowy.app/Contents/Frameworks/HotKey.framework/Versions/A/HotKey' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/Users/avaldez/Documents/code/AppFlowy/frontend/appflowy
(terminated at launch; ignore backtrace)

The key issue I think is:

'/Users/avaldez/Documents/code/AppFlowy/frontend/appflowy_flutter/build/macos/Build/Products/Release/AppFlowy.app/Contents/Frameworks/HotKey.framework/Versions/A/HotKey' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)

The issue appears to be how the HotKey library is built. I know flutter, but apple development isn't my core competency. But from what I am understanding, the library must be signed properly, or signed locally. The problem is when I attempt to use my own signature it just resets everything. Presumably due to the rust tooling. Just a guess.

Preferably I'd like an option where I can build in release with my own certificate without allowing libraries that aren't signed to run.

How to Reproduce

Expected Behavior

Not crashing

Operating System

Mac OS Sonoma - M2 Max

AppFlowy Version(s)

0.6.7

Screenshots

The screenshot below shows how I get past the issue. But disabling validation sounds bad.

Screenshot 2024-08-06 at 12 29 23 AM

Additional Context

No response

WangLaoShi commented 3 months ago

Any update about this issue? I got the same problem , But When I open the XCode project (From Path appflowy_flutter/build/macos/Build/Products/Release),and using the Runner in the XCode, The app opens up and runs well.

Any help?