Author

Topic: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build... (Read 3420 times)

member
Activity: 81
Merit: 1002
It was only the wind.
This bug is now irrelevant because of the move to the autotools, so I'm locking this thread.
member
Activity: 81
Merit: 1002
It was only the wind.
I get these boost errors on mingw64 as well:

c:/data/miner2/deps/boost_1_54_0/boost/detail/interlocked.hpp:161:37: error: '_I
nterlockedExchange' is not a member of 'boost::detail'
 # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange

Wolf can you explain what and where the BOOST_USE_WINDOWS_H fix goes?

Edit: Got it.. using lines like these in makefile.mingw fixed it:

DEFS=-DWIN32_LEAN_AND_MEAN -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_USE_WINDOWS_H

LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static



Yeah, it goes in DEFS. I'm hoping the devs will put it in there so people don't have to fix it.

If you want to help us out go ahead and create a pull-request on https://github.com/bitcoin/bitcoin/pulls Smiley.

Dia

I'm trying, but my fork isn't in the list.
member
Activity: 81
Merit: 1002
It was only the wind.
I get these boost errors on mingw64 as well:

c:/data/miner2/deps/boost_1_54_0/boost/detail/interlocked.hpp:161:37: error: '_I
nterlockedExchange' is not a member of 'boost::detail'
 # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange

Wolf can you explain what and where the BOOST_USE_WINDOWS_H fix goes?

Edit: Got it.. using lines like these in makefile.mingw fixed it:

DEFS=-DWIN32_LEAN_AND_MEAN -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_USE_WINDOWS_H

LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static



Yeah, it goes in DEFS. I'm hoping the devs will put it in there so people don't have to fix it.
member
Activity: 81
Merit: 1002
It was only the wind.
member
Activity: 81
Merit: 1002
It was only the wind.
member
Activity: 81
Merit: 1002
It was only the wind.
Bump so devs see this.
member
Activity: 81
Merit: 1002
It was only the wind.
member
Activity: 81
Merit: 1002
It was only the wind.
I think I exceeded the max post length, so here: http://pastebin.com/SNjP3Htj
member
Activity: 81
Merit: 1002
It was only the wind.
hero member
Activity: 772
Merit: 500
I get these boost errors on mingw64 as well:

c:/data/miner2/deps/boost_1_54_0/boost/detail/interlocked.hpp:161:37: error: '_I
nterlockedExchange' is not a member of 'boost::detail'
 # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange

Wolf can you explain what and where the BOOST_USE_WINDOWS_H fix goes?

Edit: Got it.. using lines like these in makefile.mingw fixed it:

DEFS=-DWIN32_LEAN_AND_MEAN -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_USE_WINDOWS_H

LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static



Yeah, it goes in DEFS. I'm hoping the devs will put it in there so people don't have to fix it.

If you want to help us out go ahead and create a pull-request on https://github.com/bitcoin/bitcoin/pulls Smiley.

Dia
sr. member
Activity: 604
Merit: 250
I get these boost errors on mingw64 as well:

c:/data/miner2/deps/boost_1_54_0/boost/detail/interlocked.hpp:161:37: error: '_I
nterlockedExchange' is not a member of 'boost::detail'
 # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange

Wolf can you explain what and where the BOOST_USE_WINDOWS_H fix goes?

Edit: Got it.. using lines like these in makefile.mingw fixed it:

DEFS=-DWIN32_LEAN_AND_MEAN -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DBOOST_USE_WINDOWS_H

LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static

hero member
Activity: 772
Merit: 500
I get the following:

Code:
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-par
ameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D
USE_IPV6=1 -I/cygdrive/c/deps/bitcoin/src/leveldb/include -I/cygdrive/c/deps/bit
coin/src/leveldb/helpers -I"/cygdrive/c/deps/bitcoin/src"  -I"C:/deps/boost_1_54
_0"  -I"C:/deps/db-4.8.30.NC/build_unix"  -I"C:/deps/win64-openssl/include" -o o
bj/alert.o alert.cpp
In file included from netbase.h:11:0,
                 from util.h:30,
                 from alert.h:13,
                 from alert.cpp:11:
compat.h:29:15: error: conflicting declaration 'typedef u_int SOCKET'
 typedef u_int SOCKET;
               ^
In file included from c:\mingw\x86_64-w64-mingw32\include\winsock2.h:55:0,
                 from compat.h:15,
                 from netbase.h:11,
                 from util.h:30,
                 from alert.h:13,
                 from alert.cpp:11:
c:\mingw\x86_64-w64-mingw32\include\psdk_inc\_socket_types.h:11:18: error: 'SOCK
ET' has a previous declaration as 'typedef UINT_PTR SOCKET'
 typedef UINT_PTR SOCKET;
                  ^
In file included from alert.h:13:0,
                 from alert.cpp:11:
util.h:211:57: error: 'pid_t' has not been declared
 void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
                                                         ^
makefile.mingw:127: recipe for target `obj/alert.o' failed
make: *** [obj/alert.o] Error 1

About #3, I think we're running into this bug: https://svn.boost.org/trac/boost/ticket/4849

The CreatePidFile() error will be gone with my pull included in master. I'll also create a pull to remove the typedef u_int SOCKET; from compat.h.
For the Boost bug you mention, it seems that was fixed long ago in 1.47.0 and we are currently using 1.50 for our Windows builds (my own build is using 1.54).
Which Boost version are you using?

Dia

My build is also using 1.54. Apparently it wasn't fixed.

As I said, I never saw that Boost error and it seems neither does our Gitian build suffer from this or our pulltester.
Can you post the boost related compiler errors/warnings also?

Dia
hero member
Activity: 772
Merit: 500
I get the following:

Code:
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-par
ameter -g -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D
USE_IPV6=1 -I/cygdrive/c/deps/bitcoin/src/leveldb/include -I/cygdrive/c/deps/bit
coin/src/leveldb/helpers -I"/cygdrive/c/deps/bitcoin/src"  -I"C:/deps/boost_1_54
_0"  -I"C:/deps/db-4.8.30.NC/build_unix"  -I"C:/deps/win64-openssl/include" -o o
bj/alert.o alert.cpp
In file included from netbase.h:11:0,
                 from util.h:30,
                 from alert.h:13,
                 from alert.cpp:11:
compat.h:29:15: error: conflicting declaration 'typedef u_int SOCKET'
 typedef u_int SOCKET;
               ^
In file included from c:\mingw\x86_64-w64-mingw32\include\winsock2.h:55:0,
                 from compat.h:15,
                 from netbase.h:11,
                 from util.h:30,
                 from alert.h:13,
                 from alert.cpp:11:
c:\mingw\x86_64-w64-mingw32\include\psdk_inc\_socket_types.h:11:18: error: 'SOCK
ET' has a previous declaration as 'typedef UINT_PTR SOCKET'
 typedef UINT_PTR SOCKET;
                  ^
In file included from alert.h:13:0,
                 from alert.cpp:11:
util.h:211:57: error: 'pid_t' has not been declared
 void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
                                                         ^
makefile.mingw:127: recipe for target `obj/alert.o' failed
make: *** [obj/alert.o] Error 1

About #3, I think we're running into this bug: https://svn.boost.org/trac/boost/ticket/4849

The CreatePidFile() error will be gone with my pull included in master. I'll also create a pull to remove the typedef u_int SOCKET; from compat.h.
For the Boost bug you mention, it seems that was fixed long ago in 1.47.0 and we are currently using 1.50 for our Windows builds (my own build is using 1.54).
Which Boost version are you using?

Dia
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
MinGW-W64 != MinGW32. Both projects are maintained by different people afaik. I've had some weird errors with mingw64 than with regular x86 mingw on many non-bitcoin related projects.

Plus, 0.6.2 should be obsolete.
hero member
Activity: 772
Merit: 500
Strange, you should at least run into problems #1, #2, and #3.

#1 It makes no difference, I removed the typedef u_int to SOCKET and compiled, which generates no error or warning just like before. Anyway, if this is not needed we should perhaps also just remove it from the code. What compiler error do you get from this, can you post it?

#2 My pull also prevents this from beeing a problem without new includes for WIN32. As we often use #ifdef WIN32, is this correct with mingw-64 or a 64 bit compiler also or could that cause your errors? Same question as above, can you post compiler errors / warnings for this?

#3 No idea for this, can you link me to a page that gives info about when to define or set BOOST_USE_WINDOWS_H.

One last thing, I compile bitcoin-qt, not bitcoind, perhaps that also makes a difference...

Thanks,
Dia
hero member
Activity: 772
Merit: 500
Can you please contribute via some pull-requests or at least open an issue ticket at Github (https://github.com/bitcoin/bitcoin/issues)?

Perhaps you can at least give some information why your points need fixing, as (at least) I'm currently not seeing any obious compiler errors or warnings when building with MinGW 4.8.1 and current master Smiley.

Thanks,
Dia

Are you using MinGW-w64, or the old MinGW that doesn't support 64 bit?

I'm using Mingwbuilds (http://sourceforge.net/projects/mingwbuilds/) and from this a x86 version of MinGW 4.8.1.

Dia
hero member
Activity: 772
Merit: 500
#2: The type pid_t isn't defined because the includes for sys/types.h and sys/time.h are excluded for Windows. God knows why. Open util.h and move line 12 to a new line AFTER the include of sys/time.h. (sys/resource.h does not exist on Windows systems.)

pid_t is never used for Windows builds AFAIK, so it would be an idea to guard CreatePidFile() by #ifndef WIN32.

https://github.com/bitcoin/bitcoin/pull/2855

Dia
hero member
Activity: 772
Merit: 500
Can you please contribute via some pull-requests or at least open an issue ticket at Github (https://github.com/bitcoin/bitcoin/issues)?

Perhaps you can at least give some information why your points need fixing, as (at least) I'm currently not seeing any obious compiler errors or warnings when building with MinGW 4.8.1 and current master Smiley.

Thanks,
Dia
member
Activity: 81
Merit: 1002
It was only the wind.
... I am of the opinion that whoever designed the Windows compatibility should be shot, although I did finally get the daemon to compile. Is 0.8.x any better?
Jump to: