Author

Topic: Problems compiling Bitcoin 0.4.0 in Windows 7 x64 (MinGW Environment) (Read 4380 times)

sr. member
Activity: 308
Merit: 250
Thanks!
Your advise made me thinking... and I figured how to fix it.  Smiley

The problem is in the db.h from the berkeley database - it includes ptherad.h, which screws things up.

All you have to do is just append -D__NO_SYSTEM_INCLUDES at the DEFS= in makefile.mingw

Now it compiles

Thanks a lot! I'll try this as soon as I get to my home PC.  Grin

I know this is waaay old news, but this fixed it for me too, thanks!
full member
Activity: 178
Merit: 100
Certified fox posing as a cat posing as a human
Thanks!
Your advise made me thinking... and I figured how to fix it.  Smiley

The problem is in the db.h from the berkeley database - it includes ptherad.h, which screws things up.

All you have to do is just append -D__NO_SYSTEM_INCLUDES at the DEFS= in makefile.mingw

Now it compiles

Thanks a lot! I'll try this as soon as I get to my home PC.  Grin
legendary
Activity: 2053
Merit: 1356
aka tonikt
Thanks!
Your advise made me thinking... and I figured how to fix it.  Smiley

The problem is in the db.h from the berkeley database - it includes ptherad.h, which screws things up.

All you have to do is just append -D__NO_SYSTEM_INCLUDES at the DEFS= in makefile.mingw

Now it compiles
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
Well, you can use quick hacks to solve these specific issues. Remove the definition of 'pthread_t' from the header file and remove the test of the return value of 'CreateThread'.
legendary
Activity: 2053
Merit: 1356
aka tonikt
I can compile 0.3.x in my MinGW - both GUI and the daemon. No problems with that.

And for 0.4.0 this error happens no matter if I try to compile GUI or the daemon - it actually crashes while compiling the first source file.


Code:
$ make bitcoind.exe
g++ -c -mthreads -O2 -w -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL
 -DBOOST_THREAD_USE_LIB -I"K:\boost-1.47.0-mgw" -I"K:\db-4.8.30.NC-mgw\build_unix" -I"K:\openssl-1.0.0d-mgw\include" -I"
K:\wxWidgets-2.9.2-mgw\lib\gcc_lib\mswud" -I"K:\wxWidgets-2.9.2-mgw\include" -o obj/nogui/crypter.o crypter.cpp
In file included from headers.h:94:0,
                 from crypter.cpp:9:
util.h:582:16: error: conflicting declaration 'typedef void* pthread_t'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:571:24: error: 'pthread_t' has a previous declaratio
n as 'typedef struct ptw32_handle_t pthread_t'
util.h: In function 'pthread_t CreateThread(void (*)(void*), void*, bool)':
util.h:598:27: error: no matching function for call to 'ptw32_handle_t::ptw32_handle_t(int)'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note: candidates are: ptw32_handle_t::ptw32_h
andle_t()
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:                 ptw32_handle_t::ptw32_h
andle_t(const ptw32_handle_t&)
util.h:603:28: error: no matching function for call to 'ptw32_handle_t::ptw32_handle_t(int)'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note: candidates are: ptw32_handle_t::ptw32_h
andle_t()
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:                 ptw32_handle_t::ptw32_h
andle_t(const ptw32_handle_t&)
util.h:605:12: error: conversion from 'void*' to non-scalar type 'pthread_t' requested
util.h: In function 'bool AffinityBugWorkaround(void (*)(void*))':
util.h:673:36: error: no match for 'operator!' in '!CreateThread(pfn, 0u, 0)'
util.h:673:36: note: candidate is: operator!(bool)
make: *** [obj/nogui/crypter.o] Error 1
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
I don't believe you can compile the Windows GUI version under MinGW. You should be able to compile the daemon version -- just don't tell it that it's compiling under Windows -- use the standard UNIX makefile. Some tweaks might be needed.
legendary
Activity: 2053
Merit: 1356
aka tonikt
I'm having exactly the same problem.

Any ideas how to deal with it?
full member
Activity: 178
Merit: 100
Certified fox posing as a cat posing as a human
Greetings once again.  Smiley

Yesterday I decided the pick the (somewhat daunting) task to compile Bitcoin from source. So, I grabbed my tools, downloaded all the dependencies with the versions indicated in the build-msw.txt file, used this thread as a reference for the trickier stuff (Only changing the versions for the dependencies where it was relevant), compiled them (Screw you, Boost) and then... nada. Here's the output:

Code:
C:\bitcoin-bitcoin-f8937b2\src>mingw32-make bitcoin.exe bitcoind.exe -f makefile
.mingw
g++ -c -mthreads -O2 -w -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -DWIN32
-D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB -DSTATICLIB -DUS
E_UPNP=0 -I"C:\boost-1.47.0-mgw" -I"C:\db-4.8.30.NC-mgw\build_unix" -I"C:\openss
l-1.0.0d-mgw\include" -I"C:\wxWidgets-2.9.2-mgw\lib\gcc_lib\mswud" -I"C:\wxWidge
ts-2.9.2-mgw\include" -I"C:\miniupnpc-1.6-mgw" -DGUI -o obj/crypter.o crypter.cp
p
In file included from headers.h:94:0,
                 from crypter.cpp:9:
util.h:582:16: error: conflicting declaration 'typedef void* pthread_t'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:571:24: erro
r: 'pthread_t' has a previous declaration as 'typedef struct ptw32_handle_t pthr
ead_t'
util.h: In function 'pthread_t CreateThread(void (*)(void*), void*, bool)':
util.h:598:27: error: no matching function for call to 'ptw32_handle_t::ptw32_ha
ndle_t(int)'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:
 candidates are: ptw32_handle_t::ptw32_handle_t()
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:
                 ptw32_handle_t::ptw32_handle_t(const ptw32_handle_t&)
util.h:603:28: error: no matching function for call to 'ptw32_handle_t::ptw32_ha
ndle_t(int)'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:
 candidates are: ptw32_handle_t::ptw32_handle_t()
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/pthread.h:569:3: note:
                 ptw32_handle_t::ptw32_handle_t(const ptw32_handle_t&)
util.h:605:12: error: conversion from 'void*' to non-scalar type 'pthread_t' req
uested
util.h: In function 'bool AffinityBugWorkaround(void (*)(void*))':
util.h:673:36: error: no match for 'operator!' in '!CreateThread(pfn, 0u, 0)'
util.h:673:36: note: candidate is: operator!(bool)
mingw32-make: *** [obj/crypter.o] Error 1

C:\bitcoin-bitcoin-f8937b2\src>

Also, here's my MinGW version info, provided by this batch file, in case it becomes relevant.

Code:
MINGWBASEDIR=C:\MinGW
gcc version 4.5.2 (GCC)
gcc version 4.5.2 (GCC)
GNU gdb (GDB) 7.2
GNU ld (GNU Binutils) 2.21.1
GNU windres (GNU Binutils) 2.21.1
GNU dlltool (GNU Binutils) 2.21.1
GNU Make 3.82
#define __MINGW32_VERSION           3.18
#define __W32API_VERSION 3.17

This is not the first time I've tried compiling something like this, but certainly it is the first I've tried to do so in Windows, and the first time I've tried with a project this big, so I know I was asking for trouble.  Grin From the output, the first I thought about (Given the declaration conflict) was that the headers were being added in the wrong order, but I tinkered a bit with that, no dice. Any more ideas?  Embarrassed Thanks in advance!
Jump to: