1

After running 'autogen.sh', './configure' and then 'make', I keep getting the following error:

Undefined symbols for architecture x86_64: "__ZN5boost10filesystem4path5imbueERKSt6locale", referenced from: __Z16SetupEnvironmentv in libbitcoin_util.a(libbitcoin_util_a-system.o) ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make[2]: *** [bitcoind] Error 1 make[1]: *** [check-recursive] Error 1 make: *** [check-recursive] Error 1

I was told that boost is clang compiled and thus, GCC incompatible, so I've been trying to recompile boost with GCC via:

  1. HOMEBREW_CC=gcc-10 HOMEBREW_CXX=g++-10 brew install --build-from-source boost --HEAD
  2. `brew install boost --build-from-source --HEAD'

Both of these commands throw the following patching error though:

==> Patching ==> Applying 7b3fc734242eea9af734d6cd8ccb3d8f6b64c5b2.patch patching file boost-install.jam Hunk #1 FAILED at 483. 1 out of 1 hunk FAILED -- saving rejects to file boost-install.jam.rej

Any idea how to fix this problem and successfully recompile boost? Please let me know!

EDIT: For clarification, I'm trying to build Bitcoin Core v0.21.0 on macOS Catalina version 10.15.7

UPDATE: Finally got this working - turned out I had an outdated version of gcc installed via MacPorts, in addition to Apple's default compiler, which seemed to have been interfering with things. Once I uninstalled MacPorts, everything started working smoothly if I configured with --with-gui=no

10
  • Provide more details: What is your OS ? Which version ? Are you cross-compiling ? If yes, on which system? For which system ? Mar 16, 2021 at 16:40
  • @Gladiator9120 Thanks for the reply - I'm running on macOS Catalina version 10.15.7, and I'm compiling with gcc-10, don't believe I'm cross-compiling but I'm new to this so I may be wrong. If it helps, I've been configuring bitcoin-core with this command: ./configure CXX=g++-10 CPP=cpp-10 CC=gcc-10 Mar 16, 2021 at 16:46
  • Alternatively you could do make in the depends folder in core then configure again this would compile the dependencies. I cant get brew's boost to compile with gcc either.
    – MCCCS
    Mar 16, 2021 at 17:48
  • Appreciate you trying! And I'll try that now - do I still run ./configure CXX=g++-10 CC=gcc-10 before running make in the depends folder? Mar 16, 2021 at 18:25
  • And do I need a --prefix= arg when I configure again? Mar 16, 2021 at 18:26

1 Answer 1

0

I just had this problem happen... On Mac OS 12.4, I installed boost with homebrew, and it was installed to /opt/homebrew/Cellar/boost/1.82.0_1

When I ran ./configure I got:

checking whether the Boost::System library is available... no
checking whether the Boost::Filesystem library is available... no
checking whether the Boost::Program_Options library is available... no
checking whether the Boost::Thread library is available... no
checking whether the Boost::Chrono library is available... no
checking whether the Boost::Unit_Test_Framework library is available... no
checking for dynamic linked boost test... no
checking for mismatched boost c++11 scoped enums... ok
configure: error: No working boost sleep implementation found.

So I added the with-boost flag with that path: ./configure --with-boost=/opt/homebrew/Cellar/boost/1.82.0_1

And then it worked. But running make failed for various reasons such as missing import statements, std::placeholder conflicting with boost::placeholder and other reasons... So I had to make the following changes:

diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index e1763c6ad..66390c4e3 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <deque>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <signal.h>
diff --git a/src/miner.h b/src/miner.h
index 3ba92b16b..993bde682 100644
--- a/src/miner.h
+++ b/src/miner.h
@@ -73,7 +73,7 @@ struct modifiedentry_iter {
 // except operating on CTxMemPoolModifiedEntry.
 // TODO: refactor to avoid duplication of this logic.
 struct CompareModifiedEntry {
-    bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b)
+    bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) const
     {
         double f1 = (double)a.nModFeesWithAncestors * b.nSizeWithAncestors;
         double f2 = (double)b.nModFeesWithAncestors * a.nSizeWithAncestors;
@@ -88,7 +88,7 @@ struct CompareModifiedEntry {
 // This is sufficient to sort an ancestor package in an order that is valid
 // to appear in a block.
 struct CompareTxIterByAncestorCount {
-    bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b)
+    bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
     {
         if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
             return a->GetCountWithAncestors() < b->GetCountWithAncestors();
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 3ec1a1c27..54a6c5f36 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -31,6 +31,7 @@
 #include "validationinterface.h"
 
 #include <boost/thread.hpp>
+#include <array>
 
 #if defined(NDEBUG)
 # error "Bitcoin cannot be compiled without assertions."
diff --git a/src/test/cuckoocache_tests.cpp b/src/test/cuckoocache_tests.cpp
index 00446aa11..29bc0acc7 100644
--- a/src/test/cuckoocache_tests.cpp
+++ b/src/test/cuckoocache_tests.cpp
@@ -7,6 +7,7 @@
 #include "random.h"
 #include <thread>
 #include <boost/thread.hpp>
+#include <deque>
 
 
 /** Test Suite for CuckooCache
diff --git a/src/txmempool.h b/src/txmempool.h
index db1a02455..05d68b645 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -229,7 +229,7 @@ struct mempoolentry_txid
 class CompareTxMemPoolEntryByDescendantScore
 {
 public:
-    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
     {
         bool fUseADescendants = UseDescendantScore(a);
         bool fUseBDescendants = UseDescendantScore(b);
@@ -251,7 +251,7 @@ public:
     }
 
     // Calculate which score to use for an entry (avoiding division).
-    bool UseDescendantScore(const CTxMemPoolEntry &a)
+    bool UseDescendantScore(const CTxMemPoolEntry &a) const
     {
         double f1 = (double)a.GetModifiedFee() * a.GetSizeWithDescendants();
         double f2 = (double)a.GetModFeesWithDescendants() * a.GetTxSize();
@@ -266,7 +266,7 @@ public:
 class CompareTxMemPoolEntryByScore
 {
 public:
-    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
     {
         double f1 = (double)a.GetModifiedFee() * b.GetTxSize();
         double f2 = (double)b.GetModifiedFee() * a.GetTxSize();
@@ -280,7 +280,7 @@ public:
 class CompareTxMemPoolEntryByEntryTime
 {
 public:
-    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
     {
         return a.GetTime() < b.GetTime();
     }
@@ -289,7 +289,7 @@ public:
 class CompareTxMemPoolEntryByAncestorFee
 {
 public:
-    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+    bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
     {
         double aFees = a.GetModFeesWithAncestors();
         double aSize = a.GetSizeWithAncestors();
@@ -656,7 +656,7 @@ public:
 
     /** Estimate priority needed to get into the next nBlocks */
     double estimatePriority(int nBlocks) const;
-    
+
     /** Write/Read estimates to disk */
     bool WriteFeeEstimates(CAutoFile& fileout) const;
     bool ReadFeeEstimates(CAutoFile& filein);
@@ -705,7 +705,7 @@ private:
     void removeUnchecked(txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
 };
 
-/** 
+/**
  * CCoinsView that brings transactions from a memorypool into view.
  * It does not check for spendings by memory pool transactions.
  */
diff --git a/src/validation.cpp b/src/validation.cpp
index fe8f8365b..6dcd1f0c4 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -170,6 +170,7 @@ private:
 
 public:
     MemPoolConflictRemovalTracker(CTxMemPool &_pool) : pool(_pool) {
+        using namespace boost::placeholders;
         pool.NotifyEntryRemoved.connect(boost::bind(&MemPoolConflictRemovalTracker::NotifyEntryRemoved, this, _1, _2));
     }
 
@@ -180,6 +181,7 @@ public:
     }
 
     ~MemPoolConflictRemovalTracker() {
+        using namespace boost::placeholders;
         pool.NotifyEntryRemoved.disconnect(boost::bind(&MemPoolConflictRemovalTracker::NotifyEntryRemoved, this, _1, _2));
         for (const auto& tx : conflictedTxs) {
             GetMainSignals().SyncTransaction(*tx, NULL, CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
index d4121a28b..3b89b1c2c 100644
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -12,6 +12,8 @@ CMainSignals& GetMainSignals()
     return g_signals;
 }
 
+using namespace boost::placeholders;
+
 void RegisterValidationInterface(CValidationInterface* pwalletIn) {
     g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1, _2, _3));
     g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2, _3));

and now I can run make and it works and built bitcoind and bitcoin-cli

4
  • The src/miner.h file doesn't exist anymore since Bitcoin Core v23.0; what version are you trying to compile? Jul 1, 2023 at 17:11
  • Also, CompareModifiedEntry doesn't exist anymore since 0.16.0, released in 2018. Jul 1, 2023 at 17:17
  • Wow, my git must have gotten into a weird state.. I was on master and had fetched / reset hard, but apparently had files from older commits, so I just deleted everything and re-cloned bitcoin and looks like most of those problems are resolved, except I am getting test/fuzz/http_request.cpp:12:10: fatal error: 'event2/buffer.h' file not found despite having libevent installed at /opt/homebrew/Cellar/libevent/2.1.12_1 ... Was not sure how to get around that other than to perhaps reconfigure with --disable-tests
    – patrick
    Jul 1, 2023 at 19:57
  • Sorry, I'm not familiar with MacOS building. Have you read the doc/build-osx.md file? Jul 1, 2023 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.