Pages:
Author

Topic: Building headless Bitcoin and Bitcoin-qt on Windows - page 52. (Read 419389 times)

sr. member
Activity: 260
Merit: 251
Hello Gavin,

I read your code comment, but that is how it should work (on Windows) but can't and doesn't with exit/stop for bitcoin-qt nor Ctl-C for bitcoind!

You have to trap the Ctl-C in order to set fRequestShutdown! If you don't, Windows boots you out, which is what happens now with the current code. There is nothing trapping Ctl-C in the Windows code.

All I'm doing is trapping the Ctl-C and calling the current HandleSIGTERM().

And I respectfully disagree with your comments on bitcoin-qt. It should but never calls HandleSIGTERM() on Windows anyway. All of which I stated in my change.

Ron
legendary
Activity: 1652
Merit: 2301
Chief Scientist
I wrote a big comment in init.cpp describing how shutdown works:

Code:
//
// Thread management and startup/shutdown:
//
// The network-processing threads are all part of a thread group
// created by AppInit() or the Qt main() function.
//
// A clean exit happens when StartShutdown() or the SIGTERM
// signal handler sets fRequestShutdown, which triggers
// the DetectShutdownThread(), which interrupts the main thread group.
// DetectShutdownThread() then exits, which causes AppInit() to
// continue (it .joins the shutdown thread).
// Shutdown() is then
// called to clean up database connections, and stop other
// threads that should only be stopped after the main network-processing
// threads have exited.
//
// Note that if running -daemon the parent process returns from AppInit2
// before adding any threads to the threadGroup, so .join_all() returns
// immediately and the parent exits from main().
//
// Shutdown for Qt is very similar, only it uses a QTimer to detect
// fRequestShutdown getting set, and then does the normal Qt
// shutdown thing.
//

I don't know nuthin about Windows' SetConsoleCtrlHandler(), but just setting the fRequestShutdown global variable should do the right thing.
sr. member
Activity: 260
Merit: 251
Hello all,

I can no longer find Gavin's message/remark concerning the behavior of bitcoind and bitcoin-qt on Windows when one exits them. He stated that there was a shutdown issue. No kidding! For versions 0.8.3, (maybe 0.8.2 but not 0.8.1) and still with 0.8.4.

Well Gavin, see
https://github.com/old-c-coder/bitcoin-git/commit/0bd51c5ddd39e2e5adb1d1455b80c3a9e03b410b

It's fixed. Windows never had a Ctl-C handler. Now the cleanup classes CNetCleanup and CMainCleanup destructors finally launch and "do their thing". But alas, Windows bitcoin-qt's stop or exit code never get near StartShutdown() so still no joy there.

Even though this is a Windows-centric thread, how does the code, bitcoind & bitcoin-qt exit on a Mac? Or is it the same as Linux/Unix, which I presume work correctly?

Ron
hero member
Activity: 772
Merit: 500


If you are doing such things, make sure to create a pull request for our official repository Smiley.

Dia

Ah, but like any artist, one doesn't like to submit an incomplete drawing, play, sculpture, painting, piece of music, novel, etc. Smiley Also, why bother others with something I can run myself, to see if it "flies". I was just surprised by the SIGSEGV (with a normal build) and the link given suggests that even valgrind may not even be able to find the "static miscues"?

Ron

Indeed, you are free to finish your work before doing any pull-request. I just wanted to encourage you to submit patches of great stuff you are doing Smiley.

Dia
sr. member
Activity: 260
Merit: 251


If you are doing such things, make sure to create a pull request for our official repository Smiley.

Dia

Ah, but like any artist, one doesn't like to submit an incomplete drawing, play, sculpture, painting, piece of music, novel, etc. Smiley Also, why bother others with something I can run myself, to see if it "flies". I was just surprised by the SIGSEGV (with a normal build) and the link given suggests that even valgrind may not even be able to find the "static miscues"?

Ron
member
Activity: 81
Merit: 1002
It was only the wind.
What could be the reasons Satoshi created Bitcoin in C++. This is the cause of all hell breaking loose in compiling it. Why did he not create it in Java? Was it due to performance reasons?

Hello Amitabh?

Perhaps it was the language he/she/they were most familiar with at the time (~2009). It actually was a MS VC++ 6.0 project initially, if I read the history correctly?

Java could be a performance issue as a stand alone application using a JVM, and an identical JVM may not have been on everyone's computer (windows, linux, Mac ...)

And there seems to be all kinds of gotchas/provisos, etc. on system resources and the JVM, see
http://docs.oracle.com/cd/A87860_01/doc/java.817/a83728/03writ10.htm
especially with all the things bitcoin has its fingers in: memory, files, sockets, threads and the dreaded preemptive garbage collection in Java, yada yada yada  Grin

And isn't it so, that Java only relatively recently, made facilities available for "bit twiddling", and bitcoin certainly does its share of big endian - little endian and other bit/byte/word/int/hash machinations Smiley

Ron

That's the gentlest explanation for "Java is kinda shit" that I've ever read.
hero member
Activity: 772
Merit: 500
OK, bitcoin compilers, daemon or qt, I have been "re-factoring" in a sense the bitcoin 0.8.3 code and have come upon the dreaded error abort:
SIGSEGV, Segmentation fault. std::basic_string< char, std::char_traits, std::allocator  >::basic_string(std::string const&) ()

before main() apparently happens? I see lots of "stuff" on static initialization "issues" in C++, see
http://www.google.com/#fp=aae3bcc417c03f0c&q=in+GCC+received+signal+SIGSEGV%2C+Segmentation+fault.+std%3A%3Abasic_string%3C+char%2C+std%3A%3Achar_traits%3Cchar%3E%2C+std%3A%3Aallocator%3Cchar%3E++%3E%3A%3Abasic_string%28std%3A%3Astring+const%26%29+%28%29
so I'm not alone. Has anyone "gone down this road" before and could they offer some insight into what order the .h files should be loaded, or not loaded?

I have been looking at all the code and when I make a change I always compile bitcoind & bitcoin-qt. They have always compiled successfully. I haven't run the code each time, and the last time I tried to run it, I got the above in bitcoind & bitcoin-qt. Using gdb on bitcoind.exe (which is the debug version) it gives the above error before entering main.

The kind of things I have been doing are:
moving the class CAddrDB definition out of db.h and put into addrman.h, put walletdb.h into wallet.h, since CWallet, CWalletDB CWalletTx are so "intimate". Removed unused GetWalletFile(). Put ROTL32() and MurmurHash3() in bloom.cpp thereby eliminating their references in hash.h and the need for hash.cpp

That kind of stuff, and more. Somewhere the dreaded static initialization changed, and not for the better.

If anyone has seen this, and ordered the include files, in some .cpp file or another, a certain way to "fix" this, I would appreciate a "heads up" since I don't see any comments (documentation) in the code.

Otherwise, I will back track about a month and come "forward" again, this time running each change just to make sure, and not feeling satisfied that "this small rearrangement of .h files" or material in them, if it compiles and links is surely OK and "should work" Smiley

Ah, the mysteries of C++ and code that runs unseen before main begins...

Ron

If you are doing such things, make sure to create a pull request for our official repository Smiley.

Dia
sr. member
Activity: 260
Merit: 251
OK, bitcoin compilers, daemon or qt, I have been "re-factoring" in a sense the bitcoin 0.8.3 code and have come upon the dreaded error abort:
SIGSEGV, Segmentation fault. std::basic_string< char, std::char_traits, std::allocator  >::basic_string(std::string const&) ()

before main() apparently happens? I see lots of "stuff" on static initialization "issues" in C++, see
http://www.google.com/#fp=aae3bcc417c03f0c&q=in+GCC+received+signal+SIGSEGV%2C+Segmentation+fault.+std%3A%3Abasic_string%3C+char%2C+std%3A%3Achar_traits%3Cchar%3E%2C+std%3A%3Aallocator%3Cchar%3E++%3E%3A%3Abasic_string%28std%3A%3Astring+const%26%29+%28%29
so I'm not alone. Has anyone "gone down this road" before and could they offer some insight into what order the .h files should be loaded, or not loaded?

I have been looking at all the code and when I make a change I always compile bitcoind & bitcoin-qt. They have always compiled successfully. I haven't run the code each time, and the last time I tried to run it, I got the above in bitcoind & bitcoin-qt. Using gdb on bitcoind.exe (which is the debug version) it gives the above error before entering main.

The kind of things I have been doing are:
moving the class CAddrDB definition out of db.h and put into addrman.h, put walletdb.h into wallet.h, since CWallet, CWalletDB CWalletTx are so "intimate". Removed unused GetWalletFile(). Put ROTL32() and MurmurHash3() in bloom.cpp thereby eliminating their references in hash.h and the need for hash.cpp

That kind of stuff, and more. Somewhere the dreaded static initialization changed, and not for the better.

If anyone has seen this, and ordered the include files, in some .cpp file or another, a certain way to "fix" this, I would appreciate a "heads up" since I don't see any comments (documentation) in the code.

Otherwise, I will back track about a month and come "forward" again, this time running each change just to make sure, and not feeling satisfied that "this small rearrangement of .h files" or material in them, if it compiles and links is surely OK and "should work" Smiley

Ah, the mysteries of C++ and code that runs unseen before main begins...

Ron
sr. member
Activity: 260
Merit: 251
What could be the reasons Satoshi created Bitcoin in C++. This is the cause of all hell breaking loose in compiling it. Why did he not create it in Java? Was it due to performance reasons?

Hello Amitabh?

Perhaps it was the language he/she/they were most familiar with at the time (~2009). It actually was a MS VC++ 6.0 project initially, if I read the history correctly?

Java could be a performance issue as a stand alone application using a JVM, and an identical JVM may not have been on everyone's computer (windows, linux, Mac ...)

And there seems to be all kinds of gotchas/provisos, etc. on system resources and the JVM, see
http://docs.oracle.com/cd/A87860_01/doc/java.817/a83728/03writ10.htm
especially with all the things bitcoin has its fingers in: memory, files, sockets, threads and the dreaded preemptive garbage collection in Java, yada yada yada  Grin

And isn't it so, that Java only relatively recently, made facilities available for "bit twiddling", and bitcoin certainly does its share of big endian - little endian and other bit/byte/word/int/hash machinations Smiley

Ron
legendary
Activity: 1001
Merit: 1005
What could be the reasons Satoshi created Bitcoin in C++. This is the cause of all hell breaking loose in compiling it. Why did he not create it in Java? Was it due to performance reasons?
sr. member
Activity: 260
Merit: 251
Quote

But did litecoin-qt.pro when qmake'd produce a makefile.debug and .release? That is the important part. The UPNP is on, is off is qmake "chatter" which is "to be determined".

And what is on your .pro line 23, as given in the second line of your output above?

See message #41

Ron

But did litecoin-qt.pro when qmake'd produce a makefile.debug and .release? <= what did this mean?

And what is on your .pro line 23, as given in the second line of your output above? <= this problem is solved...was my mistake i missed one //


You are aware, I trust, that when you execute the following statement on a DOS command line:
qmake "USE_UPNP=-" litecoin-qt.pro
that among other things, the following happens. A new version of Makefile.Release and Makefile.Debug are produced, obviously by the action of qmake upon litecoin-qt.pro!

You can test it for yourself by deleting the Makefile.Debug & Makefile.Release and then re-run the above command line statement. Lo & behold, the makefiles are recreated.

This is just the first (of only two) steps of nitrogenetics step 4.3

Ron
sr. member
Activity: 260
Merit: 251
 Smiley
I'm starting to lose my patience.  Huh
I pay 0.3 BTC each person that successfully explains to me: how to build a litecoin-qt client on a windows system. ->From the first download up to the final "ctrl-B command" in the Qt Creator.

Hello ?

Is the offer of 0.3 BTC still on the table?  Smiley

I have successfully built a 0.8.3 litecoin-qt on windows, for windows, with not too much effort using the nitrogenetics prescription, which is, this thread. With, of course, a few wrinkles Grin, that a reasonably knowledgeable person could figure out.

I realize that text may not be sufficient (it hasn't worked so far), so I will also do a video (cam studio style at 1024x768).

Ron
newbie
Activity: 42
Merit: 0
This is an excellent post! I build my litecoind without any problem.
Interesting thing is inside litecoin's src folder I didn't find leveldb, but it builds.
member
Activity: 81
Merit: 1002
It was only the wind.
I also would be interessted in a toutorial or someting else to build the litecoin client on windows. I try it according to:

The Windows build instructions:

  -  Download the Qt Windows SDK and install it. You don't need the Symbian stuff, just the desktop Qt.
  -  Download and extract the dependencies archive [1], or compile openssl, boost and dbcxx yourself.
  -  Copy the contents of the folder "deps" to "X:\QtSDK\mingw", replace X:\ with the location where you installed the Qt SDK. Make sure that the contents of "deps\include" end up in the current    "include" directory.
  -  Open the bitcoin-qt.pro file in Qt Creator and build as normal (ctrl-B)

But this dindt work. I've tried it with the QT Creator 5.1.0

Please Help someone

That's your problem.
hero member
Activity: 686
Merit: 504
always the student, never the master.
maybe someone can help me i'm getting this error

Code:
c:\deps\Ocoin>make -f makefile.release
g++ -c -pipe -D_FORTIFY_SOURCE=2 -O2 -frtti -fexceptions -mthreads -fdiagnostics
-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wst
ack-protector -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_GUI -DBOOST_THREAD_USE_LIB -
DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DWIN32 -D_MT -DQ
T_THREAD_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_
LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2
-DQT_NEEDS_QMAIN -I"..\..\Qt\4.8.4\include\QtCore" -I"..\..\Qt\4.8.4\include\QtN
etwork" -I"..\..\Qt\4.8.4\include\QtGui" -I"..\..\Qt\4.8.4\include" -I"src" -I"s
rc\json" -I"src\qt" -I"..\..\Qt\4.8.4\include\ActiveQt" -I"build" -I"build" -I".
.\..\Qt\4.8.4\mkspecs\win32-g++" -o build\ocoin.o src\qt\ocoin.cpp
cc1plus.exe: unrecognized option `-Wextra'
cc1plus.exe: unrecognized option `-Wstack-protector'
cc1plus.exe: unrecognized option `-fdiagnostics-show-option'
mingw32-make: *** [build/ocoin.o] Error 1

c:\deps\Ocoin>

what the hell did i do here exactly? i'm building with all the references to libleveldb commented out in my qt.pro file if that helps
legendary
Activity: 1708
Merit: 1020
The script crash after thees errors:
[...]
the debug and release folders are empty

Just tested and it worked with a single double click on __everything_but_environment_easywinbuilder.bat (because I already have the correct mingw and qt installed).

Problem seems to be that it does not find the dependencies...   please find a longer answer here: Problem seems to be that it does not find the dependencies...


thanks for the help, but: did you forget a link?
oops. https://bitcointalksearch.org/topic/m.2845654
hero member
Activity: 854
Merit: 500
The script crash after thees errors:

c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_system-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_filesystem-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_program_options-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_thread-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lssl
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lcrypto

collect2.exe: Fehler: ld gab 1 als Ende-Status zurück

the debug and release folders are empty

Just tested and it worked with a single double click on __everything_but_environment_easywinbuilder.bat (because I already have the correct mingw and qt installed).

Problem seems to be that it does not find the dependencies...   please find a longer answer here: Problem seems to be that it does not find the dependencies...



thanks for the help, but: did you forget a link?
legendary
Activity: 1708
Merit: 1020
The script crash after thees errors:

c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_system-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_filesystem-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_program_options-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_thread-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lssl
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lcrypto

collect2.exe: Fehler: ld gab 1 als Ende-Status zurück

the debug and release folders are empty

Just tested and it worked with a single double click on __everything_but_environment_easywinbuilder.bat (because I already have the correct mingw and qt installed).

Problem seems to be that it does not find the dependencies...   please find a longer answer here: https://bitcointalksearch.org/topic/m.2845654

hero member
Activity: 854
Merit: 500
The script crash after thees errors:

c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_system-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_filesystem-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_program_options-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lboost_thread-mgw44-mt-s-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lssl
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot fin
d -lcrypto

collect2.exe: Fehler: ld gab 1 als Ende-Status zurück

the debug and release folders are empty
legendary
Activity: 1708
Merit: 1020
I'm starting to lose my patience.  Huh
I pay 0.3 BTC each person that successfully explains to me: how to build a litecoin-qt client on a windows system. ->From the first download up to the final "ctrl-B command" in the Qt Creator.

* Download your favorite Litecoin version: https://github.com/litecoin-project/litecoin and extract it.
* Download https://github.com/phelixbtc/bitcoin/archive/0.8.3-EasyWinBuilder-v0.2.zip   and copy the easywinbuilder folder into the litecoin folder (so that it is next to src, doc, ...)
* In the easywinbuilder folder edit set_vars.bat:  @set COINNAME=bitcoin    --->  @set COINNAME=litecoin
* In the easywinbuilder folder double click __all_easywinbuilder.bat
* Follow instructions



unfortunately, the script crashs after some times. I will try this on an other windows machine in a few hours. but thanks anyway

If you like send me the output by pm or here https://bitcointalksearch.org/topic/ann-easywinbuilder-the-easy-way-to-build-bitcoin-on-windows-252931 and I will look into it.
Pages:
Jump to: