2019-07-09

KeePassXCの「ブラウザー統合」は有効に出来そうだけど、ビルド失敗

dynabook SS SX/15AにNetBSDを入れて利用しています。パスワード管理にKeePassXCを使おうと思いましたが、pkgsrcからビルドされるバイナリには拡張機能「ブラウザー統合」が有効になっていないことが分かりました。

この問題を解決するために、pkgsrcの枠組みに沿って変更するためには、どのようにするのが正しい方法なのか不明です。それは追々調べるとして、まずは「ブラウザー統合」を有効にしたバイナリをビルドしてみようと思います。

まずsecurity/keepassxc/Makefileを以下のように変更してみました。またlibsodiumが必要になるようなので、依存関係の定義を追加しました。libsodiumのパッケージ自体も入れておきます。
--- Makefile.org        2019-03-23 00:56:41.000000000 +0900
+++ Makefile    2019-07-09 20:05:49.976935366 +0900
@@ -18,7 +18,7 @@
 USE_CMAKE=     yes
 USE_LANGUAGES= c c++
 CMAKE_ARG_PATH=        ..
-CMAKE_ARGS+=   -DKEEPASSXC_BUILD_TYPE=Release
+CMAKE_ARGS+=   -DKEEPASSXC_BUILD_TYPE=Release -DWITH_XC_BROWSER=ON -DWITH_XC_NETWORKING=ON
 CONFIGURE_DIRS=        build

 NOT_PAX_MPROTECT_SAFE+=        bin/keepassxc
@@ -36,6 +36,7 @@
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../graphics/hicolor-icon-theme/buildlink3.mk"
 .include "../../security/libgcrypt/buildlink3.mk"
+.include "../../security/libsodium/buildlink3.mk"
 .include "../../security/argon2/buildlink3.mk"
 .include "../../sysutils/desktop-file-utils/desktopdb.mk"
 .include "../../x11/qt5-qtbase/buildlink3.mk"

この状態でビルドさせてみると「ブラウザー統合」が有効になっていることが確認できます。
===> Configuring for keepassxc-2.4.0 keepassxc-2.4.0
*SNIP*
-- 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

-- Disabled features:
 * SSHAgent, SSH agent integration compatible with KeeAgent
 * KeeShare, Sharing integration with KeeShare
 * KeeShare-Secure, Sharing integration with KeeShare with secure sources
 * YubiKey, YubiKey HMAC-SHA1 challenge-response

-- Configuring done
-- Generating done
-- Build files have been written to: /usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/build

またlibsodiumなどの依存関係も大丈夫そうです。
=> Tool dependency glib2-tools-[0-9]*: found glib2-tools-2.60.3
=> Tool dependency cmake>=2.8.1nb1: found cmake-3.14.5
=> Build dependency x11-links>=1.13: found x11-links-1.15
=> Build dependency cwrappers>=20150314: found cwrappers-20180325
=> Full dependency qrencode>=4.0.2: found qrencode-4.0.2
=> Full dependency hicolor-icon-theme>=0.9nb1: found hicolor-icon-theme-0.17
=> Full dependency libgcrypt>=1.6.0: found libgcrypt-1.8.4
=> Full dependency libsodium>=0.3: found libsodium-1.0.17
=> Full dependency argon2>=20161029nb1: found argon2-20171227
=> Full dependency desktop-file-utils>=0.10nb1: found desktop-file-utils-0.23nb1
=> Full dependency qt5-qtbase>=5.11.2nb3: found qt5-qtbase-5.12.2nb1
=> Full dependency qt5-qtsvg>=5.11.2nb2: found qt5-qtsvg-5.12.2
=> Full dependency qt5-qttools>=5.11.2nb2: found qt5-qttools-5.12.2
=> Full dependency qt5-qtx11extras>=5.11.2nb2: found qt5-qtx11extras-5.12.2

これでビルド出来るかと思いきや、なにやらエラーが出てしまいました。
[  5%] Built target keepassxcbrowser_autogen
[  5%] Building CXX object src/browser/CMakeFiles/keepassxcbrowser.dir/NativeMessagingBase.cpp.o
In file included from /usr/include/stddef.h:37:0,
                 from /usr/include/g++/cstddef:50,
                 from /usr/pkg/qt5/include/QtCore/qglobal.h:46,
                 from /usr/pkg/qt5/include/QtCore/qatomic.h:41,
                 from /usr/pkg/qt5/include/QtCore/QAtomicInteger:1,
                 from /usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/src/browser/NativeMessagingBase.h:22,
                 from /usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/src/browser/NativeMessagingBase.cpp:19:
/usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/src/browser/NativeMessagingBase.cpp: In member function 'void NativeMessagingBase::newNativeMessage()':
/usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/src/browser/NativeMessagingBase.cpp:65:5: error: invalid static_cast from type 'std::nullptr_t' to type 'intptr_t {aka int}'
     EV_SET(ev, fileno(stdin), EVFILT_READ, EV_ADD, 0, 0, nullptr);
     ^
*** Error code 1

Stop.
make[2]: stopped in /usr/pkgsrc/security/keepassxc/work/keepassxc-2.4.0/build
*** Error code 1

なかなか一筋縄ではいきません。この問題を解決する方法を探ってみます。

0 件のコメント:

コメントを投稿