satoshi

Sr. Member





Offline



Activity: 364

Merit: 2583







FounderSr. MemberActivity: 364Merit: 2583 Re: A few suggestions December 14, 2009, 05:15:56 PM

Last edit: December 14, 2009, 05:27:14 PM by satoshi Merited by NeuroticFish (10), 0t3p0t (1), 4gu5dr4g0n (1) #21 Quote from: madhatter2 on December 14, 2009, 03:01:39 PM Can anyone shed some light here?



g++ -c -O0 -Wno-invalid-offsetof -Wformat -g -D__WXMAC__ -DNOPCH -DBUILD_MACOSX -I"/usr/include" -I"/usr/local/include/wx-2.8" -I"/usr/local/include" -I"/usr/local/boost_1_41_0" -I"/sw/include/db4" -I"/usr/local/ssl/include" -I"/usr/local/lib/wx/include/mac-ansi-release-2.8" -o headers.h.gch headers.h

...

ui.h:430: error: no matching function for call to 'wxTextCtrl::SetValue(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'

/usr/local/include/wx-2.8/wx/textctrl.h:303: note: candidates are: virtual void wxTextCtrlBase::SetValue(const wxString&)



It looks like the implicit conversion from std::string to wxString isn't working. That's used everywhere, the conversion needs to work.



wxString is complicated by supporting win32's 16-bit wchar and 8-bit ansi dual-compile. You can get that problem on Windows if the "unicode" (meaning wchar) build is used, so that wxString is wchar and std::string is char.



It's probably some wxWidgets compile defines or build configuration. What "configure" options did you use?



I'm not sure __WXMAC__ is the right define. It may be the Mac Classic support that's complicating wxString, and we only want OSX. Try __WXOSX__ (or see below)



http://docs.wxwidgets.org/stable/wx_cppconst.html

"There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and Carbon. The Classic version is the only one to work on Mac OS version 8. The Carbon version may be built either as CFM or Mach-O (binary format, like ELF) and the former may run under OS 9 while the latter only runs under OS X. Finally, there is a new Cocoa port which can only be used under OS X. To summarize:



* If you want to test for all Mac platforms, classic and OS X, you should test both __WXMAC__ and __WXCOCOA__.

* If you want to test for any GUI Mac port under OS X, use __WXOSX__.

* If you want to test for any port under Mac OS X, including, for example, wxGTK and also wxBase, use __DARWIN__" It looks like the implicit conversion from std::string to wxString isn't working. That's used everywhere, the conversion needs to work.wxString is complicated by supporting win32's 16-bit wchar and 8-bit ansi dual-compile. You can get that problem on Windows if the "unicode" (meaning wchar) build is used, so that wxString is wchar and std::string is char.It's probably some wxWidgets compile defines or build configuration. What "configure" options did you use?I'm not sure __WXMAC__ is the right define. It may be the Mac Classic support that's complicating wxString, and we only want OSX. Try __WXOSX__ (or see below)"There are two wxWidgets ports to Mac OS. One of them, wxMac, exists in two versions: Classic and Carbon. The Classic version is the only one to work on Mac OS version 8. The Carbon version may be built either as CFM or Mach-O (binary format, like ELF) and the former may run under OS 9 while the latter only runs under OS X. Finally, there is a new Cocoa port which can only be used under OS X. To summarize:* If you want to test for all Mac platforms, classic and OS X, you should test both __WXMAC__ and __WXCOCOA__.* If you want to test for any GUI Mac port under OS X, use __WXOSX__.* If you want to test for any port under Mac OS X, including, for example, wxGTK and also wxBase, use __DARWIN__"

The Madhatter



Offline



Activity: 490

Merit: 504





My avatar pic says it all







Hero MemberActivity: 490Merit: 504My avatar pic says it all Re: A few suggestions December 15, 2009, 05:21:09 AM #22



There are only defines for __WXCOCOA__ and __WXMAC__ in wx/defs.h (I must be missing something here..maybe my wxwidgets needs to be rebuilt -- I'll try that). I have tried combinations of those existing defines without success. The other option is to use gtk on OSX but the windowing will be slower and (my opinion) "ugly". Carbon would be the best selection for OSX. I'll keep hacking at it until I get it working.



I also now have a working startup script for FreeBSD that will launch xorg's virtual framebuffer onto the localhost, fire up bitcoin and have the X11 screen output get stuffed into memory (instead of the monitor). This is a real big hack, but it does enable someone to run bitcoin as a pseudo unix daemon. I have had the code running for over 12h now and I don't detect any memory leaks or other weirdness.



Also I have a simple network monitor that will detect if bitcoin has crashed/stopped responding on port 8333, send me a page, and start the daemon back up again. This setup is ideal. I have started deploying seeds on servers I control that are all over the world.



One question: how do I enable the debug.log? I have tried stopping bitcoin and touching ~/.bitcoin/debug.log and starting bitcoin again. It never seems to write to the file. Am I missing something?



I will include these tools once I get SF setup.



Cheers!

Okay, I will look into the std::string issue. It is also throwing the same std::string issue on the latest version of Ubuntu Linux. So this isn't just OSX related. I have to say that my main background is C, not C++ so I am still learning some of the C++ data types/headers/and other specifics "as I go".There are only defines for __WXCOCOA__ and __WXMAC__ in wx/defs.h (I must be missing something here..maybe my wxwidgets needs to be rebuilt -- I'll try that). I have tried combinations of those existing defines without success. The other option is to use gtk on OSX but the windowing will be slower and (my opinion) "ugly". Carbon would be the best selection for OSX. I'll keep hacking at it until I get it working.I also now have a working startup script for FreeBSD that will launch xorg's virtual framebuffer onto the localhost, fire up bitcoin and have the X11 screen output get stuffed into memory (instead of the monitor). This is a real big hack, but it does enable someone to run bitcoin as a pseudo unix daemon. I have had the code running for over 12h now and I don't detect any memory leaks or other weirdness.Also I have a simple network monitor that will detect if bitcoin has crashed/stopped responding on port 8333, send me a page, and start the daemon back up again. This setup is ideal. I have started deploying seeds on servers I control that are all over the world.One question: how do I enable the debug.log? I have tried stopping bitcoin and touching ~/.bitcoin/debug.log and starting bitcoin again. It never seems to write to the file. Am I missing something?I will include these tools once I get SF setup.Cheers!

satoshi

Sr. Member





Offline



Activity: 364

Merit: 2583







FounderSr. MemberActivity: 364Merit: 2583 Re: A few suggestions December 15, 2009, 08:37:32 PM #24 Quote from: madhatter2 on December 15, 2009, 05:21:09 AM It is also throwing the same std::string issue on the latest version of Ubuntu Linux.

Then it must be something you're doing differently with building or configuring wxWidgets.



What options did you use on the wxWidgets "configure" script? The options I used are in build-unix.txt.



Quote One question: how do I enable the debug.log? I have tried stopping bitcoin and touching ~/.bitcoin/debug.log and starting bitcoin again. It never seems to write to the file. Am I missing something?

Never heard of that happening. Is there anything in debug.log? If you touched the file, that sounds like something is there. Does the program have write access to the file? Then it must be something you're doing differently with building or configuring wxWidgets.What options did you use on the wxWidgets "configure" script? The options I used are in build-unix.txt.Never heard of that happening. Is there anything in debug.log? If you touched the file, that sounds like something is there. Does the program have write access to the file?

The Madhatter



Offline



Activity: 490

Merit: 504





My avatar pic says it all







Hero MemberActivity: 490Merit: 504My avatar pic says it all Re: A few suggestions December 15, 2009, 09:14:13 PM

Last edit: December 15, 2009, 09:22:39 PM by satoshi #25 I used the default build options. I will try the options from your txt file. On FreeBSD it just worked right from the normal ports system. Which is excellent. It means that installing bitcoin via the same ports system (my goal) will be a snap.



Yes, the debug.log has the proper permissions. I'll re-read the source. There must be something I am missing.



The Madhatter



Offline



Activity: 490

Merit: 504





My avatar pic says it all







Hero MemberActivity: 490Merit: 504My avatar pic says it all FreeBSD build patch December 17, 2009, 01:21:49 PM #27

--- headers.h.orig 2009-12-14 12:29:39.000000000 +0000

+++ headers.h 2009-12-14 12:41:08.000000000 +0000

@@ -35,7 +35,12 @@

#include <limits.h>

#include <float.h>

#include <assert.h>

+#ifndef BUILD_FREEBSD //malloc.h is part of stdlib.h on FreeBSD

#include <malloc.h>

+#endif

+#ifdef BUILD_FREEBSD

+#include <netinet/in.h>

+#endif

#include <memory>

#define BOUNDSCHECK 1

#include <sstream>



[madhatter@10 /home/madhatter/src/bitcoin]# cat makefile.fbsd

# Copyright (c) 2009 Satoshi Nakamoto

# Distributed under the MIT/X11 software license, see the accompanying

# file license.txt or





ifneq "$(BUILD)" "debug"

ifneq "$(BUILD)" "release"

BUILD=debug

endif

endif

ifeq "$(BUILD)" "debug"

D=d

DEBUGFLAGS=-g

endif







INCLUDEPATHS= \

-I"/usr/include" \

-I"/usr/local/include" \

-I"/usr/local/include/db47" \

-I"/usr/local/include/wx-2.8" \

-I"/usr/local/lib/wx/include/gtk2-ansi-release-2.8"



LIBPATHS= \

-L"/usr/lib" \

-L"/usr/local/lib" \

-L"/usr/local/lib/db47"



LIBS= \

-Wl,-Bstatic \

-l boost_system -l boost_filesystem \

-l db_cxx \

-Wl,-Bdynamic \

-l wx_base-2.8 \

-l wx_gtk2_core-2.8 \

-l wx_gtk2_html-2.8 \

-l wx_gtk2_richtext-2.8 \

-l crypto \

-l gtk-x11-2.0 -l gthread-2.0 -l SM



WXDEFS=-D__WXGTK__ -DNOPCH -DBUILD_FREEBSD

CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)

HEADERS=headers.h util.h main.h serialize.h uint256.h key.h bignum.h script.h db.h base58.h







all: bitcoin





headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h

g++ -c $(CFLAGS) -o $@ $<



obj/util.o: util.cpp $(HEADERS)

g++ -c $(CFLAGS) -o $@ $<



obj/script.o: script.cpp $(HEADERS)

g++ -c $(CFLAGS) -o $@ $<



obj/db.o: db.cpp $(HEADERS) market.h

g++ -c $(CFLAGS) -o $@ $<



obj/net.o: net.cpp $(HEADERS) net.h

g++ -c $(CFLAGS) -o $@ $<



obj/main.o: main.cpp $(HEADERS) net.h market.h sha.h

g++ -c $(CFLAGS) -o $@ $<



obj/market.o: market.cpp $(HEADERS) market.h

g++ -c $(CFLAGS) -o $@ $<



obj/ui.o: ui.cpp $(HEADERS) net.h uibase.h ui.h market.h

g++ -c $(CFLAGS) -o $@ $<



obj/uibase.o: uibase.cpp uibase.h

g++ -c $(CFLAGS) -o $@ $<



obj/sha.o: sha.cpp sha.h

g++ -c $(CFLAGS) -O3 -o $@ $<



obj/irc.o: irc.cpp $(HEADERS)

g++ -c $(CFLAGS) -o $@ $<









OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \

obj/ui.o obj/uibase.o obj/sha.o obj/irc.o



bitcoin: headers.h.gch $(OBJS)

g++ $(CFLAGS) -o $@ $(LIBPATHS) $(OBJS) $(LIBS)



clean:

-rm obj/*

-rm headers.h.gch

[madhatter@10 /home/madhatter/src/bitcoin]# diff -u headers.h.orig headers.h--- headers.h.orig 2009-12-14 12:29:39.000000000 +0000+++ headers.h 2009-12-14 12:41:08.000000000 +0000@@ -35,7 +35,12 @@#include #include #include +#ifndef BUILD_FREEBSD //malloc.h is part of stdlib.h on FreeBSD#include +#endif+#ifdef BUILD_FREEBSD+#include +#endif#include #define BOUNDSCHECK 1#include [madhatter@10 /home/madhatter/src/bitcoin]# cat makefile.fbsd# Copyright (c) 2009 Satoshi Nakamoto# Distributed under the MIT/X11 software license, see the accompanying# file license.txt or http://www.opensource.org/licenses/mit-license.php ifneq "$(BUILD)" "debug"ifneq "$(BUILD)" "release"BUILD=debugendifendififeq "$(BUILD)" "debug"D=dDEBUGFLAGS=-gendifINCLUDEPATHS= \-I"/usr/include" \-I"/usr/local/include" \-I"/usr/local/include/db47" \-I"/usr/local/include/wx-2.8" \-I"/usr/local/lib/wx/include/gtk2-ansi-release-2.8"LIBPATHS= \-L"/usr/lib" \-L"/usr/local/lib" \-L"/usr/local/lib/db47"LIBS= \-Wl,-Bstatic \-l boost_system -l boost_filesystem \-l db_cxx \-Wl,-Bdynamic \-l wx_base-2.8 \-l wx_gtk2_core-2.8 \-l wx_gtk2_html-2.8 \-l wx_gtk2_richtext-2.8 \-l crypto \-l gtk-x11-2.0 -l gthread-2.0 -l SMWXDEFS=-D__WXGTK__ -DNOPCH -DBUILD_FREEBSDCFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)HEADERS=headers.h util.h main.h serialize.h uint256.h key.h bignum.h script.h db.h base58.hall: bitcoinheaders.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.hg++ -c $(CFLAGS) -o $@ $

The Madhatter



Offline



Activity: 490

Merit: 504





My avatar pic says it all







Hero MemberActivity: 490Merit: 504My avatar pic says it all Re: A few suggestions December 17, 2009, 01:23:43 PM #28



Install all of the required software from /usr/ports and then compile using the makefile.fbsd



"It just works". To build on FreeBSD:Install all of the required software from /usr/ports and then compile using the makefile.fbsd"It just works".

satoshi

Sr. Member





Offline



Activity: 364

Merit: 2583







FounderSr. MemberActivity: 364Merit: 2583 Re: A few suggestions December 17, 2009, 06:38:06 PM #29



I committed the changes to headers.h. For consistency, I used __BSD__. The complete list of defines is at

#ifdef __BSD__

#include <netinet/in.h>

#endif



malloc.h is only needed on windows, I'll move that into the __WXMSW__ section before it causes any more trouble. That's good, is it running fine on FreeBSD?I committed the changes to headers.h. For consistency, I used __BSD__. The complete list of defines is at http://docs.wxwidgets.org/stable/wx_cppconst.html #ifdef __BSD__#include #endifmalloc.h is only needed on windows, I'll move that into the __WXMSW__ section before it causes any more trouble.

The Doctor



Offline



Activity: 1

Merit: 0







NewbieActivity: 1Merit: 0 Re: A few suggestions December 18, 2009, 03:11:53 PM #30 Hi. I would like to second the headless/non-GUI mode for /*nix/i systems. It would be useful to be able to start the Bitcoin software from an initscript or one's ~/.bashrc (or equivalent) file and let it run in the background, silently cranking away.



Also, what would the feasibility of changing the location of the wallet.dat file be for the Win32 client? I ask this because I was playing around with the .zipped Windows Bitcoin client yesterday, and it struck me that it would make a good portable application. I was toying with the idea of decompressing it into a TrueCrypt volume on a USB drive so that it could, say, be taken on the road, run for a few hours, and then shut down just before the volume was unmounted, but it created the wallet.dat file in the C:\Documents and Settings\username\Application Data\Bitcoin directory. In effect, using a portable version of Bitcoin to eventually grow a portable wallet.

satoshi

Sr. Member





Offline



Activity: 364

Merit: 2583







FounderSr. MemberActivity: 364Merit: 2583 Re: A few suggestions December 18, 2009, 05:37:48 PM #31 What you can currently do is set "Minimize to the tray" in options, then run it as "bitcoin -min" so it starts minimized. The only visible part will be a small (20x20) icon on the tray, which can be doubleclicked if you want to access the UI. Note: there's a bug with tray icons sometimes disappearing on 64-bit Karmic Koala, not sure if it's from 64-bit or Karmic, it was fine on 32-bit Jaunty.



We didn't have time to implement the "Start Bitcoin on system startup" feature on Linux in time for 0.2 so it's greyed out. I figured Linux people wouldn't mind doing that manually anyway. I guess they need to know about the -min switch to do it right.



You can locate the data directory where you want with the "-datadir=<directory>" switch. I know someone is already doing that to put it on a TrueCrypt USB drive.