Pages:
Author

Topic: [COLLECTED] 100 BTC Bounty For Windows Build Instructions (Read 18229 times)

member
Activity: 71
Merit: 10
What does the binary using mingw mean?
newbie
Activity: 7
Merit: 0
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
hero member
Activity: 1428
Merit: 538
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
 Cheesy
sr. member
Activity: 308
Merit: 250
In case anyone is still interested, I posted a simple guide about building the latest bitcoind on windows some time ago: https://bitcointalksearch.org/topic/building-headless-bitcoin-and-bitcoin-qt-on-windows-149479  Smiley

bookmarked, Smiley going to try it tonight. Going to see if I can compile litecoin source. its so painful  Lips sealed
full member
Activity: 131
Merit: 108
In case anyone is still interested, I posted a simple guide about building the latest bitcoind on windows some time ago: https://bitcointalksearch.org/topic/building-headless-bitcoin-and-bitcoin-qt-on-windows-149479  Smiley
full member
Activity: 196
Merit: 100
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
hero member
Activity: 772
Merit: 500
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
full member
Activity: 196
Merit: 100
Too bad bitcoin was just hard forked from everything <=0.7.2
full member
Activity: 196
Merit: 100
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
sr. member
Activity: 574
Merit: 250
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 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.
sr. member
Activity: 574
Merit: 250

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.
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
You guys rock. Thanks for your help.
hero member
Activity: 755
Merit: 515
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
hero member
Activity: 755
Merit: 515
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.
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
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 Smiley
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
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.
hero member
Activity: 755
Merit: 515
- 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...
member
Activity: 70
Merit: 18
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 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.
legendary
Activity: 1260
Merit: 1031
Rational Exuberance
Put it in more places? Smiley

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!
full member
Activity: 175
Merit: 102
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.
Pages:
Jump to: