Title: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 07, 2011, 07:12:41 PM I am working on porting bitcoind to OpenBSD. I have run into an issue compiling the wxWidgets dependency.
Is it possible to exclude this dependency as mentioned here: http://bitcointalk.org/index.php?topic=576.0 ? Title: Re: Porting Bitcoind to OpenBSD Post by: indicasteve on August 07, 2011, 09:37:09 PM IDk... but there must be a way. This thread says there is already a port of bitcoind for OpenBSD:
https://bitcointalk.org/index.php?topic=25501.0 (https://bitcointalk.org/index.php?topic=25501.0) Maybe send a post to the OP and see where you can get it. I also heard Tom Williams also exclusively used OpenBSD. There's a few people looking for him. If you find him, let us know. :) Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 07, 2011, 10:35:47 PM Indicasteve,
Thanks for the reply. The post u reference is for FreeBSD not OpenBSD, but thanks anyways. Who is Tom? Title: Re: Porting Bitcoind to OpenBSD Post by: twobits on August 08, 2011, 12:20:55 AM There are two targets in the makefile, bitcoin (the default, with gui) and bitcoind. are you doing just a 'make' and not 'make bitcoind'. You want the latter to not use the wx stuff.
Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 10, 2011, 06:54:28 AM Thank you for your replies. I have gotten past excluding the wXWidgets dep by issueing the `gmake -g makefile.unix bitcoind` command.
After excluding SO_NOSIGPIPE and ignoring MSG_NOSIGNAL in net.cpp and irc.cpp i got to sha256.cpp. Now, i have a problem with xmmintrin.h in sha256.cpp. xmmintrin supports Intel Streaming SIMD Extensions technology. SSE Intrinsics allow the use of SSE instructions directly from C++ code, without writing the Assembly instructions. How can i get this to work on my sparc-64, OpenBSD4.9 box? Output below: # gmake -f Makefile2 bitcoind g++ -c -O2 -fstack-protector -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL -D__BSD__ -I"/home/root2/bitcoind/deps/include" -I"/usr/local/lib/wx/include/gtk2-unicode-release-2.9" -I"/usr/local/include/db47" -I"/usr/local/include" -L"/usr/local/lib/db47" -L"/home/root2/bitcoind/deps/lib" -L"/usr/lib" -O3 -o obj/sha256.o sha256.cpp sha256.cpp:12:23: error: xmmintrin.h: No such file or directory sha256.cpp:40: error: '__m128i' does not name a type sha256.cpp:44: error: '__m128i' does not name a type sha256.cpp:48: error: '__m128i' does not name a type sha256.cpp:52: error: '__m128i' does not name a type sha256.cpp:62: error: expected ',' or '...' before 'x' sha256.cpp:62: error: ISO C++ forbids declaration of '__m128i' with no type sha256.cpp: In function 'unsigned int store32(int)': sha256.cpp:63: error: '__m128i' does not name a type sha256.cpp:64: error: 'union store32(int)::<anonymous>' has no member named 'x' sha256.cpp:64: error: 'x' was not declared in this scope sha256.cpp:65: error: 'i' was not declared in this scope sha256.cpp: At global scope: sha256.cpp:68: error: expected ',' or '...' before 'x' sha256.cpp:68: error: ISO C++ forbids declaration of '__m128i' with no type sha256.cpp: In function 'void store_epi32(int)': sha256.cpp:69: error: '__m128i' does not name a type sha256.cpp:70: error: 'union store_epi32(int)::<anonymous>' has no member named 'x' sha256.cpp:70: error: 'x' was not declared in this scope sha256.cpp:71: error: 'x0' was not declared in this scope sha256.cpp:71: error: 'x1' was not declared in this scope sha256.cpp:71: error: 'x2' was not declared in this scope sha256.cpp:71: error: 'x3' was not declared in this scope sha256.cpp: At global scope: sha256.cpp:82: error: variable or field 'dumpreg' declared void sha256.cpp:82: error: '__m128i' was not declared in this scope sha256.cpp:82: error: expected primary-expression before 'char' gmake: *** [obj/sha256.o] Error 1 twobits? Title: Re: Porting Bitcoind to OpenBSD Post by: twobits on August 10, 2011, 03:03:50 PM # gmake -f Makefile2 bitcoind g++ -c -O2 -fstack-protector -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL -D__BSD__ -I"/home/root2/bitcoind/deps/include" -I"/usr/local/lib/wx/include/gtk2-unicode-release-2.9" -I"/usr/local/include/db47" -I"/usr/local/include" -L"/usr/local/lib/db47" -L"/home/root2/bitcoind/deps/lib" -L"/usr/lib" -O3 -o obj/sha256.o sha256.cpp twobits? I would say the next step is to take out the -DFOURWAYSSE2 since the sparc is not going to have x86 SSE2 instructions. Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 10, 2011, 07:41:57 PM Thanks again twobits for your reply to my last post. I got past that hurdle and i fell like im almost there.
I have finally made it to the linking stage. Now i have a problem with ld. It tells me it cant find the first boost library in its list, boost_system. Code: # gmake -f Makefile2 bitcoind Proof it is there: Code: # find /home/root2/bitcoind/deps/ | grep boost_system I modified the g++ command to include the absolute path to this lib and ld still "cant find" it. Code: g++ -O2 -fstack-protector -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -DUSE_SSL -D__BSD__ -I"/home/root2/bitcoind/deps/include" -L"/home/root2/bitcoind/deps/lib" -o bitcoind obj/nogui/util.o obj/nogui/script.o obj/nogui/db.o obj/nogui/net.o obj/nogui/irc.o obj/nogui/main.o obj/nogui/rpc.o obj/nogui/init.o cryptopp/obj/sha.o cryptopp/obj/cpu.o obj/sha256.o -dead-strip -l /home/root2/bitcoind/deps/lib/libboost_system-gcc42-mt-1_37.a -l boost_filesystem-mt -l boost_program_options-mt -l boost_thread-mt -l db_cxx -l ssl -l crypto -Wl,-Bdynamic -l z -l pthread Any ideas? Title: Re: Porting Bitcoind to OpenBSD Post by: twobits on August 12, 2011, 04:25:04 PM Maybe take off the extenstion, and/or add a -Bstatic flag before those libraries.
Title: Re: Porting Bitcoind to OpenBSD Post by: Venkatesh Srinivas on August 16, 2011, 02:39:24 PM Bitcoind is unlikely to work on your OpenBSD sparc64 system; the client does not run on big-endian systems.
Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 16, 2011, 10:35:35 PM I jumped the last hurdle by changing all the boost_xxx-mt to boost_xxx-gcc42-mt.
Now i am getting errors from the boost libs: Code: # gmake -f Makefile2 bitcoind Here is a snip from the offending file Code: // Create a new context implementation. Any C++ help greatly appreciated. Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 16, 2011, 10:48:27 PM Nevermind,
I got it. I changed: Code: // Create a new context implementation. to Code:
Now I've got bitcoind compiled and running on OpenBSD 4.9 Sparc64. What do i do next? Title: Re: Porting Bitcoind to OpenBSD Post by: jh1523 on August 16, 2011, 11:00:30 PM Now I've got bitcoind compiled and running on OpenBSD 4.9 Sparc64. What do i do next? Write a detailed howto for other people to use. Title: Re: Porting Bitcoind to OpenBSD Post by: Venkatesh Srinivas on August 17, 2011, 11:34:54 PM Start it and try it; but I suspect it will fail early.
On another big-endian system, it trips this assert: assert(block.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); fairly quickly. Title: Re: Porting Bitcoind to OpenBSD Post by: sn-2011a on August 25, 2011, 09:31:59 PM Venkatesh Srinivas, it works over here. Did you take out the SSE2 stuff?
Here is the HOWTO: Compiling Bitcoind on OpenBSD4.9 Sparc64 This doc will guide you to compiling Bitcoind on OpenBSD-4.9 Sparc64 ---Getting Ready--- Besides Bitcoind's direct dependncys you will need to install gmake and wget from the packages collection Bitconind's dependencys are not satisfied with the packages or ports collection of OpenBSD4.9. http://mirror.ece.vt.edu/pub/OpenBSD/4.9/packages/sparc64/ <-packages Berkley DB 4.6.21p4 is there but we need 4.7 Boost 1.42 is there but we need 1.37 OpenSSL is unkonwn Some of these deps are a couple of years old, but we will get them anyways. We will need: Boost 1.37, Berkley DB 4.7.25, openSSL 0.9.8g, and Bitcoind R251 Make a directory for this compilation project and the dependencys. Lets get all the downloading out of the way first Code: cd ~ and download and and unzip it like the others Now we will use svn to get Bitcoin. SVN will make a folder called trunk to put the code in. Code: cd ~/bitcoind/ Lets start with Boost Code: cd ~/bitcoind/deps/boost_1_37_0 Now Berkley DB Code: cd ~/bitcoind/deps/db-4.7.25 Finally we need need to finess openssl a bit. DES was giving me problems so i excluded it, you might not have to. I also had to change a file because of use of a depreciate option to the m4 macro processor. Code: cd ~/bitcoind/deps/openssl-0.9.8g ---OpenBSD specific changes to the code of Bitcoin --- net.cpp and irc.cpp need some changes to work on OpenBSD OpenBSD does not have MSG_NOSIGNAL so we will "ignore it" by adding these three lines below the headers in each of the two files Code: #ifndef MSG_NOSIGNAL now irc.cpp is done but net.cpp need some more work Code: vi ~/bitcoind/trunk/net.cpp use the / key to search for SO_NOSIGPIPE. This is not supported in OpenBSD either so we will take it out. We need to yank 4 lines from #ifdefBSD down to #endif you will find one more of these by searching again for the same thing, take it out Finally we will drop in our own makefile and be ready to compile bitcoind Code: cd ~/bitcoind/trunk/ ---Compiling Bitcoind--- Code: cd ~/bitcoind/trunk/ Enjoy Title: Re: Porting Bitcoind to OpenBSD Post by: Venkatesh Srinivas on August 25, 2011, 09:36:43 PM Works for me on OpenBSD/i386.
The SO_NOSIGPIPE fix is in bitcoin's git master; I submitted it to deal with DragonFly BSD. I've submitted a patch for the MSG_NOSIGNAL definition as well to the list. But I'm confused as to how it is working on Sparc64; isn't sparc64 a big-endian machine? The C++ bitcoin client isn't supposed to run on BE machines... have you been able to download the blockchain and everything? Thanks, -- vs Title: Re: Porting Bitcoind to OpenBSD Post by: zer0 on June 20, 2012, 07:24:23 PM Bumping this because this guy's method still works for OpenBSD 5.0 + latest bitcoind source
Probably should put it in the bitcoin wiki or possibly on the main bitcoin.org page Its already in the ports tree |