原始文献 / 论坛帖 / Re: Issues building bitcoin on Windows 7

Re: Issues building bitcoin on Windows 7

Bitcointalk · 2010-09-19 18:46:46 UTC

AuthorSatoshi Nakamoto
TitleRe: Issues building bitcoin on Windows 7
Date2010-09-19 18:46:46 UTC
ForumBitcointalk · 原文

它卡住的行:
Code:ERROR extern map<string, string> mapAddressBook;
ERROR extern CCriticalSection cs_mapAddressBook;
ERROR extern vector<unsigned char> vchDefaultKey;
OK extern bool fClient;
OK extern int nBestHeight;

OK extern unsigned int nWalletDBUpdated;
ERROR extern DbEnv dbenv;

所以它表现得像什么都没定义,连 map 和 vector 都没有。

可 db.h 是被 headers.h 包含的(只在那,别处没有),headers.h 在 db.h 之前包含了 vector、map、util.h 和一切。

是不是 VC 在用预编译头搞砸了?你的目录里会不会有之前失败尝试留下的预编译头文件,被它找到用了?

现在有个安装包,装 MinGW 非常容易。别用最新的 4.5.0,用旧几个版本比如 4.4.1 (1.908.0) 或 1.812.0。安装程序一站式装好,不像以前那么难。我记得我唯一要做的就是把 make*.exe 改名成 make.exe。
http://tdm-gcc.tdragon.net/

题外话:要是有谁能把 tcatm 的 4-way 128-bit SSE2 代码在 Windows 上跑起来就好了。MinGW 的优化有点问题,我不确定,也许是栈上 16 字节对齐的问题,导致段错误。我摆弄了一下,在测试程序里能跑通他的代码,但不知为什么在比特币本身里不行。

英文原文

The lines it's tripping on:
Code:ERROR extern map<string, string> mapAddressBook;
ERROR extern CCriticalSection cs_mapAddressBook;
ERROR extern vector<unsigned char> vchDefaultKey;
OK extern bool fClient;
OK extern int nBestHeight;

OK extern unsigned int nWalletDBUpdated;
ERROR extern DbEnv dbenv;

So it's acting like nothing is defined, not even map and vector.

Yet, db.h is included by headers.h (and only there, nowhere else) which includes vector, map, util.h and everything before db.h.

Is VC trying to use precompiled headers and screwing it up?  Could there be some leftover precompiled header files in your directory from previously failed attempts that it's finding and using?

There's an installer package now that makes it really easy to install MinGW.  Don't use the latest version 4.5.0, use a few versions back like 4.4.1 (1.908.0) or 1.812.0.  A setup program completely installs everything, it's not hard like it used to be.  I think the only thing I had to do was rename make*.exe something to make.exe.
http://tdm-gcc.tdragon.net/

Off topic, but: It would be nice if someone would hack on getting tcatm's 4-way 128-bit SSE2 code working on Windows.  There's something with MinGW's optimisation, I'm not sure but maybe a problem with 16-byte alignment on the stack, that makes it segfault.  With some fiddling, I was able to get his code to work in a test program, but not in Bitcoin itself for some reason.