Hi!

I don't know exactly how the port system works.

I figured out exactly how to get BitcoinD latest to build, by manually patching the openbsd-wip bitcoind port, which is 2.5 years old.

I failed to actually get the port updated, on a stupid detail of the port Makefile though, it was something about the filenaming scheme the ports system will use for its build directory -

I am sure YOU know exactly how that works, in no time, so for this reason I'll describe exactly how to build BitcoinD 0.11.2 = latest on OpenBSD based on the port here, and you can incredibly quickly pull together the actual port for it.

Which the exact patches are and the exact configure arguments etc. are provided, and this is all a patch to the openbsd-wip bitcoind port already, so the hard work is already done.


Please let me know when you got it in place?

Thanks!!
Poweruser





A google search on this topic mentions http://www.thedrinkingrecord.com/2015/02/14/notes-on-building-bitcoin-qt-on-openbsd/ also.

Also this post should be followed up on when this port has been published: http://unix.stackexchange.com/questions/82858/compiling-bitcoind-on-openbsd

Some things are stated doubly below. In that case just read it as if was written once.


There is a previous BitcoinD package in openbsd-wip (version 0.9.1). It's 2.5 years old so it's completely antiquated.

Its sources are at https://github.com/jasperla/openbsd-wip/tree/master/net/bitcoin , and this is what my patch here is based on.

I used that one before, and to my experience it worked perfectly, except for when trying to use BitcoinD's HTTP RPC server - that crashed when even telnetting to the port I think.. or if it was when posting any request to it. That functionality is completely secondary though. I did not test that on this updated version, perhaps it works now.


My installation instructions are a modified version of the openbsd-wip package.

Take that bitcoin directory in the openbsd-wip package, and put it in your local /usr/ports/net/ directory.


The patch files need some updates. First, let's overview the 8 patch files individually, as some of these changed names, or disappeared, since 0.9.1:


* compat.h is now src/compat.h - attaching new version (applied exactly the same thing as in the old patch)

 * db.cpp - this file was moved to src/wallet/db.cpp .

* leveldb/port/port_posix.h is now src/leveldb/port/port_posix.h - applied same thinga sin patch.

* src/m4/bitcoin_find_bdb48.m4 changed name to build-aux/m4/bitcoin_find_bdb48.m4 , applied the same patch contents.

 * can't find src/qt/Makefile.am here.  so i just dropped it.

 * share/genbuild.sh kept its name. figured out what section to remove.

* I didn't touch patch-src_Makefile_include and patch-contrib_debian_manpages_bitcoind_1 - you figure out what these should be now please!


And now here below are my patch files, these patches compare the unmodified bitcoin-0.11.2 tar gz file with what the same need to be to deliver on OpenBSD. When you compare these patches with the previous ones you'll see great similarity.

These patches below here were gotten by reading the old openbsd-wip port patch files and figuring out how to get exactly the same thing in the new version.




compat.h:  No changes! I.e. remove the patch.

src/wallet/db.cpp:

/tmp/bitcoin-0.11.2$ diff -ur src/wallet/db.cpp /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/src/wallet/db.cpp
--- src/wallet/db.cpp   Mon Jun  1 00:00:00 2015
+++ /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/src/wallet/db.cpp Fri Nov 20 19:55:37 2015
@@ -97,7 +97,9 @@
dbenv->set_errfile(fopen(pathErrorFile.string().c_str(), "a")); /// debug
     dbenv->set_flags(DB_AUTO_COMMIT, 1);
     dbenv->set_flags(DB_TXN_WRITE_NOSYNC, 1);
+#if DB_VERSION_MINOR > 7
     dbenv->log_set_config(DB_LOG_AUTO_REMOVE, 1);
+#endif
     int ret = dbenv->open(strPath.c_str(),
                          DB_CREATE |
                              DB_INIT_LOCK |
@@ -131,7 +133,9 @@
     dbenv->set_lk_max_locks(10000);
     dbenv->set_lk_max_objects(10000);
     dbenv->set_flags(DB_AUTO_COMMIT, 1);
+#if DB_VERSION_MINOR > 7
     dbenv->log_set_config(DB_LOG_IN_MEMORY, 1);
+#endif
     int ret = dbenv->open(NULL,
                          DB_CREATE |
                              DB_INIT_LOCK |






/tmp/bitcoin-0.11.2$ diff -ur src/leveldb/port/port_posix.h /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/src/leveldb/port/port_posix.h
--- src/leveldb/port/port_posix.h       Mon Jun  1 00:00:00 2015
+++ /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/src/leveldb/port/port_posix.h Fri Nov 20 19:56:41 2015
@@ -10,6 +10,7 @@
 #undef PLATFORM_IS_LITTLE_ENDIAN
 #if defined(OS_MACOSX)
   #include <machine/endian.h>
+  #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
   #if defined(__DARWIN_LITTLE_ENDIAN) && defined(__DARWIN_BYTE_ORDER)
     #define PLATFORM_IS_LITTLE_ENDIAN \
         (__DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN)





$ diff -ur build-aux/m4/bitcoin_find_bdb48.m4 /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/build-aux/m4/bitcoin_find_bdb48.m4
--- build-aux/m4/bitcoin_find_bdb48.m4  Mon Jun  1 00:00:00 2015
+++ /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2/build-aux/m4/bitcoin_find_bdb48.m4 Fri Nov 20 19:58:11 2015
@@ -15,8 +15,8 @@
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
       #include <${searchpath}db_cxx.h>
     ]],[[
- #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
-        #error "failed to find bdb 4.8+"
+ #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6) || DB_VERSION_MAJOR > 4)
+        #error "failed to find bdb 4.6+"
       #endif
     ]])],[
       if test "x$bdbpath" = "xX"; then








Now i'll give some seconds to what did *not* work:


I went into the patched Bitcoin directory and did ./configure and that gave "configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)"


So instead I did:

./configure --disable-wallet

This gave: "configure: error: No working boost sleep implementation found."


Apparently this is a known problem,
documented at https://github.com/bitcoin/bitcoin/issues/3003
someone found "--disable-tests --disable-debug" to fix it, but, I went with a more novel solution instead - I installed the g++-4.8.4p2 package and did:

CXX=/usr/local/bin/eg++ ./configure --disable-wallet


This gave "configure: error: Detected LibreSSL: This is NOT supported, and may break consensus compatibility!"

That's discussed at https://github.com/bitcoin/bitcoin/pull/6244 .

There's a "--with-libressl" option, let's use it. I think BitcoinD will kick out its OpenSSL dependency soon too. And, I did a full network sync using the following so I know that it works for all blocks up to now.

CXX=/usr/local/bin/eg++ ./configure --disable-wallet --with-libressl


And then, "gmake" will actually make it build -





With all the above info in place, here are the instructions for actually getting a bitcoind binary:



* The source file is https://bitcoin.org/bin/bitcoin-core-0.11.2/bitcoin-0.11.2.tar.gz , as reflected on https://bitcoin.org/en/download .

* Install the dependency packages as not to need the ports system to rebuild those:

pkg_add automake-1.14.1
pkg_add boost
pkg_add protobuf
pkg_add libqrencode
pkg_add miniupnpc
pkg_add qt4

* Clone the openbsd-wip bitcoin package into the OBSD 5.8 ports tree into /usr/ports/net/bitcoin (as already said above)

 * Update distinfo to:

SHA256 (bitcoin-0.11.2.tar.gz) = a4d2bd642e5f7f1f82dc3f708618ac77e1e45353db7a98bf81c3bdc0e10690d3
SIZE (bitcoin-0.11.2.tar.gz) = 4758492

 * In the Makefile:

    * Change the "V" from 0.9.1 to 0.11.2 .

    * Change MASTER_SITES to:
      https://bitcoin.org/bin/bitcoin-core-${V}/

* DISTNAME from "bitcoin-bitcoin-v${V}" to "bitcoin-${V}" (as this influences the file it downloads)

* Change WKRDIST from "${WRKDIR}/bitcoin-bitcoin-66a2ae9" to "${WRKDIR}/bitcoin-0.11.2", I guess??



* Then I just cd:ed to /usr/ports/pobj/bitcoin-0.11.2/bitcoin-0.11.2 and tried to get on with the build process!





Here's how I applied the patch files manually, and the changes that had happened, also find the same patched files attached here:

* compat.h is now src/compat.h - attaching new version (applied exactly the same thing as in the old patch)

 * db.cpp - this file was moved to src/wallet/db.cpp

* leveldb/port/port_posix.h is now src/leveldb/port/port_posix.h - applied same thinga sin patch.

* src/m4/bitcoin_find_bdb48.m4 changed name to build-aux/m4/bitcoin_find_bdb48.m4 , applied the same patch contents.

 * can't find src/qt/Makefile.am here.

 * share/genbuild.sh kept its name. figured out what section to remove.

* I didn't touch patch-src_Makefile_include and patch-contrib_debian_manpages_bitcoind_1



(FIND THESE FILES ATTACHED BELOW)

Then:

CXX=/usr/local/bin/eg++ ./configure --disable-wallet --with-libressl

(Because purely ./configure gives: "configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)",

And because "./configure --disable-wallet" gave: "configure: error: No working boost sleep implementation found.", someone at https://github.com/bitcoin/bitcoin/issues/3003 found this could be solved by adding "--disable-tests --disable-debug" but this solution of adding eg++ worked for me,

and because "CXX=/usr/local/bin/eg++ ./configure --disable-wallet" gave "configure: error: Detected LibreSSL: This is NOT supported, and may break consensus compatibility!" as discussed on https://github.com/bitcoin/bitcoin/pull/6244 .)


gmake


Reply via email to