Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Wolf0 on July 22, 2013, 11:54:53 PM



Title: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Wolf0 on July 22, 2013, 11:54:53 PM
... 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?


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 07:14:13 AM
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 :).

Thanks,
Dia


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 07:23:30 AM
#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


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 08:40:54 AM
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 :).

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


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 09:48:21 AM
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


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Remember remember the 5th of November on July 24, 2013, 11:02:55 AM
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.


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 12:45:48 PM
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


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on July 24, 2013, 01:00:14 PM
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


Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: cabin on August 28, 2013, 02:19:13 AM
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



Title: Re: After compiling Bitcoin 0.6.x for Windows with my custom MinGW-w64 build...
Post by: Diapolo on August 30, 2013, 11:16:23 PM
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 :).

Dia