keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
20.16k stars 1.42k forks source link

Vanilla build for current version produces non-starting app #10163

Closed thommw closed 6 months ago

thommw commented 6 months ago

Overview

I am trying to build on an M1 Mac Mini. I have installed all the prerequisites and sign with my developer certificate. The build and signing runs without any errors. I am building version 2.7.6. When I try to start the app, I get an error dialog: "The Application "KeePassXC" can't be opened.".

Steps to Reproduce

  1. clone repository
  2. install prerequisites
  3. ./release-tool build --version 2.7.6 --appsign -k 737293D5FFF96FFB7D938761CF74AC7EAD3CBXXXX

Expected Behavior

Should start

Actual Behavior

Doesn't start

Context

17:13:51 ~/Projects/keepassxc tags/latest $ ./release-tool build --version 2.7.6 --appsign -k 737293D5FFF96FFB7D938761CF74AC7EAD3CB71C
KeePassXC Release Preparation Helper
Copyright (C) 2021 KeePassXC Team <https://keepassxc.org/>

[ INFO ] Checking out release tag '2.7.6'...
[ INFO ] Creating output directory...
[ INFO ] Creating source tarball...
[ INFO ] Creating build directory...
[ INFO ] Configuring sources...
[ INFO ] Configuring build...
-- The C compiler identification is AppleClang 15.0.0.15000100
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Biometry compiler support: TRUE
-- Touch ID compiler support: TRUE
-- Apple watch compiler support: TRUE
-- Found Git HEAD Revision: dd21def

-- Setting up build for KeePassXC v2.7.6

-- Found Botan: /opt/local/lib/libbotan-2.dylib (found version "2.19.3") 
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
-- Performing Test CC_HAS_Werror_format_security
-- Performing Test CC_HAS_Werror_format_security - Success
-- Performing Test CXX_HAS_Werror_format_security
-- Performing Test CXX_HAS_Werror_format_security - Success
-- Performing Test CC_HAS_Werror_implicit_function_declaration
-- Performing Test CC_HAS_Werror_implicit_function_declaration - Success
-- Performing Test CC_HAS_Wcast_align
-- Performing Test CC_HAS_Wcast_align - Success
-- Performing Test CXX_HAS_Wcast_align
-- Performing Test CXX_HAS_Wcast_align - Success
-- Performing Test CXX_HAS_fsized_deallocation
-- Performing Test CXX_HAS_fsized_deallocation - Success
-- Performing Test HAVE_DEALLOCATION_FUNCTIONS
-- Performing Test HAVE_DEALLOCATION_FUNCTIONS - Success
-- Using macdeployqt: /opt/homebrew/Cellar/qt@5/5.15.12/bin/macdeployqt
-- Found ZLIB: /opt/local/lib/libz.dylib (found version "1.3.#define ZLIB_VERSION "1.3"") 
-- Checking for module 'libpcsclite'
--   No package 'libpcsclite' found
-- Found PCSC: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/PCSC.framework  
-- Performing Test HAVE_PR_SET_DUMPABLE
-- Performing Test HAVE_PR_SET_DUMPABLE - Failed
-- Performing Test HAVE_MALLOC_H
-- Performing Test HAVE_MALLOC_H - Failed
-- Performing Test HAVE_MALLOC_USABLE_SIZE
-- Performing Test HAVE_MALLOC_USABLE_SIZE - Failed
-- Performing Test HAVE_RLIMIT_CORE
-- Performing Test HAVE_RLIMIT_CORE - Success
-- Performing Test HAVE_PT_DENY_ATTACH
-- Performing Test HAVE_PT_DENY_ATTACH - Success
-- Found Readline: /opt/local/include  
-- Found QREncode: /opt/homebrew/lib/libqrencode.dylib  
-- Found Minizip: /opt/homebrew/lib/libminizip.dylib  
-- Including translations...

-- Using asciidoctor: /opt/homebrew/bin/asciidoctor
-- Enabled features:
 * Auto-Type, Automatic password typing
 * Networking, Compile KeePassXC with network access code (e.g. for downloading website icons)
 * KeePassXC-Browser, Browser integration with KeePassXC-Browser
 * SSHAgent, SSH agent integration compatible with KeeAgent
 * KeeShare, Sharing integration with KeeShare
 * YubiKey, YubiKey HMAC-SHA1 challenge-response
 * UpdateCheck, Automatic update checking

-- Disabled features:

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/thomas/Projects/keepassxc/release/build-release
[ INFO ] Compiling and packaging sources...

...

.........................................................................................................................................................
created: /tmp/KeePassXC_28712/KeePassXC-2.7.6.dmg
[ INFO ] File './KeePassXC-2.7.6.dmg' successfully signed.
[ INFO ] All done!
[ INFO ] Checking out original branch...
[ INFO ] Leaving source directory...
[ INFO ] All done!
17:26:27 ~/Projects/keepassxc tags/latest $ ./KeePassXC.app/Contents/MacOS/keepassxc-cli --debug-info
KeePassXC - Version 2.7.6
Revision: dd21def

Qt 5.15.12
Debugging mode is disabled.

Operating system: macOS 14.1
CPU architecture: arm64
Kernel: darwin 23.1.0

Enabled extensions:
- Auto-Type
- Browser Integration
- SSH Agent
- KeeShare
- YubiKey
- Quick Unlock

Cryptographic libraries:
- Botan 2.19.3

17:26:33 ~/Projects/keepassxc tags/latest $ open KeePassXC.app 
The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600002bc4120 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}

This is from launchd.log:

2024-01-08 17:30:34.428898 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: internal event: WILL_SPAWN, code = 0
2024-01-08 17:30:34.428909 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: service state: spawn scheduled
2024-01-08 17:30:34.428911 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: service state: spawning
2024-01-08 17:30:34.428925 <Notice>: Coalition Cache Hit: app<application.org.keepassxc.keepassxc.49579897.49580101(501)> [2978]
2024-01-08 17:30:34.428948 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: launching: launch job demand
2024-01-08 17:30:34.429441 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: xpcproxy spawned with pid 11733
2024-01-08 17:30:34.429456 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: internal event: SPAWNED, code = 0
2024-01-08 17:30:34.429460 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: service state: xpcproxy
2024-01-08 17:30:34.429486 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: internal event: SOURCE_ATTACH, code = 0
2024-01-08 17:30:34.446708 (system/com.apple.ManagedClient) <Notice>: internal event: WILL_SPAWN, code = 0
2024-01-08 17:30:34.446732 (system/com.apple.ManagedClient) <Notice>: service state: spawn scheduled
2024-01-08 17:30:34.446738 (system/com.apple.ManagedClient) <Notice>: service state: spawning
2024-01-08 17:30:34.446762 (system/com.apple.ManagedClient) <Notice>: launching: ipc (mach)
2024-01-08 17:30:34.447639 (system/com.apple.ManagedClient [11734]) <Notice>: xpcproxy spawned with pid 11734
2024-01-08 17:30:34.447665 (system/com.apple.ManagedClient [11734]) <Notice>: internal event: SPAWNED, code = 0
2024-01-08 17:30:34.447673 (system/com.apple.ManagedClient [11734]) <Notice>: service state: xpcproxy
2024-01-08 17:30:34.447690 (system/com.apple.ManagedClient [11734]) <Notice>: internal event: SOURCE_ATTACH, code = 0
2024-01-08 17:30:34.454228 (system/com.apple.ManagedClient [11734]) <Notice>: service state: running
2024-01-08 17:30:34.454245 (system/com.apple.ManagedClient [11734]) <Notice>: internal event: INIT, code = 0
2024-01-08 17:30:34.454281 (system/com.apple.ManagedClient [11734]) <Notice>: Successfully spawned ManagedClient[11734] because ipc (mach)
2024-01-08 17:30:34.462721 (pid/11734 [ManagedClient]) <Notice>: uncorking exec source upfront
2024-01-08 17:30:34.462751 (pid/11734 [ManagedClient]) <Notice>: created
2024-01-08 17:30:34.507313 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: xpcproxy exited due to OS_REASON_EXEC
2024-01-08 17:30:34.507341 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: exited with exit reason (namespace: 9 code: 0x8) - OS_REASON_EXEC
2024-01-08 17:30:34.507346 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: internal event: INIT, code = 153
2024-01-08 17:30:34.507355 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: job state = spawn failed
2024-01-08 17:30:34.507401 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: service state: exited
2024-01-08 17:30:34.507410 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: internal event: EXITED, code = 0
2024-01-08 17:30:34.507414 (gui/501 [100019]) <Notice>: service inactive: application.org.keepassxc.keepassxc.49579897.49580101
2024-01-08 17:30:34.507418 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101 [11733]) <Notice>: service state: not running
2024-01-08 17:30:34.507725 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: removing job: caller = runningboardd
2024-01-08 17:30:34.507735 (gui/501 [100019]) <Notice>: removing service: application.org.keepassxc.keepassxc.49579897.49580101
2024-01-08 17:30:34.507744 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: internal event: PETRIFIED, code = 0
2024-01-08 17:30:34.507747 (gui/501/application.org.keepassxc.keepassxc.49579897.49580101) <Notice>: job state = removed

Operating System: macOS Desktop Env: Windowing System:

droidmonkey commented 6 months ago

Does it run if you don't sign the application? You might have to launch manually from the gui to authorize running the app. This isn't an error on our side. Come back with more info, and we can reopen if necessary m.

thommw commented 6 months ago

Thanks for the quick reply. I am trying to compile it myself so I can compile it without networking. If I don't sign it, it crashes with a code signing error. I tried launching it by double-clicking, from the context menu and from the command line. I thought you might have seen this before. As an alternative, would it be possible to provide binaries without the networking? Thanks for all the work you do!

phoerious commented 6 months ago

Don't use the release-tool for building your own version, use the build instructions from the wiki instead.

If you want to use the release tool, you need and Apple Developer ID and should build and appsign in two steps.

thommw commented 6 months ago

Ok, I will try the manual build instructions. I am an Apple developer and have all the keys I need. I'll keep banging my head against this wall for a bit longer. :)

droidmonkey commented 6 months ago

Wait I think I see what's up, you built a full app and packaged in dmg then signed that, but then you tried to run the original app outside the dmg. You need to use the dmg to "install" the app to your Applications folder.

thommw commented 6 months ago

Ok, I got it working by doing the manual build and signing the app with:

codesign -vf --deep --sign YOURKEYHERE KeePassXC.app

Thanks for trying to help!