Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: NghtRppr on April 15, 2011, 02:22:12 AM



Title: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: NghtRppr on April 15, 2011, 02:22:12 AM
I'm running Windows XP on VMWare with a clean install. I need a complete step-by-step guide for what I need to download, what commands I need to run, etc. I've tried it myself and read all the directions but I keep getting errors and a Google search doesn't tell me how to fix it. I'll pay 100 BTC to whoever enables me to build a working bitcoind binary from source.


Title: Re: 100 BTC Bounty For Windows Build Instructions
Post by: dishwara on April 15, 2011, 02:33:18 AM
http://bitcointalk.org/index.php?topic=4750.0
http://www.megaupload.com/?d=UMGIGSYM

You already checked this post, still problem to build?


Title: Re: 100 BTC Bounty For Windows Build Instructions
Post by: gjs278 on April 15, 2011, 03:23:02 AM
you can also build the binary using mingw if you're more familar with linux


Title: Re: 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on April 15, 2011, 06:00:42 PM
Kind of sad that 100 BTC has to be offered for this, someone really needs to rewrite the build process.  Oh well, here goes:

Install:
  • MinGW Automated Installer from http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/mingw-get-inst-20110316.exe/download (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/mingw-get-inst-20110316.exe/download). Install with the C++ and MSYS options checked.
  • Activestate Perl (for building openssl) from http://www.activestate.com/activeperl/downloads (http://www.activestate.com/activeperl/downloads).  You don't need anything except ActivePerl and Perl, none of the other fancy crap.  You do want to add Perl to your PATH (its an option in the installer).

Download:
  • WxWidgets 2.9.1: http://sourceforge.net/projects/wxwindows/files/2.9.1/wxWidgets-2.9.1.zip/download (http://sourceforge.net/projects/wxwindows/files/2.9.1/wxWidgets-2.9.1.zip/download).  Unzip to C:\wxWidgets-2.9.1-mgw
  • OpenSSL 1.0.0d: http://www.openssl.org/source/openssl-1.0.0d.tar.gz (http://www.openssl.org/source/openssl-1.0.0d.tar.gz).  Untar to C:\openssl-1.0.0c-mgw (yes bitcoin is designed to build with 1.0.0c, but might as well use the latest version since it works right?) Hint: untar using the tar binary which is included in MinGW using cd \c\ && tar xvvf \c\Users\Matt\Downloads\openssl-1.0.0d.tar.gz && mv openssl-1.0.0d openssl-1.0.0c-mgw in the msys shell
  • Berkeley DB 4.7.25 NC: http://download.oracle.com/berkeley-db/db-4.7.25.NC.zip (http://download.oracle.com/berkeley-db/db-4.7.25.NC.zip).  Unzip to C:\db-4.7.25.NC-mgw
  • Boost 1.43.0: http://sourceforge.net/projects/boost/files/boost/1.43.0/boost_1_43_0.zip/download (http://sourceforge.net/projects/boost/files/boost/1.43.0/boost_1_43_0.zip/download).  Unzip to C:\boost-1.43.0-mgw
  • Boost Jam: http://sourceforge.net/projects/boost/files/boost-jam/3.1.18/boost-jam-3.1.18-1-ntx86.zip/download (http://sourceforge.net/projects/boost/files/boost-jam/3.1.18/boost-jam-3.1.18-1-ntx86.zip/download).  Unzip wherever you like, I used C:\bjam
  • miniUPnPc binary http://miniupnp.tuxfamily.org/files/download.php?file=upnpc-exe-win32-20110215.zip (http://miniupnp.tuxfamily.org/files/download.php?file=upnpc-exe-win32-20110215.zip).  Unzip to C:\upnpc-exe-win32-20110215
  • miniUPnPc source http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.5.20110215.tar.gz (http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.5.20110215.tar.gz).  Untar to C:\upnpc-exe-win32-20110215\miniupnpc (you only need *.h, but the others won't hurt) untar with cd \c\upnpc-exe-win32-20110215 && tar xvvf \c\Users\Matt\Downloads\miniupnpc-1.5.20110215.tar.gz && mv miniupnpc-1.5.20110215 miniupnpc

Note that the reason for using the binary miniupnpc release is that I was unable to get it to build on my system.

Add C:\MinGW\bin to your PATH environment variable (Google is your friend as it depends on your Windows Version).
In the DOS Shell:
wxWidgets:
Code:
cd \wxWidgets-2.9.1-mgw\build\msw
mingw32-make -f makefile.gcc

Boost:
Code:
cd \boost-1.43.0-mgw
\bjam\bjam.exe toolset=gcc --build-type=complete stage

In the msys Shell (MinGW shell in your start folder or C:\MinGW\msys\1.0\msys.bat):
OpenSSL:
Code:
cd /c/openssl-1.0.0c-mgw
./config
make
perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
Copy the libeay32.dll file to the folder where you are building/running bitcoin.

Berkeley DB:
Code:
cd /c/db-4.7.25.NC-mgw/build_unix
sh ../dist/configure --enable-mingw --enable-cxx
make

Bitcoin
If you wish to use git to pull keep a local repository, you'll have to download msgit from http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.4-preview20110204.exe&can=2&q= (http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.4-preview20110204.exe&can=2&q=).
Otherwise, you can download the latest zip of bitcoin from https://github.com/bitcoin/bitcoin/zipball/master (https://github.com/bitcoin/bitcoin/zipball/master)
In the msys shell, cd to the unzipped location and
Code:
make -f makefile.mingw
Run with ./bitcoin.exe (make sure you have the libeay32.dll in bitcoin folder)


Title: Re: 100 BTC Bounty For Windows Build Instructions
Post by: NghtRppr on April 16, 2011, 01:46:47 AM
http://blockexplorer.com/address/1EDMf3UATY1HMwfAHAvgRGCUcpFxtSVfha

Thanks!


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dmp1ce on April 24, 2011, 03:49:36 PM
@BlueMatt Thank you very much for the instructions, I'm following them to build Namecoin.  Just a note, I'm building on Windows 7 64bit and I had to add the "address-module=32" parameters to the boost build in order for it to compile without error.

Code:
\bjam\bjam.exe toolset=gcc address-model=32 --build-type=complete stage


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Gallop on April 27, 2011, 01:43:58 AM
Nice work.

So I followed the steps on an XP machine and during the final compilation of Bitcoin, I get this error message:

Code:
g++ -mthreads -O2 -w -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DSTATICLIB
-DUSE_UPNP=0 -I"C:\boost-1.43.0-mgw" -I"C:\db-4.7.25.NC-mgw\build_unix" -I"C:\openssl-1.0.0c-mgw\include" -I"C:\wxWidget
s-2.9.1-mgw\lib\gcc_lib\mswud" -I"C:\wxWidgets-2.9.1-mgw\include" -I"C:\upnpc-exe-win32-20110215" -mwindows -Wl,--subsys
tem,windows -o bitcoin.exe -L"C:\boost-1.43.0-mgw\stage\lib" -L"C:\db-4.7.25.NC-mgw\build_unix" -L"C:\openssl-1.0.0c-mgw
" -L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib" -L"C:\upnpc-exe-win32-20110215" 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 obj/ui.o obj/uibase.o obj/ui_res.o -l wxmsw2
9ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd -l boost_system-mgw
45-mt-s-1_43 -l boost_filesystem-mgw45-mt-s-1_43 -l boost_program_options-mgw45-mt-s-1_43 -l boost_thread-mgw45-mt-s-1_4
3 -l db_cxx -l eay32 -l miniupnpc -l iphlpapi -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32
 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -ldb_cxx
collect2: ld returned 1 exit status
make: *** [bitcoin.exe] Error 1

Probably something fishy with Berkeley DB, but I'm not clear how to fix this. Thanks for any help.




Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on April 27, 2011, 09:08:25 AM
Code:
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -ldb_cxx
Don't know, never seen it.  Make sure you have a libdb_cxx.a in C:\db-4.7.25.NC-mgw\build_unix. 


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Gallop on April 27, 2011, 10:16:12 PM
Don't know, never seen it.  Make sure you have a libdb_cxx.a in C:\db-4.7.25.NC-mgw\build_unix. 

There was no libdb_cxx.a indeed. I recompiled C:\db-4.7.25.NC-mgw\ and the file was there now. Not sure what happened. Anyway, the good news is that it compiled successfully! Thanks.

90MB .exe but it seems to work fine.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on April 27, 2011, 10:22:23 PM
90MB .exe but it seems to work fine.
You should strip bitcoin.exe.  That should help.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Gallop on April 27, 2011, 10:49:17 PM
You should strip bitcoin.exe.  That should help.

Gotcha. A more manageable 7.5MB now. Cheers!


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: lulzplzkthx on May 01, 2011, 06:35:51 AM
Just to let you know, I had to modify makefile.mingw and change the following lines:

Code:
LIBS= \
 -l boost_system-mgw45-mt-s-1_43 \
 -l boost_filesystem-mgw45-mt-s-1_43 \
 -l boost_program_options-mgw45-mt-s-1_43 \
 -l boost_thread-mgw45-mt-s-1_43 \
 -l db_cxx \
 -l eay32

To:

Code:
LIBS= \
 -l boost_system-mgw44-mt-s-1_43 \
 -l boost_filesystem-mgw44-mt-s-1_43 \
 -l boost_program_options-mgw44-mt-s-1_43 \
 -l boost_thread-mgw44-mt-s-1_43 \
 -l db_cxx \
 -l eay32

Also, like Gallop I had to recompile Berkley DB.

Thank you for the wonderful guide, BlueMatt.

~lulzplzkthx


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Alex Beckenham on May 27, 2011, 12:51:42 PM
I went through all the steps and finally when I did make -f makefile.mingw I got this:

Code:
In file included from util.cpp:5:0:
headers.h:62:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/util.o] Error 1

I tried copying the boost folder to the bitcoin src directory but got the same error... I don't know where I need to move it to in order for it to be found.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: unfinishe on May 27, 2011, 08:44:16 PM
I went through all the steps and finally when I did make -f makefile.mingw I got this:

Code:
In file included from util.cpp:5:0:
headers.h:62:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/util.o] Error 1

I tried copying the boost folder to the bitcoin src directory but got the same error... I don't know where I need to move it to in order for it to be found.

The makefile is looking for the boost folder at C:\boost-1.43.0-mgw . It's possible that there is a typo or something.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Alex Beckenham on May 27, 2011, 09:25:38 PM
I went through all the steps and finally when I did make -f makefile.mingw I got this:

Code:
In file included from util.cpp:5:0:
headers.h:62:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/util.o] Error 1

I tried copying the boost folder to the bitcoin src directory but got the same error... I don't know where I need to move it to in order for it to be found.

The makefile is looking for the boost folder at C:\boost-1.43.0-mgw . It's possible that there is a typo or something.

Wow you're right thanks, I didn't notice that until you mentioned it. I just extracted and added -mgw to the dir name without realising it's called boost_1_43_0-mgw.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Alex Beckenham on May 27, 2011, 09:42:29 PM
Awesome, that worked thanks :D

@Unfinishe: Just sent you a coin using my new binary, plus an extra 1 for matt :D


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: unfinishe on May 28, 2011, 10:45:26 PM
Awesome, that worked thanks :D

@Unfinishe: Just sent you a coin using my new binary, plus an extra 1 for matt :D


Thank you so much!  :)


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on May 28, 2011, 11:09:14 PM
@Unfinishe: Just sent you a coin using my new binary, plus an extra 1 for matt :D
Thank you good sir.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: grue on June 23, 2011, 04:49:29 PM
great guide! thank you very much


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: vector76 on July 01, 2011, 11:36:53 PM
Great guide!  TY!

The makefile now appears to look for C:\openssl-1.0.0d-mgw instead of C:\openssl-1.0.0c-mgw and it was failing on that.  But just a minor speed bump.

Again, thanks!


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dacoinminster on August 16, 2011, 12:40:19 AM
My notes from TRYING to do this:

 - If you have never used command-line compile tools before, prepare to be baffled and befuddled. This is not a nice clean GUI where you hit the compile button, wait a few seconds, and go try your executable. Thankfully, I've used gcc before, so I wasn't completely out of my element
 - Expect the whole process from learning to downloading to compiling to troubleshooting, to take HOURS. I'm not kidding. These makefiles build THOUSANDS of object files, of which bitcoin probably uses a tiny percentage. Boost is the worst of them all. Just start the make and let it run overnight.
 - Before running the steps outlined in the earlier post, I recommend you get yourself a github account, and follow their instructions to download and install "git" and set up your own sandbox (fork) of the bitcoin source. This will involve yet even more baffling command lines that need to be copied and run exactly as written on the github guide to getting started
 - Do not watch the scroll of status messages going by during the eternity it takes to compile everything. You will see countless frightening-sounding warnings which will only confuse you
 - Do not expect a nice little "all done, everything went ok!" message at the end of a long compilation. The nice ones just stop printing status messages, and you are supposed to know from the acres of text above that nothing bad happened. The others are less nice . . .
 - Boost finally finished compiling with this very comforting message:
Quote
...failed updating 8 targets...
...skipped 8 targets...
...updated 4393 targets...
Great.
 - At the end of the make for openssl, the linker returned a very fatal-sounding
Quote
undefined reference to `WinMain@16'
I wasted some time trying to "make clean" and try "make" again, but eventually I went on to the next step, and I still got the expected libeay32.dll without any complaints.
 - Finally, I tried compiling bitcoin (ha!) - as you might expect, it wasn't happy. The error message was:
Quote
In file included from util.cpp:5:0:
headers.h:38:28: fatal error: openssl/buffer.h: No such file or directory
I found buffer.h in the includes directory for openssl, so I copied that directory out and renamed it "openssl" which I then put everywhere I could think of. No luck.

Linux compile tools let you stand on the shoulders of giants, but the giants all have Asperger's.

Any help would be appreciated.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Man From The Future on August 16, 2011, 11:18:37 AM
Put it in more places? :)

In the file trying to include buffer,h, change the include to have teh exact path to buffer.h? :?


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Furyan on August 16, 2011, 01:32:35 PM
My notes from TRYING to do this:

 - If you have never used command-line compile tools before, prepare to be baffled and befuddled. This is not a nice clean GUI where you hit the compile button, wait a few seconds, and go try your executable. Thankfully, I've used gcc before, so I wasn't completely out of my element
 - Expect the whole process from learning to downloading to compiling to troubleshooting, to take HOURS. I'm not kidding. These makefiles build THOUSANDS of object files, of which bitcoin probably uses a tiny percentage. Boost is the worst of them all. Just start the make and let it run overnight.
 - Before running the steps outlined in the earlier post, I recommend you get yourself a github account, and follow their instructions to download and install "git" and set up your own sandbox (fork) of the bitcoin source. This will involve yet even more baffling command lines that need to be copied and run exactly as written on the github guide to getting started
 - Do not watch the scroll of status messages going by during the eternity it takes to compile everything. You will see countless frightening-sounding warnings which will only confuse you
 - Do not expect a nice little "all done, everything went ok!" message at the end of a long compilation. The nice ones just stop printing status messages, and you are supposed to know from the acres of text above that nothing bad happened. The others are less nice . . .

...

Linux compile tools let you stand on the shoulders of giants, but the giants all have Asperger's.

Any help would be appreciated.

Welcome to Linux development.  And people wonder why it isn't more widely adopted.

Say what you want about Microsoft, the lower barrier to entry has alot to do with its continued wide use.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dacoinminster on August 16, 2011, 02:14:08 PM
Put it in more places? :)

In the file trying to include buffer,h, change the include to have teh exact path to buffer.h? :?

In my experience, modifying code to try to get it to compile just leads to a cascade of further problems.

Welcome to Linux development.  And people wonder why it isn't more widely adopted.

Say what you want about Microsoft, the lower barrier to entry has alot to do with its continued wide use.

Yes, but I mean no disrespect to the Linux guys. They have to live with these tools just like I do, and I need one of them to help me out here!


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: vector76 on August 16, 2011, 03:46:02 PM
Building the dependencies with MinGW takes an eternity.  Not sure where the blame lies (as if it matters), but it is really painful.

Not only that, but they are also huge in terms of file size.  After compiling, they are nearly 4 GB.  Yes, disk space is cheap, but it's definitely not all necessary.

I think I'll put together a set of minimal binaries for the dependencies for Windows + MinGW.  No reason to go through all that unnecessarily.


As for missing .h files, double check the path names in the include path (-I<whatever> on the command line) and double check that they exactly match the names of the directories on your file system.  Watch for subtle differences like dots instead of underscores or dashes.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on August 16, 2011, 05:10:32 PM
- If you have never used command-line compile tools before, prepare to be baffled and befuddled. This is not a nice clean GUI where you hit the compile button, wait a few seconds, and go try your executable. Thankfully, I've used gcc before, so I wasn't completely out of my element
Not much of an option there, sadly...

- Expect the whole process from learning to downloading to compiling to troubleshooting, to take HOURS. I'm not kidding. These makefiles build THOUSANDS of object files, of which bitcoin probably uses a tiny percentage. Boost is the worst of them all. Just start the make and let it run overnight.
Wasn't nearly that bad for me.  Though the instructions may be out of date at this point, building on my (fairly beefy) desktop (in a VM), even for boost, worked pretty well.  That said, I know devrandom has said that these instructions build several copies of boost for different usage scenarios whereas bitcoin uses only one, so the boost build options could be trimmed down maybe as much as 75%.

- Before running the steps outlined in the earlier post, I recommend you get yourself a github account, and follow their instructions to download and install "git" and set up your own sandbox (fork) of the bitcoin source. This will involve yet even more baffling command lines that need to be copied and run exactly as written on the github guide to getting started
I would agree only because it means its easier for you to contribute code to bitcoin and help the development effort, but to just build, I'm not sure its entirely necessary.

- Do not watch the scroll of status messages going by during the eternity it takes to compile everything. You will see countless frightening-sounding warnings which will only confuse you
 - Do not expect a nice little "all done, everything went ok!" message at the end of a long compilation. The nice ones just stop printing status messages, and you are supposed to know from the acres of text above that nothing bad happened. The others are less nice . . .
 - Boost finally finished compiling with this very comforting message:
Quote
...failed updating 8 targets...
...skipped 8 targets...
...updated 4393 targets...
Great.
Yep, boost always fails a few targets and skips others, why I don't know nor really care too much, but yea just ignore the messages unless the last line is some kind of error message, I would say.

- At the end of the make for openssl, the linker returned a very fatal-sounding
Quote
undefined reference to `WinMain@16'
I wasted some time trying to "make clean" and try "make" again, but eventually I went on to the next step, and I still got the expected libeay32.dll without any complaints.
 - Finally, I tried compiling bitcoin (ha!) - as you might expect, it wasn't happy. The error message was:
Quote
In file included from util.cpp:5:0:
headers.h:38:28: fatal error: openssl/buffer.h: No such file or directory
I found buffer.h in the includes directory for openssl, so I copied that directory out and renamed it "openssl" which I then put everywhere I could think of. No luck.
Now there I can't really help, you'll have to google around...that said, I don't know why that would fail as openssl has always worked first time for me (XP and Win7).

Linux compile tools let you stand on the shoulders of giants, but the giants all have Asperger's.
They work great on Linux, on Windows...not so much.
I will say this however: When I wrote these instructions Bitcoin official Windows binaries were built on Windows, now they are built via gitian in Linux.
The absolute easiest way to build Bitcoin is via gitian as its just a matter of downloading the tars of the various dependencies and running gitian, it will handle the rest.
I have to admit I haven't built Bitcoin on Win32 in quite some time now...


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dacoinminster on August 16, 2011, 08:50:19 PM
Thanks for the comments, guys.

So lets say I want to try running linux in a virtual machine just for compiling bitcoin. What flavor of linux should I install? I've had passing exposure to Ubuntu . . .

Can anyone recommend which virtual machine software would be best for running a linux image? I would probably try VMWare first unless someone knows better.

Can anybody post the super-easy steps to downloading/installing/compiling everything to build bitcoin on such a linux virtual machine?

Should I be thinking about cygwin instead of a virtual machine? I've had passing exposure to that too.

I haven't tried running all these steps on a brand new XP-mode virtual machine inside Win7. If anybody has time to try that, I would be interested in whether that works.

Thanks everyone. This of course is not just for me - if we can get more people hacking on bitcoin, a lot of neat stuff will get made.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dacoinminster on August 16, 2011, 09:11:40 PM
OK. Found my first problem building bitcoin. I missed this comment earlier in the thread:

Great guide!  TY!

The makefile now appears to look for C:\openssl-1.0.0d-mgw instead of C:\openssl-1.0.0c-mgw and it was failing on that.  But just a minor speed bump.

Again, thanks!

Renaming the directory fixed the missing openssl includes.

Next compile error:

Quote
net.cpp:23:32: fatal error: miniupnpc/miniwget.h: No such file or directory

Turns out this is because Windows unzipped miniupnpc into a subdirectory "miniupnpc-1.5.20110215". I had found and fixed most of these Windows-generated extra subdirectories, but missed this one. Anyone building bitcoin under windows needs to watch out for Windows unzipping zip files into a new folder you did not ask it to create. Once I moved the files up a directory, compilation continued.

To my surprise and delight, compilation finished, and I had a shiny new bitcoin.exe, which after running "strip bitcoin.exe" shrunk from 96MB to 8.6MB.

I ran it, and it found my real-life wallet. I tried sending a tip to Matt at 1JBMattRztKDF2KRS3vhjJXA7h47NEsn2c, and the UI froze up. Oh well! At least I can compile SOMETHING now . . .

Thanks!

Edit: Killed it with task manager, ran it again, tried the send again, and it worked! Also tipped Vector76 at 1N6kvsgWHSHfnScG31rBozNznrZnUBG1td, an address I had from an earlier tip I sent him :)


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on August 16, 2011, 09:14:54 PM
So lets say I want to try running linux in a virtual machine just for compiling bitcoin. What flavor of linux should I install? I've had passing exposure to Ubuntu . . .
Sadly gitian will always launch its own VM and running a VM in a VM doesnt work with hardware virtualization and qemu's software virtualization is really, really slow.  That means you wont realistically be able to use gitian, but it should still be fairly easy if you are willing to do some work.

Can anyone recommend which virtual machine software would be best for running a linux image? I would probably try VMWare first unless someone knows better.
Meh, virtualization is so heavily hardware assisted these days the host software doesnt really matter.  I usually use VirtualBox but if you are used to VMWare that works just as well. (though I would say supporting OSS is always nice, so might as well use VirtualBox).
Gitian scripts for bitcoin (that are used for the official binaries) run on Ubuntu 10.04 LTS.

Can anybody post the super-easy steps to downloading/installing/compiling everything to build bitcoin on such a linux virtual machine?
Best bet is to read the gitian scripts and try to emulate their working in your own VM.
(https://github.com/bitcoin/bitcoin/blob/master/contrib/gitian.yml for building Linux binaries and https://github.com/bitcoin/bitcoin/blob/master/contrib/gitian-win32.yml for building the binaries for Win32).

Should I be thinking about cygwin instead of a virtual machine? I've had passing exposure to that too.
Dont think that will be any easier than MSYS and the previous instructions.

I haven't tried running all these steps on a brand new XP-mode virtual machine inside Win7. If anybody has time to try that, I would be interested in whether that works.
Those instructions were what I used on Win7 so I dont think that should make a difference.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Matt Corallo on August 16, 2011, 09:16:49 PM
I ran it, and it found my real-life wallet. I tried sending a tip to Matt at 1JBMattRztKDF2KRS3vhjJXA7h47NEsn2c, and the UI froze up. Oh well! At least I can compile SOMETHING now . . .

Probably a result of https://github.com/bitcoin/bitcoin/issues/453 (https://github.com/bitcoin/bitcoin/issues/453)


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dacoinminster on August 16, 2011, 09:21:56 PM
You guys rock. Thanks for your help.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: twobits on August 17, 2011, 12:53:17 PM

Welcome to Linux development.  And people wonder why it isn't more widely adopted.

Say what you want about Microsoft, the lower barrier to entry has alot to do with its continued wide use.

I have the opposite experience, and least on Unix I have something to read,  on Windows I have to wave the mouse around and guess what the pretty pictures means.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: twobits on August 17, 2011, 12:54:46 PM
Building the dependencies with MinGW takes an eternity.  Not sure where the blame lies (as if it matters), but it is really painful.

Not only that, but they are also huge in terms of file size.  After compiling, they are nearly 4 GB.  Yes, disk space is cheap, but it's definitely not all necessary.

I think I'll put together a set of minimal binaries for the dependencies for Windows + MinGW.  No reason to go through all that unnecessarily.


As for missing .h files, double check the path names in the include path (-I<whatever> on the command line) and double check that they exactly match the names of the directories on your file system.  Watch for subtle differences like dots instead of underscores or dashes.

First issue, the speeds, is due to windows not supporting the fork and exec model the unix tools use and the emulation of it being slow.  The second is due to the everything being build in debug mode.


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: BitHits on March 17, 2013, 11:29:30 PM
Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
alert.cpp:5:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1

after copying C:\boost_1_43_0-mgw\boost to C:\bitcoin-nftf-master\src

Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
In file included from serialize.h:22:0,
                 from netbase.h:10,
                 from util.h:27,
                 from alert.h:13,
                 from alert.cpp:8:
allocators.h:12:53: fatal error: openssl/crypto.h: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: BitHits on March 19, 2013, 05:08:53 AM
Too bad bitcoin was just hard forked from everything <=0.7.2


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: Diapolo on March 19, 2013, 01:06:06 PM
Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
alert.cpp:5:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1

after copying C:\boost_1_43_0-mgw\boost to C:\bitcoin-nftf-master\src

Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
In file included from serialize.h:22:0,
                 from netbase.h:10,
                 from util.h:27,
                 from alert.h:13,
                 from alert.cpp:8:
allocators.h:12:53: fatal error: openssl/crypto.h: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1

Don't try to use such an old Boost version, you can use 1.53 if you want and AFAIK the official client is using 1.50 currently.

Dia


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: BitHits on March 20, 2013, 06:05:55 AM
Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
alert.cpp:5:29: fatal error: boost/foreach.hpp: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1

after copying C:\boost_1_43_0-mgw\boost to C:\bitcoin-nftf-master\src

Code:
Administrator@PC /c/bitcoin-nftf-master/src
$ make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -I/c/bitcoin-nftf-master/src/leveldb/include -I/c/bitcoin-nftf-master/src/leveldb/helpers -I"/c/bitcoin-nftf-master/src" -I"/usr/local/include" -o obj/alert.o alert.cpp
In file included from serialize.h:22:0,
                 from netbase.h:10,
                 from util.h:27,
                 from alert.h:13,
                 from alert.cpp:8:
allocators.h:12:53: fatal error: openssl/crypto.h: No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1

Don't try to use such an old Boost version, you can use 1.53 if you want and AFAIK the official client is using 1.50 currently.

Dia

Thx diapolo I'll get around to trying that at some point


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: nitrogenetics on March 21, 2013, 07:14:32 PM
In case anyone is still interested, I posted a simple guide about building the latest bitcoind on windows some time ago: https://bitcointalk.org/index.php?topic=149479 (https://bitcointalk.org/index.php?topic=149479)  :)


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: awais3344 on February 16, 2014, 03:12:55 PM
In case anyone is still interested, I posted a simple guide about building the latest bitcoind on windows some time ago: https://bitcointalk.org/index.php?topic=149479 (https://bitcointalk.org/index.php?topic=149479)  :)

bookmarked, :) going to try it tonight. Going to see if I can compile litecoin source. its so painful  :-X


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: temple on March 19, 2014, 12:14:04 AM
this post give me the hint to compile the code on windows.

-l not found issue. actually is the library file start with "lib"

such as boost_filesystem should be libboost_filesystem
 :D


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: jamd315 on March 19, 2014, 07:44:22 PM
When I try to compile, I get "ld.exe: cannot find -ldb_cxx" but when I compiled Berkely I used --enable_cxx.  I can reproduce the problem by running ld.exe -ldb_cxx


Title: Re: [COLLECTED] 100 BTC Bounty For Windows Build Instructions
Post by: dubouis on March 20, 2014, 01:57:54 PM
What does the binary using mingw mean?