Bitcoin Forum
September 29, 2016, 03:17:34 PM *
News: Due to DDoS attacks, there may be periodic downtime.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: HOWTO: Compiling Bitcoin v0.3 on FreeBSD (7.2,7.3,8.0)  (Read 5895 times)
The Madhatter
Hero Member
*****
Offline Offline

Activity: 490


My avatar pic says it all


View Profile
July 15, 2010, 03:32:04 PM
 #1

Step 1:

Install the following from the ports tree:

x11-toolkits/gtk20
devel/boost-all
devel/gmake
databases/db48

Step 2:

Install wxWidgets 2.9 from source. The ports version won't work.

You can get 2.9 here: http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.9.0.tar.bz2

Step 3:

Apply the attached patch to the "makefile.unix" file.

cd ~/bitcoin-0.3/src/
patch < makefile.unix.patch.txt

Step 4:

Tweak any compiler options in makefile.unix. (See the CFLAGS line). The default options are the options I use on my machines. They are: "-O3 -march=nocona -fstack-protector". Be sure to set your 'march' at the very least.

Step 5:

Build with:

gmake -f makefile.unix bitcoind

And enjoy! Smiley

$ cat ~/.bitcoin/debug.log |grep "Bitcoin version"
Bitcoin version 0.3.0 beta, OS version FreeBSD 8.0-RELEASE-p3 amd64
$


And what about performance? It's insanely great on FreeBSD. Especially with the ULE scheduler.

CPU: Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz (2666.38-MHz K8-class CPU)
hashmeter   4 CPUs   2585 khash/s


Cheesy
1475162254
Hero Member
*
Offline Offline

Posts: 1475162254

View Profile Personal Message (Offline)

Ignore
1475162254
Reply with quote  #2

1475162254
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1475162254
Hero Member
*
Offline Offline

Posts: 1475162254

View Profile Personal Message (Offline)

Ignore
1475162254
Reply with quote  #2

1475162254
Report to moderator
Dereckson
Newbie
*
Offline Offline

Activity: 1


View Profile
September 20, 2010, 09:17:23 PM
 #2

Good evening,

Thank you for your howto, it allows me to prepare a FreeBSD port for Bitcoin.

Could you attach makefile.unix.patch.txt your patch? It seems you forgot it.
The Madhatter
Hero Member
*****
Offline Offline

Activity: 490


My avatar pic says it all


View Profile
September 20, 2010, 11:44:13 PM
 #3

I didn't forget to attach it. Look again.
Hiro Protagonist
Newbie
*
Offline Offline

Activity: 3


View Profile
October 15, 2010, 04:42:16 AM
 #4

Good evening,

Thank you for your howto, it allows me to prepare a FreeBSD port for Bitcoin.

Any status on the FreeBSD port?

Thanks for this HOWTO. Any ideas on the best way to run bitcoind as a daemon on the system?
The Madhatter
Hero Member
*****
Offline Offline

Activity: 490


My avatar pic says it all


View Profile
October 15, 2010, 04:57:00 AM
 #5

Each time I am close to submitting a port, the codebase/makefiles change. I'm waiting until the development of Bitcoin dies down a tad before I work on the port again.

Compiling it on FreeBSD is easier now. You just have to enable a define, adjust some library/include paths, and it compiles and runs great. Smiley
lucky
Jr. Member
*
Offline Offline

Activity: 43


View Profile
January 03, 2011, 01:37:42 AM
 #6

Compiling it on FreeBSD is easier now. You just have to enable a define, adjust some library/include paths, and it compiles and runs great. Smiley


Could you (or someone else) explain that a bit further?  I've been trying to get 0.3.19 it to compile on FBSD for about half an hour now with no success.
Metal
Newbie
*
Offline Offline

Activity: 16


View Profile
January 07, 2011, 04:04:39 AM
 #7

It seems that the original makefile.unix won't work as-is for most folks.

In my case, I had to use the output of `wx-config --cflags` and `wx-config --libs` to make the build work on a ubuntu hardy box (thanks to Diablo-3D for pointing me in the right direction.)

Are we okay with having a few build recipes hanging around old forum posts, or should there be an attempt at foolproofing the build process a bit?

Maybe some light autoconf/automake use would help here.

The Madhatter
Hero Member
*****
Offline Offline

Activity: 490


My avatar pic says it all


View Profile
January 07, 2011, 04:12:45 AM
 #8

Here is the complete makefile.unix that I used to build Bitcoin 0.3.19 on FreeBSD-8.1-RELEASE/amd64:

You'll need to install the following from ports:

gmake
boost-all
db47 (you can use db48, but you'll have to change the makefile a bit)
openssl (from ports works best)

After you drop in this makefile.unix file, just run "gmake -f makefile.unix bitcoind" and you'll have a "bitcoind" binary. Smiley

Code:
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

INCLUDEPATHS= \
 -I"/usr/local/include/wx-2.9" \
 -I"/usr/local/lib/wx/include/gtk2-unicode-release-2.9" \
 -I"/usr/local/include/db47" \
 -I"/usr/local/include"

LIBPATHS= \
 -L"/usr/local/lib/db47" \
 -L"/usr/local/lib" \
 -L"/usr/lib"

# for wxWidgets 2.9.1, add -l Xxf86vm
WXLIBS= \
 -Wl,-Bstatic \
   -l wx_gtk2ud-2.9 \
 -Wl,-Bdynamic \
   -l gtk-x11-2.0 \
   -l SM


# for boost 1.37, add -mt to the boost libraries
#LIBS= \
# -Wl,-Bstatic \
#   -l boost_system \
#   -l boost_filesystem \
#   -l boost_program_options \
#   -l boost_thread \
#   -l db_cxx \
#   -l crypto \
# -Wl,-Bdynamic

# for boost 1.37, add -mt to the boost libraries
LIBS= \
 -Wl,-Bstatic \
   -l boost_system \
   -l boost_filesystem \
   -l boost_program_options \
   -l boost_thread \
   -l db_cxx \
   -l ssl \
   -l crypto \
 -Wl,-Bdynamic \
   -l z \
   -l pthread

DEFS=-D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL -D__BSD__
DEBUGFLAGS=-g -D__WXDEBUG__
CFLAGS=-O2 -march=nocona -fstack-protector -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) $(LIBPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
    script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h

OBJS= \
    obj/util.o \
    obj/script.o \
    obj/db.o \
    obj/net.o \
    obj/irc.o \
    obj/main.o \
    obj/rpc.o \
    obj/init.o \
    cryptopp/obj/sha.o \
    cryptopp/obj/cpu.o


all: bitcoin


obj/%.o: %.cpp $(HEADERS)
        g++ -c $(CFLAGS) -DGUI -o $@ $<

cryptopp/obj/%.o: cryptopp/%.cpp
        g++ -c $(CFLAGS) -O3 -o $@ $<

obj/sha256.o: sha256.cpp
        g++ -c $(CFLAGS) -msse2 -O3 -march=nocona -o $@ $<

bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha256.o
        g++ $(CFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)


obj/nogui/%.o: %.cpp $(HEADERS)
        g++ -c $(CFLAGS) -o $@ $<

bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha256.o
        g++ $(CFLAGS) -o $@ $^ $(LIBS)


clean:
        -rm -f obj/*.o
        -rm -f obj/nogui/*.o
        -rm -f cryptopp/obj/*.o
        -rm -f headers.h.gch

Edit: If you want the GUI you'll need to install "x11-toolkits/gtk20" from ports, and install wxwidgets 2.9 from source (it's not in the ports tree). Use the makefile above and run "gmake -f makefile.unix bitcoin".
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
January 07, 2011, 05:23:32 PM
 #9

Great!  I'd like to see this good work make it back into mainline bitcoin; please talk with the other improve-the-build-process efforts and submit some patches.

How often do you get the chance to work on a potentially world-changing project?
gelraen
Newbie
*
Offline Offline

Activity: 1


View Profile
May 20, 2011, 12:10:27 PM
 #10

Now bitcoin from git repo works fine with databases/db46 and x11-toolkits/wxgtk29

Code:
Bitcoin version 0.3.22-beta
OS version FreeBSD 8.2-STABLE i386


Code:
diff --git a/src/makefile.unix b/src/makefile.unix
index 4f2da37..23bf964 100644
--- a/src/makefile.unix
+++ b/src/makefile.unix
@@ -4,9 +4,9 @@
 
 CXX=g++
 
-WXINCLUDEPATHS=$(shell wx-config --cxxflags)
+WXINCLUDEPATHS=$(shell wxgtk2u-2.9-config --cxxflags)
 
-WXLIBS=$(shell wx-config --libs)
+WXLIBS=$(shell wxgtk2u-2.9-config --libs)
 
 USE_UPNP:=0
 
@@ -32,12 +32,11 @@ LIBS+= \
  -Wl,-Bdynamic \
    -l gthread-2.0 \
    -l z \
-   -l dl \
    -l pthread
 
 
 DEBUGFLAGS=-g -D__WXDEBUG__
-CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS)
+CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) -I/usr/local/include -I/usr/local/include/db46 -L/usr/local/lib -L/usr/local/lib/db46
 HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
     script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
Vladimir
Hero Member
*****
Offline Offline

Activity: 812


-


View Profile
May 22, 2011, 10:13:01 AM
 #11

This is of course based on published above excellent guide. Thanks to The Madhatter.

However, instead of all that, now one can simply do this:

cd /usr/ports/net-p2p/bitcoin; make install clean; rehash

you will even have a chance to select/deselect GUI and upnp stuff.




-
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!