Bitcoin Forum
April 23, 2024, 06:17:35 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problems compiling Bitcoin 0.4.0 in Windows 7 x64 (MinGW Environment)  (Read 4363 times)
ChaosFox (OP)
Full Member
***
Offline Offline

Activity: 178
Merit: 100


Certified fox posing as a cat posing as a human


View Profile
September 26, 2011, 12:35:30 PM
Last edit: September 26, 2011, 12:46:07 PM by ChaosFox
 #1

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) <built-in>
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!

Look! An ad-free signature!
1713896255
Hero Member
*
Offline Offline

Posts: 1713896255

View Profile Personal Message (Offline)

Ignore
1713896255
Reply with quote  #2

1713896255
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713896255
Hero Member
*
Offline Offline

Posts: 1713896255

View Profile Personal Message (Offline)

Ignore
1713896255
Reply with quote  #2

1713896255
Report to moderator
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
October 22, 2011, 06:33:07 PM
 #2

I'm having exactly the same problem.

Any ideas how to deal with it?

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
October 22, 2011, 06:43:33 PM
 #3

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.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
October 22, 2011, 07:08:26 PM
 #4

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) <built-in>
make: *** [obj/nogui/crypter.o] Error 1

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
October 22, 2011, 08:37:46 PM
 #5

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'.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
October 22, 2011, 08:59:04 PM
 #6

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

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
ChaosFox (OP)
Full Member
***
Offline Offline

Activity: 178
Merit: 100


Certified fox posing as a cat posing as a human


View Profile
October 24, 2011, 12:13:13 AM
 #7

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

Look! An ad-free signature!
shakezula
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250



View Profile
May 17, 2013, 04:35:58 PM
 #8

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!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!