NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.09k stars 14.08k forks source link

keepassxc 2.6.6 doesn't build on darwin #172165

Closed turion closed 1 year ago

turion commented 2 years ago

See Hydra failure:

https://hydra.nixos.org/build/175226618

[ 26%] Building CXX object src/CMakeFiles/keepassx_core.dir/gui/styles/base/BaseStyle.cpp.o
/tmp/nix-build-keepassxc-2.6.6.drv-0/source/src/gui/styles/base/BaseStyle.cpp:295:84: error: no member named 'MacOSBigSur' in 'QOperatingSystemVersion'
                if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur) {
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~^
/tmp/nix-build-keepassxc-2.6.6.drv-0/source/src/gui/styles/base/BaseStyle.cpp:302:84: error: no member named 'MacOSBigSur' in 'QOperatingSystemVersion'
                if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur) {
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~^
2 errors generated.
make[2]: *** [src/CMakeFiles/keepassx_core.dir/build.make:1182: src/CMakeFiles/keepassx_core.dir/gui/styles/base/BaseStyle.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:620: src/CMakeFiles/keepassx_core.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
builder for '/nix/store/lxz5mh63aqj2h8kkhf5s6n29jfzv7mhi-keepassxc-2.6.6.drv' failed with exit code 2

I could not find anything directly keepassxc-related in the changes on hydra from last successful to first failing build.

CC @jonafato @NixOS/darwin-maintainers

Also relevant: Version bump to 2.7: https://github.com/NixOS/nixpkgs/pull/166010 A fix for this issue might give a merge conflict there in the worst case, or alleviate the build problems there in the best case.

toonn commented 2 years ago

Does keepassxc depend on Qt? We're stuck on an older Qt because of the SDK version for x86_64-darwin. I think keepassxc may require a newer SDK.

turion commented 2 years ago

https://github.com/keepassxreboot/keepassxc/blob/develop/INSTALL.md mentions QT >= 5.9.5.

viraptor commented 2 years ago

Current version builds just fine. There's one test failure instead:

********* Start testing of TestAutoType *********
Config: Using QtTest library 5.14.2, Qt 5.14.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 11.1.0 )
PASS   : TestAutoType::initTestCase()
PASS   : TestAutoType::testInternal()
QFATAL : TestAutoType::testSingleAutoType() QWidget: Cannot create a QWidget without QApplication
FAIL!  : TestAutoType::testSingleAutoType() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted, 38ms
********* Finished testing of TestAutoType *********

I'll see if that's fixable...

viraptor commented 2 years ago

Another issue though is that /nix/store/rnhmylhfsznm02w7aprq2l7263i9l1av-keepassxc-2.7.1/Applications/KeePassXC.app/Contents/PlugIns/libkeepassxc-autotype-cocoa.so somehow became wrapped so can't be loaded anymore.

Unable to load auto-type plugin:
'/nix/store/rnhmylhfsznm02w7aprq2l7263i9l1av-keepassxc-2.7.1/Applications/KeePassXC.app/Contents/PlugIns/libkeepassxc-autotype-cocoa.so' is not a valid Mach-O binary (invalid magic 2321202f)
$ head -n2 /nix/store/rnhmylhfsznm02w7aprq2l7263i9l1av-keepassxc-2.7.1/Applications/KeePassXC.app/Contents/PlugIns/libkeepassxc-autotype-cocoa.so
#! /nix/store/fn6kkg71q3wb6px5n3b89z14rhvii1xn-bash-5.1-p16/bin/bash -e
QT_PLUGIN_PATH=${QT_PLUGIN_PATH:+':'$QT_PLUGIN_PATH':'}

Which may be related to the test failure...

Either way, after trying to run the app, the gui just spins with 100% CPU. The cli part works just fine though.

bouk commented 1 year ago

@viraptor I came across this issue because I was investigating something else, this is because of the wrap qt apps hook which wraps all the executable files, even if it's a dynamic library. This can be fixed by removing the executable flag from the library.

You might be able to resolve it with something like:

preFixup = ''
  chmod -x $out/Applications/KeePassXC.app/Contents/PlugIns/*.so
''

In the derivation. This should be fixed in the fixup script however