libleveldb.a not generated on Windows build - docs problem? #1964

Closed
dscotese opened this Issue Oct 28, 2012 · 32 comments

Comments

Projects
None yet
4 participants
@dscotese

I tried building on windows and got this:

error: No rule to make target 'c:/Qt/projects/bitcoin/src/leveldb/libleveldb.a', needed by 'debug/bitcoin-qt.exe'. Stop.

The build-mws.txt, README_windows.txt, and readem-qt.rst files do not make any reference to building the libleveldb.a file outside of the bitcoin build.

I did not separately download and build the four items listed in build-msw.txt, but none of them are leveldb. I downloaded and installed the dependencies as instructed in the readme-qt.rst file.

This led me to lines 100-104 of bitcoin-qt.pro "# make an educated guess about what the ranlib command is called". I'm looking up this "ranlib" thing...

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Oct 28, 2012

If you are native on Windows, you should just comment out from https://github.com/bitcoin/bitcoin/blob/master/bitcoin-qt.pro#L97 up to line 111, as this currently doesn't work on Windows.

I guess you have MinGW installed, so you are able to compile LevelDB via MinGW Shell.

cd /c/Users/Diapolo/bitcoin.Qt/src/leveldb (use your path to leveldb dir)
TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a

I also needed to edit the src\leveldb\build_detect_platform file to include my used Boost version (1.51 in my case), which changes line 119 into PLATFORM_EXTRALIBS="-lboost_system-mgw47-mt-s-1_51 -lboost_filesystem-mgw47-mt-s-1_51 -lboost_thread-mgw47-mt-s-1_51 -lboost_chrono-mgw47-mt-s-1_51"

Edit: Pull #1940 is related to this, perhaps you want to take a look there, too.

Diapolo commented Oct 28, 2012

If you are native on Windows, you should just comment out from https://github.com/bitcoin/bitcoin/blob/master/bitcoin-qt.pro#L97 up to line 111, as this currently doesn't work on Windows.

I guess you have MinGW installed, so you are able to compile LevelDB via MinGW Shell.

cd /c/Users/Diapolo/bitcoin.Qt/src/leveldb (use your path to leveldb dir)
TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a

I also needed to edit the src\leveldb\build_detect_platform file to include my used Boost version (1.51 in my case), which changes line 119 into PLATFORM_EXTRALIBS="-lboost_system-mgw47-mt-s-1_51 -lboost_filesystem-mgw47-mt-s-1_51 -lboost_thread-mgw47-mt-s-1_51 -lboost_chrono-mgw47-mt-s-1_51"

Edit: Pull #1940 is related to this, perhaps you want to take a look there, too.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Oct 28, 2012

The Boost version I have came in the deps zip, referred to in the readme-qt.rst, but I run into a problem which appears to be inherent to the version of boost that is included in that zip, which has no directory boost/io:
line 15 of boost\date_time\gregorian\gregorian_io.hpp:
#include <boost/io/ios_state.hpp>

That zip is signed by Witchspace witchspace81@gmail.com so I'm contacting him to see if he has a zip with a consistent set of boost files. I think either when he compiled some of the boost headers were unnecessary, or else he failed to include them in the dependencies archive he made.

It's complaining with

In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/
boost/thread/detail/platform.hpp:17:0,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/
boost/thread/once.hpp:12,
                 from util/env_boost.cc:59:
c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/boost/config/requires_
threads.hpp:29:4: error: #error "Threading support unavaliable: it has been expl
icitly disabled with BOOST_DISABLE_THREADS"

So I will try compiling the latest boost on my own like you did.

The Boost version I have came in the deps zip, referred to in the readme-qt.rst, but I run into a problem which appears to be inherent to the version of boost that is included in that zip, which has no directory boost/io:
line 15 of boost\date_time\gregorian\gregorian_io.hpp:
#include <boost/io/ios_state.hpp>

That zip is signed by Witchspace witchspace81@gmail.com so I'm contacting him to see if he has a zip with a consistent set of boost files. I think either when he compiled some of the boost headers were unnecessary, or else he failed to include them in the dependencies archive he made.

It's complaining with

In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/
boost/thread/detail/platform.hpp:17:0,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/
boost/thread/once.hpp:12,
                 from util/env_boost.cc:59:
c:\mingw\bin\../lib/gcc/mingw32/4.7.0/../../../../include/boost/config/requires_
threads.hpp:29:4: error: #error "Threading support unavaliable: it has been expl
icitly disabled with BOOST_DISABLE_THREADS"

So I will try compiling the latest boost on my own like you did.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Oct 29, 2012

I was able to compile the boost libraries I need, but only under Windows - making .lib files, not .a files. I suppose that's no good for compiling bitcoin-qt under mingw. I see three options and I wonder which one might be best:

  1. Install Cygwin and compile the Boost libraries that are needed (chrono (I guess), filesystem, system, and thread).
  2. Keep adding the Boost 1.43 files and try to solve the "Threading support unavailable: it has been explicitly disabled with BOOST_DISABLE_THREADS" error. (This looks like it might be a Windows/Boost problem that was resolved after version 1.43)
  3. Wait for someone to update the dependencies file to the latest version of Boost.

Any recommendations?

I was able to compile the boost libraries I need, but only under Windows - making .lib files, not .a files. I suppose that's no good for compiling bitcoin-qt under mingw. I see three options and I wonder which one might be best:

  1. Install Cygwin and compile the Boost libraries that are needed (chrono (I guess), filesystem, system, and thread).
  2. Keep adding the Boost 1.43 files and try to solve the "Threading support unavailable: it has been explicitly disabled with BOOST_DISABLE_THREADS" error. (This looks like it might be a Windows/Boost problem that was resolved after version 1.43)
  3. Wait for someone to update the dependencies file to the latest version of Boost.

Any recommendations?

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Oct 29, 2012

I would vote for 1), as there is currently no core-dev using Windows as native OS, which means the deps-package won't get an update. I compiled Boost only using Windows command-line, which IS a pain ^^.

Diapolo commented Oct 29, 2012

I would vote for 1), as there is currently no core-dev using Windows as native OS, which means the deps-package won't get an update. I compiled Boost only using Windows command-line, which IS a pain ^^.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Oct 29, 2012

Member

Note that you need msys/mingw. You can run mingw compilation from cygwin,
however compiling bitcoin against cygwin (which is a linux-ish
compatibility layer on windows) is untested.
Op 29 okt. 2012 07:50 schreef "Philip Kaufmann" notifications@github.com
het volgende:

I would vote for 1), as there is currently no core-dev using Windows as
native OS.


Reply to this email directly or view it on GitHubhttps://github.com/bitcoin/bitcoin/issues/1964#issuecomment-9857610.

Member

laanwj commented Oct 29, 2012

Note that you need msys/mingw. You can run mingw compilation from cygwin,
however compiling bitcoin against cygwin (which is a linux-ish
compatibility layer on windows) is untested.
Op 29 okt. 2012 07:50 schreef "Philip Kaufmann" notifications@github.com
het volgende:

I would vote for 1), as there is currently no core-dev using Windows as
native OS.


Reply to this email directly or view it on GitHubhttps://github.com/bitcoin/bitcoin/issues/1964#issuecomment-9857610.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Oct 29, 2012

It would be the Boost libraries that I'd compile under Cygwin, and then
update the dependencies archive. I'd still do bitcoin-qt under qt with
mingw as the windows instructions describe.

It would be the Boost libraries that I'd compile under Cygwin, and then
update the dependencies archive. I'd still do bitcoin-qt under qt with
mingw as the windows instructions describe.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Oct 31, 2012

I got cygwin, and started following the instructions for compiling boost libraries (http://www.boost.org/doc/libs/1_51_0/more/getting_started/unix-variants.html - note that the Cygwin bash shell puts me on a POSIX platform) and got an error indicating that bash was trying to execute blank lines: "$'\r': command not found in Cygwin" Tamil's post helped with that. I'm now converting all the boost code to unix line endings and will keep y'all posted.

I still assume I'm making some boneheaded mistakes and hoping someone will point them out. That's why I'm posting my progress. For example, is it reasonable to expect the Boost libraries that I compile under cygwin to be valid for use under MinGW when I use them to build the LevelDB libraries? And then to expect those leveldb libraries to work when I compile bitcoin under QT? There's some compiler static/dynamic linking / architecture stuff going on there that daunts me. And something I read somewhere suggested that code compiled under Cygwin often requires the Cygwin dll to work.

I got cygwin, and started following the instructions for compiling boost libraries (http://www.boost.org/doc/libs/1_51_0/more/getting_started/unix-variants.html - note that the Cygwin bash shell puts me on a POSIX platform) and got an error indicating that bash was trying to execute blank lines: "$'\r': command not found in Cygwin" Tamil's post helped with that. I'm now converting all the boost code to unix line endings and will keep y'all posted.

I still assume I'm making some boneheaded mistakes and hoping someone will point them out. That's why I'm posting my progress. For example, is it reasonable to expect the Boost libraries that I compile under cygwin to be valid for use under MinGW when I use them to build the LevelDB libraries? And then to expect those leveldb libraries to work when I compile bitcoin under QT? There's some compiler static/dynamic linking / architecture stuff going on there that daunts me. And something I read somewhere suggested that code compiled under Cygwin often requires the Cygwin dll to work.

@gavinandresen

This comment has been minimized.

Show comment
Hide comment
@gavinandresen

gavinandresen Oct 31, 2012

Contributor

My two cents:

Combining multiple tool chains (e.g. mingw and cygwin, or mingw and visual studio) is a bad idea. Try to compile everything with the same compiler.

I would very much like to see somebody figure out how to make everything build with the Visual Studio toolchain, because I think that is the toolchain the vast majority of Windows programmers already have. That is a big project, though...

Contributor

gavinandresen commented Oct 31, 2012

My two cents:

Combining multiple tool chains (e.g. mingw and cygwin, or mingw and visual studio) is a bad idea. Try to compile everything with the same compiler.

I would very much like to see somebody figure out how to make everything build with the Visual Studio toolchain, because I think that is the toolchain the vast majority of Windows programmers already have. That is a big project, though...

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Nov 1, 2012

Member

@dscotese Yes you need to build everything against MingW libs. If any part links against Visual C or MingW, undebuggable madness ensues. As a plus, you will learn a lot about linker internals 🐸!

@gavinandresen I have a build for bitcoind + bitcoin-qt + most deps (everything in one project for easy building) for VS somewhere, but my Visual Studio trial license expired along the way (and there's no way I'm going to put any money into it).
It'd be a matter of adding leveldb to get it to work. Anyway, no one showed interest up until now. There are just not that many windows developers partaking in open source, and those that do (like Diapolo) seem to use the mingw toolchain / qt creator.

Alternatively (it's the option I prefer at the moment) is that we add a cmake build system and let it generate all the build scripts for all platforms for us. qmake scales very badly to big projects and is starting to show its seams, and will likely be deprecated somewhere along the road to Qt5. I may get around to this.

Member

laanwj commented Nov 1, 2012

@dscotese Yes you need to build everything against MingW libs. If any part links against Visual C or MingW, undebuggable madness ensues. As a plus, you will learn a lot about linker internals 🐸!

@gavinandresen I have a build for bitcoind + bitcoin-qt + most deps (everything in one project for easy building) for VS somewhere, but my Visual Studio trial license expired along the way (and there's no way I'm going to put any money into it).
It'd be a matter of adding leveldb to get it to work. Anyway, no one showed interest up until now. There are just not that many windows developers partaking in open source, and those that do (like Diapolo) seem to use the mingw toolchain / qt creator.

Alternatively (it's the option I prefer at the moment) is that we add a cmake build system and let it generate all the build scripts for all platforms for us. qmake scales very badly to big projects and is starting to show its seams, and will likely be deprecated somewhere along the road to Qt5. I may get around to this.

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Nov 1, 2012

I don't have the need for or the feeling to miss MS Visual C++ support, I'm loving my MinGW / Qt Creator toolchain :). What I would love to see is a working solution to compile LevelDB via that toolset.

I'm able to compile OpenSSL, BDB and Boost dependencies, which is all I need. Currently LevelDB was build via the MinGW shell, which is okay, but this process is not all that smooth. Well it doesn't really matter, as we seem to not update the LevelDB code that often anyway.

Diapolo commented Nov 1, 2012

I don't have the need for or the feeling to miss MS Visual C++ support, I'm loving my MinGW / Qt Creator toolchain :). What I would love to see is a working solution to compile LevelDB via that toolset.

I'm able to compile OpenSSL, BDB and Boost dependencies, which is all I need. Currently LevelDB was build via the MinGW shell, which is okay, but this process is not all that smooth. Well it doesn't really matter, as we seem to not update the LevelDB code that often anyway.

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Nov 1, 2012

@dscotese This is how I build the boost libs with MinGW on Windows:

Example for Boost 1.49 extracted to D:\boost_1_49_0 in my case!

  • D:\boost_1_49_0 must be set as BOOST_ROOT environment variable

open D:\boost_1_49_0\bootstrap.bat
replace set toolset=msvc with set toolset=gcc


open D:\boost_1_49_0\tools\build\v2\engine\build.bat and search for mingw

replace existing code with:
if EXIST "D:\MinGW\bin\gcc.exe" (
set "BOOST_JAM_TOOLSET=mingw"
set "BOOST_JAM_TOOLSET_ROOT=D:\MinGW"

My MinGW installation resides in D:\MinGW\ you need to change this, so it matches your config!


open Qt 4.8.0 for Desktop (MinGW) (Qt command-prompt) and cd D:\boost_1_49_0

You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!


enter bootstrap.bat gcc

This builds b2, the Boost build engine V2!


create the libs needed by Bitcoin:
b2 --toolset=gcc --build-dir=D:\boost_1_49_0\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

This should create all *.a files you need for Bitcoin-Qt and they can be found in D:\boost_1_49_0\build, just search for *.a in that dir ;).

Hope this helps!

Diapolo commented Nov 1, 2012

@dscotese This is how I build the boost libs with MinGW on Windows:

Example for Boost 1.49 extracted to D:\boost_1_49_0 in my case!

  • D:\boost_1_49_0 must be set as BOOST_ROOT environment variable

open D:\boost_1_49_0\bootstrap.bat
replace set toolset=msvc with set toolset=gcc


open D:\boost_1_49_0\tools\build\v2\engine\build.bat and search for mingw

replace existing code with:
if EXIST "D:\MinGW\bin\gcc.exe" (
set "BOOST_JAM_TOOLSET=mingw"
set "BOOST_JAM_TOOLSET_ROOT=D:\MinGW"

My MinGW installation resides in D:\MinGW\ you need to change this, so it matches your config!


open Qt 4.8.0 for Desktop (MinGW) (Qt command-prompt) and cd D:\boost_1_49_0

You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!


enter bootstrap.bat gcc

This builds b2, the Boost build engine V2!


create the libs needed by Bitcoin:
b2 --toolset=gcc --build-dir=D:\boost_1_49_0\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

This should create all *.a files you need for Bitcoin-Qt and they can be found in D:\boost_1_49_0\build, just search for *.a in that dir ;).

Hope this helps!

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Nov 2, 2012

Very helpful. I balked when I saw that Boost hadn't tested MinGW, and that's why I went to Cygwin. But I just followed your instructions and they worked perfectly. Below are some edits (in bold)

Example for Boost 1.51 extracted to what we'll use as BOOST_ROOT below:

Set the BOOST_ROOT environment variable to the location of your boost_1_51 directory. (I didn't do this, but that was the directory I was in the whole time)

open BOOST_ROOT\bootstrap.bat
replace set toolset=msvc with set toolset=gcc

open BOOST_ROOT\tools\build\v2\engine\build.bat and search for mingw

replace existing code with:

if EXIST "D:\MinGW\bin\gcc.exe" (
set "BOOST_JAM_TOOLSET=mingw"
set "BOOST_JAM_TOOLSET_ROOT=D:\MinGW\"

My MinGW installation resides in D:\MinGW\ you need to change this, so it matches your config!

open Qt 4.8.0 for Desktop (MinGW) (Qt command-prompt) and cd %BOOST_ROOT%

You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!

enter bootstrap.bat gcc

This builds b2, the Boost build engine V2!

create the libs needed by Bitcoin:

b2 --toolset=gcc --build-dir=%BOOST_ROOT%\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

This should create all _.a files you need for Bitcoin-Qt and they can be found in _BOOST_ROOT*\build, just search for *.a in that dir ;).

That created the .a files, which I then put into MinGW\lib. I did all this in the QT 4.8.3 command shell. But when I tried make clean in there, I got "CreateProcess(...) failed" because it wanted to use sh, which isn't available in there. So I opened the MinGW shell, didn't bother with make clean, but went right to TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a which worked.

Now I will try to compile bitcoin-qt.

dscotese commented Nov 2, 2012

Very helpful. I balked when I saw that Boost hadn't tested MinGW, and that's why I went to Cygwin. But I just followed your instructions and they worked perfectly. Below are some edits (in bold)

Example for Boost 1.51 extracted to what we'll use as BOOST_ROOT below:

Set the BOOST_ROOT environment variable to the location of your boost_1_51 directory. (I didn't do this, but that was the directory I was in the whole time)

open BOOST_ROOT\bootstrap.bat
replace set toolset=msvc with set toolset=gcc

open BOOST_ROOT\tools\build\v2\engine\build.bat and search for mingw

replace existing code with:

if EXIST "D:\MinGW\bin\gcc.exe" (
set "BOOST_JAM_TOOLSET=mingw"
set "BOOST_JAM_TOOLSET_ROOT=D:\MinGW\"

My MinGW installation resides in D:\MinGW\ you need to change this, so it matches your config!

open Qt 4.8.0 for Desktop (MinGW) (Qt command-prompt) and cd %BOOST_ROOT%

You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!

enter bootstrap.bat gcc

This builds b2, the Boost build engine V2!

create the libs needed by Bitcoin:

b2 --toolset=gcc --build-dir=%BOOST_ROOT%\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

This should create all _.a files you need for Bitcoin-Qt and they can be found in _BOOST_ROOT*\build, just search for *.a in that dir ;).

That created the .a files, which I then put into MinGW\lib. I did all this in the QT 4.8.3 command shell. But when I tried make clean in there, I got "CreateProcess(...) failed" because it wanted to use sh, which isn't available in there. So I opened the MinGW shell, didn't bother with make clean, but went right to TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a which worked.

Now I will try to compile bitcoin-qt.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Nov 2, 2012

I'm getting two errors, one insinuating that the compiler was passed -fno-rtti (and then the code tries to use runtime typing), and the other that insinuates that exception handling is disabled by default. Where do I look to alter the flags passed to the compiler?

dscotese commented Nov 2, 2012

I'm getting two errors, one insinuating that the compiler was passed -fno-rtti (and then the code tries to use runtime typing), and the other that insinuates that exception handling is disabled by default. Where do I look to alter the flags passed to the compiler?

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Nov 2, 2012

I'm glad you could figure out that Boost stuff now, btw. @laanwj do you think it makes sense to keep that howto somewhere in the doc folder?

Are you using the default MinGW that ships with the Qt SDK?

My toolchain is using -rtti, which is coming from \mkspecs\win32-g++\qmake.conf. I'm not sure about that exception handling thing, can you post compiler / linker output?

Diapolo commented Nov 2, 2012

I'm glad you could figure out that Boost stuff now, btw. @laanwj do you think it makes sense to keep that howto somewhere in the doc folder?

Are you using the default MinGW that ships with the Qt SDK?

My toolchain is using -rtti, which is coming from \mkspecs\win32-g++\qmake.conf. I'm not sure about that exception handling thing, can you post compiler / linker output?

@gavinandresen

This comment has been minimized.

Show comment
Hide comment
@gavinandresen

gavinandresen Nov 2, 2012

Contributor

Once you get everything working properly, please update doc/build.msw.txt and doc/readme-qt.rst and submit a pull request so we don't forget all of your hard work to get this all working properly.

Contributor

gavinandresen commented Nov 2, 2012

Once you get everything working properly, please update doc/build.msw.txt and doc/readme-qt.rst and submit a pull request so we don't forget all of your hard work to get this all working properly.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Nov 2, 2012

I installed MinGW before I installed QT, to the root of C, so I compiled the Boost libs with the MinGW in the root of C. There are only 4 items in my C:\QT\4.8.3 folder that contain "MinGW" so I think my QT installation detected my existing MinGW installation and didn't install its own.

@gavinandresen The instructions for Windows have a step to download the dependencies archive, which has an old version of Boost in it. Do you recommend updating the archive with the newer version, or updating the instructions to include compiling version 1.51 of the Boost files we need?

Since compiler output includes errors that will disappear when earlier errors are fixed, I'm only posting the first chunk of it here. Let me know if the errors listed are ones I can ignore (and if it's easy to suppress them on the grounds that they are useless, how do I do that?):

14:48:53: Running steps for project bitcoin-qt...
14:48:53: Starting: "C:\Qt\4.8.3\bin\qmake.exe" C:\Qt\projects\bitcoin\bitcoin-qt.pro -r -spec win32-g++
The directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP supportThe directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP supportThe directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP support'.' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
Project MESSAGE: Building with UPNP support
Project MESSAGE: Building with UPNP support
Project MESSAGE: Building with UPNP support
14:48:58: The process "C:\Qt\4.8.3\bin\qmake.exe" exited normally.
14:48:58: Starting: "C:\MinGW\bin\mingw32-make.exe" 
C:/MinGW/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Documents and Settings/dscotese/bitcoin-qt-build-desktop-Qt_4_8_3__4_8_3__Release'
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/sendcoinsdialog.ui -o build/ui_sendcoinsdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/addressbookpage.ui -o build/ui_addressbookpage.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/signverifymessagedialog.ui -o build/ui_signverifymessagedialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/aboutdialog.ui -o build/ui_aboutdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/editaddressdialog.ui -o build/ui_editaddressdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/transactiondescdialog.ui -o build/ui_transactiondescdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/overviewpage.ui -o build/ui_overviewpage.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/sendcoinsentry.ui -o build/ui_sendcoinsentry.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/askpassphrasedialog.ui -o build/ui_askpassphrasedialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/rpcconsole.ui -o build/ui_rpcconsole.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/optionsdialog.ui -o build/ui_optionsdialog.h
g++ -c -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -O2 -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST -I'../../../Qt/4.8.3/include/QtCore' -I'../../../Qt/4.8.3/include/QtGui' -I'../../../Qt/4.8.3/include' -I'../../../Qt/projects/bitcoin/src' -I'../../../Qt/projects/bitcoin/src/json' -I'../../../Qt/projects/bitcoin/src/qt' -I'../../../Qt/projects/bitcoin/src/leveldb/include' -I'../../../Qt/projects/bitcoin/src/leveldb/helpers' -I'../../../Qt/4.8.3/include/ActiveQt' -I'build' -I'build' -I'../../../Qt/4.8.3/mkspecs/win32-g++' -o build/bitcoin.o ../../../Qt/projects/bitcoin/src/qt/bitcoin.cpp
In file included from ../../../Qt/4.8.3/include/boost/thread/exceptions.hpp:22:0,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/thread_primitives.hpp:16,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/basic_timed_mutex.hpp:14,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/mutex.hpp:9,
                 from ../../../Qt/4.8.3/include/boost/thread/mutex.hpp:14,
                 from ../../../Qt/projects/bitcoin/src/allocators.h:10,
                 from ../../../Qt/projects/bitcoin/src/qt/walletmodel.h:6,
                 from ../../../Qt/projects/bitcoin/src/qt/bitcoin.cpp:6:
../../../Qt/4.8.3/include/boost/system/system_error.hpp: In member function 'virtual const char* boost::system::system_error::what() const':
../../../Qt/4.8.3/include/boost/system/system_error.hpp:70:16: error: exception handling disabled, use -fexceptions to enable

dscotese commented Nov 2, 2012

I installed MinGW before I installed QT, to the root of C, so I compiled the Boost libs with the MinGW in the root of C. There are only 4 items in my C:\QT\4.8.3 folder that contain "MinGW" so I think my QT installation detected my existing MinGW installation and didn't install its own.

@gavinandresen The instructions for Windows have a step to download the dependencies archive, which has an old version of Boost in it. Do you recommend updating the archive with the newer version, or updating the instructions to include compiling version 1.51 of the Boost files we need?

Since compiler output includes errors that will disappear when earlier errors are fixed, I'm only posting the first chunk of it here. Let me know if the errors listed are ones I can ignore (and if it's easy to suppress them on the grounds that they are useless, how do I do that?):

14:48:53: Running steps for project bitcoin-qt...
14:48:53: Starting: "C:\Qt\4.8.3\bin\qmake.exe" C:\Qt\projects\bitcoin\bitcoin-qt.pro -r -spec win32-g++
The directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP supportThe directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP supportThe directory name is invalid.
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
Could not find qmake configuration directoryCould not find qmake configuration fileProject MESSAGE: Building with UPNP support'.' is not recognized as an internal or external command,
operable program or batch file.
'.' is not recognized as an internal or external command,
operable program or batch file.
Project MESSAGE: Building with UPNP support
Project MESSAGE: Building with UPNP support
Project MESSAGE: Building with UPNP support
14:48:58: The process "C:\Qt\4.8.3\bin\qmake.exe" exited normally.
14:48:58: Starting: "C:\MinGW\bin\mingw32-make.exe" 
C:/MinGW/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Documents and Settings/dscotese/bitcoin-qt-build-desktop-Qt_4_8_3__4_8_3__Release'
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/sendcoinsdialog.ui -o build/ui_sendcoinsdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/addressbookpage.ui -o build/ui_addressbookpage.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/signverifymessagedialog.ui -o build/ui_signverifymessagedialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/aboutdialog.ui -o build/ui_aboutdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/editaddressdialog.ui -o build/ui_editaddressdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/transactiondescdialog.ui -o build/ui_transactiondescdialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/overviewpage.ui -o build/ui_overviewpage.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/sendcoinsentry.ui -o build/ui_sendcoinsentry.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/askpassphrasedialog.ui -o build/ui_askpassphrasedialog.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/rpcconsole.ui -o build/ui_rpcconsole.h
c:/Qt/4.8.3/bin/uic.exe ../../../Qt/projects/bitcoin/src/qt/forms/optionsdialog.ui -o build/ui_optionsdialog.h
g++ -c -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -O2 -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DWIN32 -D_MT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST -I'../../../Qt/4.8.3/include/QtCore' -I'../../../Qt/4.8.3/include/QtGui' -I'../../../Qt/4.8.3/include' -I'../../../Qt/projects/bitcoin/src' -I'../../../Qt/projects/bitcoin/src/json' -I'../../../Qt/projects/bitcoin/src/qt' -I'../../../Qt/projects/bitcoin/src/leveldb/include' -I'../../../Qt/projects/bitcoin/src/leveldb/helpers' -I'../../../Qt/4.8.3/include/ActiveQt' -I'build' -I'build' -I'../../../Qt/4.8.3/mkspecs/win32-g++' -o build/bitcoin.o ../../../Qt/projects/bitcoin/src/qt/bitcoin.cpp
In file included from ../../../Qt/4.8.3/include/boost/thread/exceptions.hpp:22:0,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/thread_primitives.hpp:16,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/basic_timed_mutex.hpp:14,
                 from ../../../Qt/4.8.3/include/boost/thread/win32/mutex.hpp:9,
                 from ../../../Qt/4.8.3/include/boost/thread/mutex.hpp:14,
                 from ../../../Qt/projects/bitcoin/src/allocators.h:10,
                 from ../../../Qt/projects/bitcoin/src/qt/walletmodel.h:6,
                 from ../../../Qt/projects/bitcoin/src/qt/bitcoin.cpp:6:
../../../Qt/4.8.3/include/boost/system/system_error.hpp: In member function 'virtual const char* boost::system::system_error::what() const':
../../../Qt/4.8.3/include/boost/system/system_error.hpp:70:16: error: exception handling disabled, use -fexceptions to enable
@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Nov 2, 2012

AFAIK in order to use a custom MinGW version you also need to build the Qt libs with that MinGW version, did you do this?

Can you open command-prompt and enter g++ -v and post the output please?

Diapolo commented Nov 2, 2012

AFAIK in order to use a custom MinGW version you also need to build the Qt libs with that MinGW version, did you do this?

Can you open command-prompt and enter g++ -v and post the output please?

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Nov 3, 2012

Regular DOS command prompt and QT4.8.3 Command prompt and the MinGW Shell all produce the same output:

C:\Users\dscotese>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.0/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.0 (GCC)

I am working through the instructions at http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW in order to compile QT for Win32 - I'm on Windows 7 64 bit, but as g++ above shows, the target is 32 bit so I guess I'll be cross compiling. Doesn't matter to me. What I want to do is get bitcoin-qt to compile so I can debug it.

The instructions insinuate that there are "mingw contents" in the SDK. I installed the SDK 5 days ago and as I wrote in an earlier message, "I think my QT installation detected my existing MinGW installation and didn't install its own." Does that make sense? If that is the case, then can I expect the build of QT to succeed by changing the path to MinGW32_x86 from C:\qt-4.7.4\mingw32_x86\bin to C:\MinGW\bin? That's what I did...

The instructions also said to copy Perl into the build directory. My perl comes from my installation of git (git\bin\perl.exe), so I copied the entire git\bin directory to c:\qt-4.7.4\tools\Perl\bin.

I got this error while executing c:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4\configure.exe -redo:

C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp: In
 function 'char* qdtoa(double, int, int, int*, int*, char**, char**)':
C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:
6626:14: error: '_clear87' was not declared in this scope
C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:
6627:43: error: '_control87' was not declared in this scope
Makefile:179: recipe for target 'qlocale.o' failed
mingw32-make: *** [qlocale.o] Error 1

_clear87 and _control87 are declared in float.h in standard C, I learned from Digital Mars (http://www.digitalmars.com/rtl/float.html), but there is no float.h in the QT build directory. In fact there is no file except qlocale.cpp that has _clear87 in it. So I must be missing some source that declares it. Where could that be? Maybe MinGW32_x86 would have had it... I found it in c:\mingw\include\float.h. Is configure.exe supposed to run some of the bin files in mingw32_x86 and in that way discover the header files in its include directory? That seems odd. Help??

dscotese commented Nov 3, 2012

Regular DOS command prompt and QT4.8.3 Command prompt and the MinGW Shell all produce the same output:

C:\Users\dscotese>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.0/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.0 (GCC)

I am working through the instructions at http://qt-project.org/wiki/Building_Qt_Desktop_for_Windows_with_MinGW in order to compile QT for Win32 - I'm on Windows 7 64 bit, but as g++ above shows, the target is 32 bit so I guess I'll be cross compiling. Doesn't matter to me. What I want to do is get bitcoin-qt to compile so I can debug it.

The instructions insinuate that there are "mingw contents" in the SDK. I installed the SDK 5 days ago and as I wrote in an earlier message, "I think my QT installation detected my existing MinGW installation and didn't install its own." Does that make sense? If that is the case, then can I expect the build of QT to succeed by changing the path to MinGW32_x86 from C:\qt-4.7.4\mingw32_x86\bin to C:\MinGW\bin? That's what I did...

The instructions also said to copy Perl into the build directory. My perl comes from my installation of git (git\bin\perl.exe), so I copied the entire git\bin directory to c:\qt-4.7.4\tools\Perl\bin.

I got this error while executing c:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4\configure.exe -redo:

C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp: In
 function 'char* qdtoa(double, int, int, int*, int*, char**, char**)':
C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:
6626:14: error: '_clear87' was not declared in this scope
C:\qt-4.7.4\qt-everywhere-opensource-src-4.7.4/src/corelib/tools/qlocale.cpp:
6627:43: error: '_control87' was not declared in this scope
Makefile:179: recipe for target 'qlocale.o' failed
mingw32-make: *** [qlocale.o] Error 1

_clear87 and _control87 are declared in float.h in standard C, I learned from Digital Mars (http://www.digitalmars.com/rtl/float.html), but there is no float.h in the QT build directory. In fact there is no file except qlocale.cpp that has _clear87 in it. So I must be missing some source that declares it. Where could that be? Maybe MinGW32_x86 would have had it... I found it in c:\mingw\include\float.h. Is configure.exe supposed to run some of the bin files in mingw32_x86 and in that way discover the header files in its include directory? That seems odd. Help??

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Nov 3, 2012

Alright, so let's do a step-by-step for getting Qt compiled on Windows with an own MinGW (which you indeed have).

  1. Install ActivePerl (mine is ActivePerl 5.14.2 Build 1402), which is needed to compile Qt (you need to google the download) and update it's components via Perl Package Manager (start menu).
  2. Get qt-everywhere-opensource-src-4.8.2.zip (as I had problems when using 4.8.3 because of a qmake problem with resource-files).
  3. Extract the contents of that folder to disk, set this path as environment-variable QTDIR (for me this is D:\Qt_4.8.2) and open command-prompt and cd %QTDIR%.
  4. Ensure your PATH variable contains D:\MinGW\bin;%QTDIR%\lib;%QTDIR%\bin; (path to your MinGW bin directory and to the new Qt versions lib and bin folder).
  5. For a release build (which can't be used for Debugging - If you need a debugging build, you could replace -release with --debug-and-release) I used this switch the last time:
    configure.exe -opensource -confirm-license -release -arch windows -platform win32-g++-4.6 -no-dbus -no-dsp -no-gif -no-libtiff -no-phonon -no-phonon-backend -no-qt3support -no-vcproj -no-webkit -no-style-cde -no-style-cleanlooks -no-style-motif -no-style-plastique -no-style-s60 -no-style-windowsce -no-style-windowsmobile -nomake demos -nomake examples -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-libmng -qt-libpng -qt-zlib -3dnow -mmx -sse -sse2
  6. Now let's build Qt via mingw32-make.exe -j (which will make your PC very unresponsitive, so let it run until that process finished).
  7. You know need to add this Qt version to Qt Creator, which is beyond the scope of this little how-to.

Hope this helps :).

Diapolo commented Nov 3, 2012

Alright, so let's do a step-by-step for getting Qt compiled on Windows with an own MinGW (which you indeed have).

  1. Install ActivePerl (mine is ActivePerl 5.14.2 Build 1402), which is needed to compile Qt (you need to google the download) and update it's components via Perl Package Manager (start menu).
  2. Get qt-everywhere-opensource-src-4.8.2.zip (as I had problems when using 4.8.3 because of a qmake problem with resource-files).
  3. Extract the contents of that folder to disk, set this path as environment-variable QTDIR (for me this is D:\Qt_4.8.2) and open command-prompt and cd %QTDIR%.
  4. Ensure your PATH variable contains D:\MinGW\bin;%QTDIR%\lib;%QTDIR%\bin; (path to your MinGW bin directory and to the new Qt versions lib and bin folder).
  5. For a release build (which can't be used for Debugging - If you need a debugging build, you could replace -release with --debug-and-release) I used this switch the last time:
    configure.exe -opensource -confirm-license -release -arch windows -platform win32-g++-4.6 -no-dbus -no-dsp -no-gif -no-libtiff -no-phonon -no-phonon-backend -no-qt3support -no-vcproj -no-webkit -no-style-cde -no-style-cleanlooks -no-style-motif -no-style-plastique -no-style-s60 -no-style-windowsce -no-style-windowsmobile -nomake demos -nomake examples -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-libmng -qt-libpng -qt-zlib -3dnow -mmx -sse -sse2
  6. Now let's build Qt via mingw32-make.exe -j (which will make your PC very unresponsitive, so let it run until that process finished).
  7. You know need to add this Qt version to Qt Creator, which is beyond the scope of this little how-to.

Hope this helps :).

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 2, 2012

Thanks for the instructions, and the pointer that 4.8.3. has a qmake problem with resource files. I'm working on compiling Qt as I type this. I asked a bunch of questions and I think your instructions answer some, but I wanted to check that I understand:

Is it reasonable to expect the Boost libraries that I compile under cygwin to be valid for use under MinGW when I use them to build the LevelDB libraries? Answer from Gavin and laanwj: No. Use the same toolchain for everything. As per Diapolo, that would be MinGW/QTCreator. Followup question: MinGW is the compiler, and QTCreator is the IDE, right?

I think my QT installation detected my existing MinGW installation and didn't install its own. Does that make sense? I got no direct answer, but Diapolo provided instructions on building QT4.8.2 with a custom install of MinGW, so I'm assuming QT detected the existing install and skipped its own.

[T]here is no file except qlocale.cpp that has _clear87 in it. So I must be missing some source that declares it. Where could that be? I answered this one myself. My custom MinGW install had it in float.h in its own include directory.

Is configure.exe supposed to run some of the bin files in mingw32_x86 and in that way discover the header files in its include directory? I think the answer is no, and that the problem with the float.h file is a bug in the QT 4.7.4 source that requires MinGW to be at C:\qt-4.7.4\mingw32_x86 - a bug not important to fix since there is a later version of QT anyway.

dscotese commented Dec 2, 2012

Thanks for the instructions, and the pointer that 4.8.3. has a qmake problem with resource files. I'm working on compiling Qt as I type this. I asked a bunch of questions and I think your instructions answer some, but I wanted to check that I understand:

Is it reasonable to expect the Boost libraries that I compile under cygwin to be valid for use under MinGW when I use them to build the LevelDB libraries? Answer from Gavin and laanwj: No. Use the same toolchain for everything. As per Diapolo, that would be MinGW/QTCreator. Followup question: MinGW is the compiler, and QTCreator is the IDE, right?

I think my QT installation detected my existing MinGW installation and didn't install its own. Does that make sense? I got no direct answer, but Diapolo provided instructions on building QT4.8.2 with a custom install of MinGW, so I'm assuming QT detected the existing install and skipped its own.

[T]here is no file except qlocale.cpp that has _clear87 in it. So I must be missing some source that declares it. Where could that be? I answered this one myself. My custom MinGW install had it in float.h in its own include directory.

Is configure.exe supposed to run some of the bin files in mingw32_x86 and in that way discover the header files in its include directory? I think the answer is no, and that the problem with the float.h file is a bug in the QT 4.7.4 source that requires MinGW to be at C:\qt-4.7.4\mingw32_x86 - a bug not important to fix since there is a later version of QT anyway.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 2, 2012

The configure.exe command worked, but it's -debug-and-release option starts with one dash.

I just started the compile. http://doc.qt.digia.com/qtcreator-2.4/creator-project-qmake.html describes how to use different versions of QT in QT Creator. Pretty cool to see all those processes pop up in the task manager.

dscotese commented Dec 2, 2012

The configure.exe command worked, but it's -debug-and-release option starts with one dash.

I just started the compile. http://doc.qt.digia.com/qtcreator-2.4/creator-project-qmake.html describes how to use different versions of QT in QT Creator. Pretty cool to see all those processes pop up in the task manager.

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Dec 2, 2012

The really important thing is you need to build everything with the same MinGW version, this starts from the libs, to Qt (and Qt Creator can also be build for yourself), leveldb and the client itself. So MinGW is the compiler and Qt Creator is your used IDE.

From what you are writing I think you have 2 MinGW versions, which could mess things up here. I for example just have the one that I installed via the mingw-get-inst-YYYYMMDD.exe.

Configure.exe builds qmake afaik and needs the compiler and linker, so yes it's normal it's starting binaries from the MinGW installation :).

Diapolo commented Dec 2, 2012

The really important thing is you need to build everything with the same MinGW version, this starts from the libs, to Qt (and Qt Creator can also be build for yourself), leveldb and the client itself. So MinGW is the compiler and Qt Creator is your used IDE.

From what you are writing I think you have 2 MinGW versions, which could mess things up here. I for example just have the one that I installed via the mingw-get-inst-YYYYMMDD.exe.

Configure.exe builds qmake afaik and needs the compiler and linker, so yes it's normal it's starting binaries from the MinGW installation :).

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 2, 2012

I got it compiling, but when I tried to run it, I got "During startup program exited with code 0x0000c135". I used ProcessViewer to determine that this is because miniupnpc.dll isn't in the path. Bitcoin-qt.pro had MiniUPNP enabled by default, and I don't see miniupnpc.dll in my bitcoin installation directory, so I'm guessing that it's supposed to be linked into the bitcoin-qt.exe ("statically linked", right?), but when I compiled, this didn't happen - at least for the debugger, it wants to find miniupnpc.dll on the path somewhere. As you will see in the instructions (when I figure out how to make them available), I haven't addressed this issue in there yet.

Is my guess correct about the linking of miniupnpc?

I'm pretty green on git, so here I've copied the commands I used so far to try to make my changes to readme-qt.rst available to anyone who wants to check it:

$ git branch ds_native_windows
$ git checkout ds_native_windows
M       bitcoin-qt.pro
M       doc/readme-qt.rst
M       src/leveldb/build_detect_platform
Switched to branch 'ds_native_windows'
$ git add doc/readme-qt.rst
$ git commit
[ds_native_windows cb6c9a6] Much more detail about compiling on native Windows with MinGW.
 1 files changed, 53 insertions(+), 6 deletions(-)
$ git push
Username for 'https://github.com':
Password for 'https://dscotese@github.com':
Counting objects: 4530, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1037/1037), done.
Writing objects: 100% (3973/3973), 2.56 MiB | 81 KiB/s, done.
Total 3973 (delta 3000), reused 3904 (delta 2931)
To https://github.com/dscotese/bitcoin.git
   6cef700..cd7fb7d  master -> master
$ git remote -v
origin  https://github.com/dscotese/bitcoin.git (fetch)
origin  https://github.com/dscotese/bitcoin.git (push)
upstream        https://github.com/bitcoin/bitcoin.git (fetch)
upstream        https://github.com/bitcoin/bitcoin.git (push)

master -> master ??? I thought I just created the ds_native_windows branch? But I guess I also pushed it to the master (which is the only) branch on my dscotese/bitcoin fork. Is that correct?

dscotese commented Dec 2, 2012

I got it compiling, but when I tried to run it, I got "During startup program exited with code 0x0000c135". I used ProcessViewer to determine that this is because miniupnpc.dll isn't in the path. Bitcoin-qt.pro had MiniUPNP enabled by default, and I don't see miniupnpc.dll in my bitcoin installation directory, so I'm guessing that it's supposed to be linked into the bitcoin-qt.exe ("statically linked", right?), but when I compiled, this didn't happen - at least for the debugger, it wants to find miniupnpc.dll on the path somewhere. As you will see in the instructions (when I figure out how to make them available), I haven't addressed this issue in there yet.

Is my guess correct about the linking of miniupnpc?

I'm pretty green on git, so here I've copied the commands I used so far to try to make my changes to readme-qt.rst available to anyone who wants to check it:

$ git branch ds_native_windows
$ git checkout ds_native_windows
M       bitcoin-qt.pro
M       doc/readme-qt.rst
M       src/leveldb/build_detect_platform
Switched to branch 'ds_native_windows'
$ git add doc/readme-qt.rst
$ git commit
[ds_native_windows cb6c9a6] Much more detail about compiling on native Windows with MinGW.
 1 files changed, 53 insertions(+), 6 deletions(-)
$ git push
Username for 'https://github.com':
Password for 'https://dscotese@github.com':
Counting objects: 4530, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1037/1037), done.
Writing objects: 100% (3973/3973), 2.56 MiB | 81 KiB/s, done.
Total 3973 (delta 3000), reused 3904 (delta 2931)
To https://github.com/dscotese/bitcoin.git
   6cef700..cd7fb7d  master -> master
$ git remote -v
origin  https://github.com/dscotese/bitcoin.git (fetch)
origin  https://github.com/dscotese/bitcoin.git (push)
upstream        https://github.com/bitcoin/bitcoin.git (fetch)
upstream        https://github.com/bitcoin/bitcoin.git (push)

master -> master ??? I thought I just created the ds_native_windows branch? But I guess I also pushed it to the master (which is the only) branch on my dscotese/bitcoin fork. Is that correct?

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 2, 2012

After adding miniupnpc.dll to by bitcoin debug directory, I can start the debugger, but I get a SIGSEGV right away on this line in db.cpp:
CDBEnv::CDBEnv() : dbenv(DB_CXX_NO_EXCEPTIONS)
The stack shows the "Level 0" Function is DbEnv::DbEnv(unsigned int), and in the disassembler, it seems that the seg fault happens at 0x5ec21b <+0x000b> movl $0xb5ba68,(%ebx), but the memory editor readily opens 0xb5ba68. Could it be that QTCreator has access to the memory there, but the program it's debugging doesn't?

dscotese commented Dec 2, 2012

After adding miniupnpc.dll to by bitcoin debug directory, I can start the debugger, but I get a SIGSEGV right away on this line in db.cpp:
CDBEnv::CDBEnv() : dbenv(DB_CXX_NO_EXCEPTIONS)
The stack shows the "Level 0" Function is DbEnv::DbEnv(unsigned int), and in the disassembler, it seems that the seg fault happens at 0x5ec21b <+0x000b> movl $0xb5ba68,(%ebx), but the memory editor readily opens 0xb5ba68. Could it be that QTCreator has access to the memory there, but the program it's debugging doesn't?

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Dec 3, 2012

You didn't check out your branch at first, perhaps that's why you see master -> master. Also I never got the miniupnpc lib to compile, so I use "USE_UPNP=-". Remember, all libs need to be built by the very same MinGW compiler suite :).

Diapolo commented Dec 3, 2012

You didn't check out your branch at first, perhaps that's why you see master -> master. Also I never got the miniupnpc lib to compile, so I use "USE_UPNP=-". Remember, all libs need to be built by the very same MinGW compiler suite :).

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 4, 2012

I added "USE_UPNP=-" - QT Creator now reports my qmake command line as qmake.exe bitcoin-qt.pro -r -spec win32-g++ "CONFIG+=declarative_debug" "USE_UPNP=-", but net.cpp references miniupnp and fails:

Makefile.Debug:253: recipe for target 'debug/bitcoin-qt.exe' failed
mingw32-make[1]: Leaving directory 'C:/Qt/projects/bitcoin-qt-build-desktop-Qt_4_8_2__4_8_2__Debug'
Makefile:34: recipe for target 'debug' failed
./build/net.o: In function `_Z14ThreadMapPort2Pv':
C:\Qt\projects\bitcoin-qt-build-desktop-Qt_4_8_2__4_8_2__Debug/../bitcoin/src/net.cpp:1027: undefined reference to `_upnpDiscover'

Line 33 in net.cpp says #ifdef USE_UPNP but line 56 of bitcoin-qt.pro says # or: qmake "USE_UPNP=-" (not supported) Isn't "-" a definition for USE_UPNP?

If I understand the output of git diff on the last commit of net.cpp (8bb5edc), net.cpp was first added in that commit, as well as the lines in bitcoin-qt.pro that (I thought) should indicate how to avoid compiling ThreadMapPort2. Either the instructions are wrong or I'm missing something here.

Perhaps what I'm missing is that "USE_UPNP=-" means don't put anything after the =. I tried "USE_UPNP=" and it compiled, but it still gets the same segfault I reported earlier when I try to debug it. But "USE_UPNP=" is the same as not adding anything, isn't it?

I found a reference to the USE_UPNP in \doc\build-msw.txt:
UPnP support is optional, make with USE_UPNP= to disable it. so I added a line to bitcoin-qt.pro: # for Windows: qmake "USE_UPNP=" (disabled) Only you wrote "I use "USE_UPNP=-"", so perhaps I am confusing the "build-msw" with MinGW on Windows. Doesn't the build-msw.txt file apply to building on a Windows box using MinGW under QT? Wouldn't you have had to use "USE_UPNP="?

Also, you said I hadn't checked out my branch, and that made sense to me, but it says I'm already on it and it lists the commit:

dscotese@DAVESTOSHIBA /c/qt/projects/bitcoin/src (ds_native_windows)
$ git checkout ds_native_windows
M       bitcoin-qt.pro
M       src/leveldb/build_detect_platform
Already on 'ds_native_windows'

dscotese@DAVESTOSHIBA /c/qt/projects/bitcoin/src (ds_native_windows)
$ git log ../doc/readme-qt.rst
commit cb6c9a69e6e654db49961510b1466da8fa681b7b
Author: dscotese <dscotese@litmocracy.com>
Date:   Sat Dec 1 22:36:44 2012 -0800

    Much more detail about compiling on native Windows with MinGW.

So I don't know how to make my ds_native_windows branch available to you so you can see the edits I made to the section on building under Windows. I'll post it here if you want, but I'd rather use it to figure out how to make stuff available through git.

dscotese commented Dec 4, 2012

I added "USE_UPNP=-" - QT Creator now reports my qmake command line as qmake.exe bitcoin-qt.pro -r -spec win32-g++ "CONFIG+=declarative_debug" "USE_UPNP=-", but net.cpp references miniupnp and fails:

Makefile.Debug:253: recipe for target 'debug/bitcoin-qt.exe' failed
mingw32-make[1]: Leaving directory 'C:/Qt/projects/bitcoin-qt-build-desktop-Qt_4_8_2__4_8_2__Debug'
Makefile:34: recipe for target 'debug' failed
./build/net.o: In function `_Z14ThreadMapPort2Pv':
C:\Qt\projects\bitcoin-qt-build-desktop-Qt_4_8_2__4_8_2__Debug/../bitcoin/src/net.cpp:1027: undefined reference to `_upnpDiscover'

Line 33 in net.cpp says #ifdef USE_UPNP but line 56 of bitcoin-qt.pro says # or: qmake "USE_UPNP=-" (not supported) Isn't "-" a definition for USE_UPNP?

If I understand the output of git diff on the last commit of net.cpp (8bb5edc), net.cpp was first added in that commit, as well as the lines in bitcoin-qt.pro that (I thought) should indicate how to avoid compiling ThreadMapPort2. Either the instructions are wrong or I'm missing something here.

Perhaps what I'm missing is that "USE_UPNP=-" means don't put anything after the =. I tried "USE_UPNP=" and it compiled, but it still gets the same segfault I reported earlier when I try to debug it. But "USE_UPNP=" is the same as not adding anything, isn't it?

I found a reference to the USE_UPNP in \doc\build-msw.txt:
UPnP support is optional, make with USE_UPNP= to disable it. so I added a line to bitcoin-qt.pro: # for Windows: qmake "USE_UPNP=" (disabled) Only you wrote "I use "USE_UPNP=-"", so perhaps I am confusing the "build-msw" with MinGW on Windows. Doesn't the build-msw.txt file apply to building on a Windows box using MinGW under QT? Wouldn't you have had to use "USE_UPNP="?

Also, you said I hadn't checked out my branch, and that made sense to me, but it says I'm already on it and it lists the commit:

dscotese@DAVESTOSHIBA /c/qt/projects/bitcoin/src (ds_native_windows)
$ git checkout ds_native_windows
M       bitcoin-qt.pro
M       src/leveldb/build_detect_platform
Already on 'ds_native_windows'

dscotese@DAVESTOSHIBA /c/qt/projects/bitcoin/src (ds_native_windows)
$ git log ../doc/readme-qt.rst
commit cb6c9a69e6e654db49961510b1466da8fa681b7b
Author: dscotese <dscotese@litmocracy.com>
Date:   Sat Dec 1 22:36:44 2012 -0800

    Much more detail about compiling on native Windows with MinGW.

So I don't know how to make my ds_native_windows branch available to you so you can see the edits I made to the section on building under Windows. I'll post it here if you want, but I'd rather use it to figure out how to make stuff available through git.

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 4, 2012

I think the problem I ran into with the USE_UPNP flag was that I didn't clean the project, so it didn't end up recompiling net.cpp. I deleted the net.o file and rebuilt and that generated a successful compile with "USE_UPNP=-". I still get the segfault, so I figured I should clean everything and rebuild. if that works, it would suggest that USE_UPNP appears somewhere other than net.cpp, and I don't think that's true.

Next theory is that I've compiled with different toolchains. QT does list two MinGWs, but the only differences is that the one I've selected for this build specifies a Debugger (the other one, auto-detected, is called "MinGW (x86 32bit)" instead of just "MinGW", and has no Debugger), but the Compiler path and ABI are the same for both. Oh, except for the case of the directory name (auto-detect gets mingw, and the one I entered is MinGW). So I assume QT is listing the same toolchain twice. Maybe I used something else to compile one of the libraries I'm using. Hmm... the files in the Dependencies zip included more than just the boost libraries - crypto, db, and ssl. I guess I need to compile all of them with my Mingw. So that's my next step.

I am using this issue as a sort of weblog, but if there's a better place for me to log my progress for others who want to see someone climb this learning curve, let me know and I'll put it there instead.

dscotese commented Dec 4, 2012

I think the problem I ran into with the USE_UPNP flag was that I didn't clean the project, so it didn't end up recompiling net.cpp. I deleted the net.o file and rebuilt and that generated a successful compile with "USE_UPNP=-". I still get the segfault, so I figured I should clean everything and rebuild. if that works, it would suggest that USE_UPNP appears somewhere other than net.cpp, and I don't think that's true.

Next theory is that I've compiled with different toolchains. QT does list two MinGWs, but the only differences is that the one I've selected for this build specifies a Debugger (the other one, auto-detected, is called "MinGW (x86 32bit)" instead of just "MinGW", and has no Debugger), but the Compiler path and ABI are the same for both. Oh, except for the case of the directory name (auto-detect gets mingw, and the one I entered is MinGW). So I assume QT is listing the same toolchain twice. Maybe I used something else to compile one of the libraries I'm using. Hmm... the files in the Dependencies zip included more than just the boost libraries - crypto, db, and ssl. I guess I need to compile all of them with my Mingw. So that's my next step.

I am using this issue as a sort of weblog, but if there's a better place for me to log my progress for others who want to see someone climb this learning curve, let me know and I'll put it there instead.

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Dec 4, 2012

@dscotese Why not backup your modifications in your Git-branch by simply copying them out of the used directory, delete your branch and start with a clean master branch.

git checkout master
git branch -D ds_native_windows
git branch ds_native_windows
git checkout ds_native_windows

Great you figured out the USE_UPNP stuff, when chaning such things it's always a good idea to cleanup via the Qt Cretor IDE, which has a menu point for that under Build or Create in the main menu bar.

You indeed need to build ALL dependency packages with your compiler, if you want to be successful in building Bitcoin-Qt. The ones you need are BDB, Boost, OpenSSL, Qt and leveldb.

I'm fine with your blog-style here :).

Diapolo commented Dec 4, 2012

@dscotese Why not backup your modifications in your Git-branch by simply copying them out of the used directory, delete your branch and start with a clean master branch.

git checkout master
git branch -D ds_native_windows
git branch ds_native_windows
git checkout ds_native_windows

Great you figured out the USE_UPNP stuff, when chaning such things it's always a good idea to cleanup via the Qt Cretor IDE, which has a menu point for that under Build or Create in the main menu bar.

You indeed need to build ALL dependency packages with your compiler, if you want to be successful in building Bitcoin-Qt. The ones you need are BDB, Boost, OpenSSL, Qt and leveldb.

I'm fine with your blog-style here :).

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 5, 2012

Here are the relevant additions to the readme-qt.rst file:

  • If you have MinGW before you download the QT SDK, it seems that QT won't install the MinGW with which it was built. This is a problem because of differences between versions of MinGW, but you can still use your MinGW - you just have to recompile the QT libraries.

    • Compiling QT with your version of MinGW:
    1. Install ActivePerl from http://www.activestate.com/activeperl/downloads and update its components via Perl Package Manager (start menu).
    2. Get qt-everywhere-opensource-src-4.8.2.zip (Version 4.8.3 seems to have a qmake problem with resource-files).
    3. Extract the contents of that folder to disk, set this path as environment-variable QTDIR and open command-prompt and cd %QTDIR%.
    4. Ensure your PATH variable contains the path to the bin subdirectory of your MinGW installation, and the lib and bin subdirectories of QTDIR (for example D:\MinGW\bin;%QTDIR%\lib;%QTDIR%\bin;).
    5. For a release build (which can't be used for Debugging - If you need a debugging build, you could replace -release with -debug-and-release) I used this switch the last time:
      configure.exe -opensource -confirm-license -release -arch windows -platform win32-g++-4.6 -no-dbus -no-dsp -no-gif -no-libtiff -no-phonon -no-phonon-backend -no-qt3support -no-vcproj -no-webkit -no-style-cde -no-style-cleanlooks -no-style-motif -no-style-plastique -no-style-s60 -no-style-windowsce -no-style-windowsmobile -nomake demos -nomake examples -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-libmng -qt-libpng -qt-zlib -3dnow -mmx -sse -sse2
    6. Now let's build Qt via mingw32-make.exe -j (which will make your PC very unresponsitive, so let it run until that process finished).
    7. You now need to add this Qt version to Qt Creator, which is beyond the scope of this little how-to, but it is described at http://doc.qt.digia.com/qtcreator-2.4/creator-project-qmake.html.
    • Compiling Boost:
      Example for Boost 1.51 extracted to what we'll use as BOOST_ROOT below:

    Set the BOOST_ROOT environment variable to the location of your boost_1_51 directory or cd to that directory and stay in it.

    open BOOST_ROOT\bootstrap.bat
    replace set toolset=msvc with set toolset=gcc

    open BOOST_ROOT\tools\build\v2\engine\build.bat and search for mingw

    replace existing code with:

    if EXIST "(your MinGW directory, for example D:\MinGW)\bin\gcc.exe" (
    set "BOOST_JAM_TOOLSET=mingw"
    set "BOOST_JAM_TOOLSET_ROOT=(your MinGW directory)"

    open your Qt or MinGW command prompt and cd %BOOST_ROOT%

    You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!

    enter bootstrap.bat gcc

    This builds b2, the Boost build engine b2!

    create the libs needed by Bitcoin:

    b2 --toolset=gcc --build-dir=%BOOST_ROOT%\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

    This should create all .a files you need for Bitcoin-Qt and they can be found in *BOOST_ROOT\build, just search for *.a in that dir ;).

    Add these .a files to the lib directory under your MinGW install directory.
    Update the line in bitcoin-qt.pro to specify the correct BOOST_LIB_SUFFIX (near the comment "platform specific defaults")

    • Compiling BDB
    • Open a MinGW shell and cd to the build_unix directory.
      Execute ../dist/configure --disable-replication --enable-mingw --enable-cxx --prefix=/usr/local
      (This creates the build files in build_unix, which started out empty, so now you can...)
    • Edit db.h in build_unix/
      @ Line 113 Replace

    typedef pthread_t db_threadid_t;

    with

    typedef u_int32_t db_threadid_t;

    • Now you can use make to compile it.
    • Copy the files from build_unix/.libs to the lib subdirectory of your MinGW directory.
    • Compiling Open SSL
    • cd to that path and Execute perl Configure mingw no-shared no-asm --prefix=/c/OpenSSL
    • Execute the following:

    make depend

    make

    make install

    • These instructions thanks to ereOn at http://stackoverflow.com/questions/9379363/how-to-build-openssl-with-mingw-in-windows.
    • Compile leveldb (and memenv):
      • Edit bitcoin-qt\src\leveldb\build_detect_platform to set the PLATFORM_EXTRALIBS (in section OS_WINDOWS_CROSSCOMPILE)match the filenames produced by compiling the Boost libraries.
    • In your MinGW shell cd to your bitcoin/src/leveldb directory
    • Execute TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a

If you want to skip miniupnp, you can, just remember to add USE_UPNP=- to the switches on qmake in QT Creator when you build bitcoin-qt. If you want miniupnp, try this (not yet proven):

  • Download and extract miniupnpc_ into bitcoin/src/miniupnpc directory.
  • Compile miniupnpc. This may require that you edit the Makefile.mingw file to include a relative path to ws2_32.dll (eg ../../../../../Windows/System32/ws2_32.dll) as part of the LDLIBS variable, and also add #define _WIN32_WINNT 0x0501 above the headers in connecthostport.c.
  • Copy the resulting miniupnpc.lib file (in bitcoin/src/miniupnpc) into your MinGW lib directory.
  • Open the bitcoin-qt.pro file in Qt Creator and comment out lines 97 - 111, as these fail on native windows to build the leveldb and memenv assembler (.a) files. Build as normal (ctrl-B)

.. _Qt Windows SDK: http://qt-project.org/downloads/
.. dependencies archive: https://download.visucore.com/bitcoin/qtgui_deps_1.zip
.. [#] PGP signature: https://download.visucore.com/bitcoin/qtgui_deps_1.zip.sig (signed with RSA key ID 610945D0
)
.. _miniupnpc: http://miniupnp.free.fr/files/download.php?file=upnpc-exe-win32-20121009.zip
.. _610945D0: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x610945D0

This compiles, but when I debug the result, it immediately fails with the same segmentation fault I described earlier.

dscotese commented Dec 5, 2012

Here are the relevant additions to the readme-qt.rst file:

  • If you have MinGW before you download the QT SDK, it seems that QT won't install the MinGW with which it was built. This is a problem because of differences between versions of MinGW, but you can still use your MinGW - you just have to recompile the QT libraries.

    • Compiling QT with your version of MinGW:
    1. Install ActivePerl from http://www.activestate.com/activeperl/downloads and update its components via Perl Package Manager (start menu).
    2. Get qt-everywhere-opensource-src-4.8.2.zip (Version 4.8.3 seems to have a qmake problem with resource-files).
    3. Extract the contents of that folder to disk, set this path as environment-variable QTDIR and open command-prompt and cd %QTDIR%.
    4. Ensure your PATH variable contains the path to the bin subdirectory of your MinGW installation, and the lib and bin subdirectories of QTDIR (for example D:\MinGW\bin;%QTDIR%\lib;%QTDIR%\bin;).
    5. For a release build (which can't be used for Debugging - If you need a debugging build, you could replace -release with -debug-and-release) I used this switch the last time:
      configure.exe -opensource -confirm-license -release -arch windows -platform win32-g++-4.6 -no-dbus -no-dsp -no-gif -no-libtiff -no-phonon -no-phonon-backend -no-qt3support -no-vcproj -no-webkit -no-style-cde -no-style-cleanlooks -no-style-motif -no-style-plastique -no-style-s60 -no-style-windowsce -no-style-windowsmobile -nomake demos -nomake examples -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-libmng -qt-libpng -qt-zlib -3dnow -mmx -sse -sse2
    6. Now let's build Qt via mingw32-make.exe -j (which will make your PC very unresponsitive, so let it run until that process finished).
    7. You now need to add this Qt version to Qt Creator, which is beyond the scope of this little how-to, but it is described at http://doc.qt.digia.com/qtcreator-2.4/creator-project-qmake.html.
    • Compiling Boost:
      Example for Boost 1.51 extracted to what we'll use as BOOST_ROOT below:

    Set the BOOST_ROOT environment variable to the location of your boost_1_51 directory or cd to that directory and stay in it.

    open BOOST_ROOT\bootstrap.bat
    replace set toolset=msvc with set toolset=gcc

    open BOOST_ROOT\tools\build\v2\engine\build.bat and search for mingw

    replace existing code with:

    if EXIST "(your MinGW directory, for example D:\MinGW)\bin\gcc.exe" (
    set "BOOST_JAM_TOOLSET=mingw"
    set "BOOST_JAM_TOOLSET_ROOT=(your MinGW directory)"

    open your Qt or MinGW command prompt and cd %BOOST_ROOT%

    You can also just use the Windows command-promt (cmd), if you setup all Qt stuff in the envirionment variables!

    enter bootstrap.bat gcc

    This builds b2, the Boost build engine b2!

    create the libs needed by Bitcoin:

    b2 --toolset=gcc --build-dir=%BOOST_ROOT%\build --build-type=minimal stage link=static runtime-link=static threading=multi variant=release -a -j 4 --with-filesystem --with-program_options --with-system --with-thread

    This should create all .a files you need for Bitcoin-Qt and they can be found in *BOOST_ROOT\build, just search for *.a in that dir ;).

    Add these .a files to the lib directory under your MinGW install directory.
    Update the line in bitcoin-qt.pro to specify the correct BOOST_LIB_SUFFIX (near the comment "platform specific defaults")

    • Compiling BDB
    • Open a MinGW shell and cd to the build_unix directory.
      Execute ../dist/configure --disable-replication --enable-mingw --enable-cxx --prefix=/usr/local
      (This creates the build files in build_unix, which started out empty, so now you can...)
    • Edit db.h in build_unix/
      @ Line 113 Replace

    typedef pthread_t db_threadid_t;

    with

    typedef u_int32_t db_threadid_t;

    • Now you can use make to compile it.
    • Copy the files from build_unix/.libs to the lib subdirectory of your MinGW directory.
    • Compiling Open SSL
    • cd to that path and Execute perl Configure mingw no-shared no-asm --prefix=/c/OpenSSL
    • Execute the following:

    make depend

    make

    make install

    • These instructions thanks to ereOn at http://stackoverflow.com/questions/9379363/how-to-build-openssl-with-mingw-in-windows.
    • Compile leveldb (and memenv):
      • Edit bitcoin-qt\src\leveldb\build_detect_platform to set the PLATFORM_EXTRALIBS (in section OS_WINDOWS_CROSSCOMPILE)match the filenames produced by compiling the Boost libraries.
    • In your MinGW shell cd to your bitcoin/src/leveldb directory
    • Execute TARGET_OS=OS_WINDOWS_CROSSCOMPILE make libleveldb.a libmemenv.a

If you want to skip miniupnp, you can, just remember to add USE_UPNP=- to the switches on qmake in QT Creator when you build bitcoin-qt. If you want miniupnp, try this (not yet proven):

  • Download and extract miniupnpc_ into bitcoin/src/miniupnpc directory.
  • Compile miniupnpc. This may require that you edit the Makefile.mingw file to include a relative path to ws2_32.dll (eg ../../../../../Windows/System32/ws2_32.dll) as part of the LDLIBS variable, and also add #define _WIN32_WINNT 0x0501 above the headers in connecthostport.c.
  • Copy the resulting miniupnpc.lib file (in bitcoin/src/miniupnpc) into your MinGW lib directory.
  • Open the bitcoin-qt.pro file in Qt Creator and comment out lines 97 - 111, as these fail on native windows to build the leveldb and memenv assembler (.a) files. Build as normal (ctrl-B)

.. _Qt Windows SDK: http://qt-project.org/downloads/
.. dependencies archive: https://download.visucore.com/bitcoin/qtgui_deps_1.zip
.. [#] PGP signature: https://download.visucore.com/bitcoin/qtgui_deps_1.zip.sig (signed with RSA key ID 610945D0
)
.. _miniupnpc: http://miniupnp.free.fr/files/download.php?file=upnpc-exe-win32-20121009.zip
.. _610945D0: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x610945D0

This compiles, but when I debug the result, it immediately fails with the same segmentation fault I described earlier.

@Diapolo

This comment has been minimized.

Show comment
Hide comment
@Diapolo

Diapolo Dec 5, 2012

You wrote you are observing a segfault, but did you ever build a release version in Qt Creator? The used debugger is GDB, which you also can compile for yourself, so perhaps just try a release build before.

Which version of Qt Creator are you using? Was it build by your toolchain or did you download that?

Diapolo commented Dec 5, 2012

You wrote you are observing a segfault, but did you ever build a release version in Qt Creator? The used debugger is GDB, which you also can compile for yourself, so perhaps just try a release build before.

Which version of Qt Creator are you using? Was it build by your toolchain or did you download that?

@dscotese

This comment has been minimized.

Show comment
Hide comment
@dscotese

dscotese Dec 11, 2012

I don't understand "so perhaps just try a release build before." Do you mean that IF the release build works as expected, then I can assume the debugger needs to be compiled with the same version of QT that I used to compile bitcoin-qt? I suppose that makes sense. The gdb being used was last written about 2 months before I posted this issue, so clearly, I'm not using a gdb that I compiled.

The attempt to compile the release version issues a warning:

C:\Qt\projects\bitcoin\src\qt\qtipcserver.cpp:22: warning: #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 [-Wcpp]

They are NOT uncommented, which means they aren't in effect, and perhaps boost's interprocess does have the kernel boottime (whatever that means). There is no commented define for these macros in the indicated file, so I'm a little lost. I just added #defines for them and recompiled and I'm still getting the same segfault.
Anyway, I am using QT 4.8.2 as you suggested, and I built it myself following your instructions as indicated in my previous comment = reference to the readme-qt.rst edit I made.

It compiled (mingw32-make.exe exited normally), but when I ran it, it immediately failed with 0x3FFFFECB. How do I figure out what that exit code means? Heh - by debugging. Ok...

I watched the registers before I made the release build and determined that A) 0x5ec21b <+0x000b> movl $0xb5ba68,(%ebx)` doesn't move the contents of 0xb5ba68, but rather the value 0xb5ba68, into the memory address stored in %ebx, which is 15!!. It's a base index register, so maybe that is relative to something else, but I'm guessing that whatever memory address it's pointing to isn't accessible and thus the segmentation fault. Please correct any boneheaded things I've said. I'm totally guessing.

Guess I try compiling my own gdb next.

I don't understand "so perhaps just try a release build before." Do you mean that IF the release build works as expected, then I can assume the debugger needs to be compiled with the same version of QT that I used to compile bitcoin-qt? I suppose that makes sense. The gdb being used was last written about 2 months before I posted this issue, so clearly, I'm not using a gdb that I compiled.

The attempt to compile the release version issues a warning:

C:\Qt\projects\bitcoin\src\qt\qtipcserver.cpp:22: warning: #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 [-Wcpp]

They are NOT uncommented, which means they aren't in effect, and perhaps boost's interprocess does have the kernel boottime (whatever that means). There is no commented define for these macros in the indicated file, so I'm a little lost. I just added #defines for them and recompiled and I'm still getting the same segfault.
Anyway, I am using QT 4.8.2 as you suggested, and I built it myself following your instructions as indicated in my previous comment = reference to the readme-qt.rst edit I made.

It compiled (mingw32-make.exe exited normally), but when I ran it, it immediately failed with 0x3FFFFECB. How do I figure out what that exit code means? Heh - by debugging. Ok...

I watched the registers before I made the release build and determined that A) 0x5ec21b <+0x000b> movl $0xb5ba68,(%ebx)` doesn't move the contents of 0xb5ba68, but rather the value 0xb5ba68, into the memory address stored in %ebx, which is 15!!. It's a base index register, so maybe that is relative to something else, but I'm guessing that whatever memory address it's pointing to isn't accessible and thus the segmentation fault. Please correct any boneheaded things I've said. I'm totally guessing.

Guess I try compiling my own gdb next.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Nov 7, 2013

Member

Refers to old build system, and boost::interprocess is no longer used, closing

Member

laanwj commented Nov 7, 2013

Refers to old build system, and boost::interprocess is no longer used, closing

@laanwj laanwj closed this Nov 7, 2013

Duality-CDOO pushed a commit to Duality-CDOO/bitcoin that referenced this issue Jun 14, 2018

Update protocol-documentation.md (#1964)
* Update protocol-documentation.md

* typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment