Bitcoin-Core

在 Mac 上安裝時出錯 - Build 不支持 Berkeley DB 數據庫格式

  • November 28, 2022

我按照此處的指南 ( https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md ) 在我的 Mac 上安裝比特幣。我希望能夠在有和沒有 GUI 的情況下執行 bitcoind。

第一次閱讀本指南時,我沒有安裝 berkeley-db@4,並使用了配置:

./autogen.sh
./configure --without-bdb --with-gui=yes

但是,當我執行make然後./src/bitcoind失敗時,我收到消息:

2022-11-27T16:20:32Z Bitcoin Core version v24.99.0-9c47eb450346 (release build)
2022-11-27T16:20:32Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2022-11-27T16:20:32Z Using RdSeed as an additional entropy source
2022-11-27T16:20:32Z Using RdRand as an additional entropy source
2022-11-27T16:20:32Z Default data directory /Users/me/Library/Application Support/Bitcoin
2022-11-27T16:20:32Z Using data directory /Users/me/Library/Application Support/Bitcoin
2022-11-27T16:20:32Z Config file: /Users/me/Library/Application Support/Bitcoin/bitcoin.conf (not found, skipping)
2022-11-27T16:20:32Z Setting file arg: prune = "1907"
2022-11-27T16:20:32Z Setting file arg: wallet = ["My Bitcoin Core Wallet"]
2022-11-27T16:20:32Z Using at most 125 automatic connections (285 file descriptors available)
2022-11-27T16:20:32Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
2022-11-27T16:20:32Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
2022-11-27T16:20:32Z Script verification uses 11 additional threads
2022-11-27T16:20:32Z scheduler thread start
2022-11-27T16:20:32Z Binding RPC on address ::1 port 8332
2022-11-27T16:20:32Z Binding RPC on address 127.0.0.1 port 8332
2022-11-27T16:20:32Z [http] creating work queue of depth 16
2022-11-27T16:20:32Z Using random cookie authentication.
2022-11-27T16:20:32Z Generated RPC authentication cookie /Users/me/Library/Application Support/Bitcoin/.cookie
2022-11-27T16:20:32Z [http] starting 4 worker threads
2022-11-27T16:20:32Z Using wallet directory /Users/me/Library/Application Support/Bitcoin/wallets
2022-11-27T16:20:32Z init message: Verifying wallet(s)…
2022-11-27T16:20:32Z Error: Failed to open database path '/Users/me/Library/Application Support/Bitcoin/wallets/My Bitcoin Core Wallet'. Build does not support Berkeley DB database format.
Error: Failed to open database path '/Users/me/Library/Application Support/Bitcoin/wallets/My Bitcoin Core Wallet'. Build does not support Berkeley DB database format.
2022-11-27T16:20:32Z Shutdown: In progress...
2022-11-27T16:20:32Z scheduler thread exit
2022-11-27T16:20:32Z Shutdown: done

錯誤是Error: Failed to open database path '/Users/me/Library/Application Support/Bitcoin/wallets/My Bitcoin Core Wallet'. Build does not support Berkeley DB database format

所以我回去安裝了 berkley brew install berkeley-db@4。然後我又跑了:

./autogen.sh
./configure --without-bdb --with-gui=yes

接著:

make

但是當我執行時,./src/bitcoind我仍然會遇到上面相同的錯誤。我究竟做錯了什麼?

這是通過安裝沒有--without-bdb標誌的比特幣核心解決的。Bitcoin Core 錢包過去使用 BerkeleyDB(如果你今天設置一個錢包,它將預設使用 SQLite)所以如果你過去設置一個 Bitcoin Core 錢包,那麼 Bitcoin Core 將嘗試訪問該錢包,但它不能如果未配置 BerkeleyDB。

migratewallet 為避免將來出現此問題,您可以使用RPC將 BerkeleyDB、非描述符比特幣核心錢包遷移到 SQLite、描述符比特幣核心錢包。

引用自:https://bitcoin.stackexchange.com/questions/116149