[Box Backup] Compile Boxi from tarball or trunk?

Achim boxbackup at boxbackup.org
Thu Apr 2 17:49:55 BST 2009


Hello Chris:

After looking into your suggestions, and after some modifications (details
below) to the source, I can at least compile boxi, but the linking still
breaks with references to wxStackWalker (again, even after the changes you
outlined in the document) and some functions in
boxbackup/bin/bbackupd/Win32ServiceFunctions.h which is really weird:

/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/ld:
warning: auto-importing has been activated without --enable-auto-import
specified on the command line.
This should work unless it involves constant data structures referencing
symbols from auto-imported

DLLs.TestFrame.o: In function `_ZN11StackWalker13GetStackTraceEv':
/usr/src/boxi/src/TestFrame.cc:465: undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
TestFrame.o: In function
`_ZThn4_N7CppUnit10TestCallerI14TestOpenWizardE5setUpEv':
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerD2Ev[wxStackWalker::~wxStackWalker()]+0xa):
undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerC2EPKc[wxStackWalker::wxStackWalker(char
const*)]+0x15): undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x10): undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x14): undefined reference to
`wxStackWalker::WalkFromException()'

../boxbackup/release/bin/bbackupd/BackupDaemon.o: In function
`_ZN12BackupDaemon4MainERKSs':
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:306: undefined
reference to `InstallService(char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:311: undefined
reference to `RemoveService(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:323: undefined
reference to `OurService(char const*)'

Info: resolving vtable for CppUnit::TestSetUpby linking to
__imp___ZTVN7CppUnit9TestSetUpE (auto-import)

collect2: ld returned 1 exit status


wxWidgets 2.6.4 does not compile with the options you point out at all, but
2.8.10 build just fine (with 2.6. compatibility enabled).

Any help (or pointers in the right direction) would be very welcome. Are we
missing an include? How does CPPunit interact with WX, and why does the
linker not find entry points to boxbackup internal functions?

Thank you in advance, Achim


=== Details (messier details and exact error messages below) ===
* Devel/CPPunit
* Devel/cvs
* Devel/gettext-devel
* Devel/libtool
* Devel/patchutils
* Devel/pkg-config
* Devel/subversion

http://wiki.wxwidgets.org/Cygwin
http://wiki.wxwidgets.org/Talk:Cygwin


Install Cygwin, Zlib, OpenSSL and PCRE as described in
boxbackup/docs/backup/win32_build_on_cygwin_using_mingw.txt


* * * PCRE * * * 
cd /usr/src
wget http://prdownloads.sourceforge.net/pcre/pcre-6.3.tar.bz2?download
tar xjvf pcre-6.3.tar.bz2
cd pcre-6.3
export CFLAGS="-mno-cygwin"
./configure
make
cp .libs/libpcre.a .libs/libpcreposix.a /lib/mingw

cp pcreposix.h /usr/include/mingw



* * * Zlib * * * 
BUGBUG not required?

* * * OpenSSL * * * 
see boxbackup document




* * * wxWidgets 2.8.10 (2.6.4 does not compile with options given) * * *
!!! close window and open new cygwin shell !!!

wget http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.10.tar.gz
tar xvzf wxWidgets-2.8.10.tar.gz
cd wxWidgets-2.8.10

update setup.h.in and 
update include/wx/msw/setup.h

#define wxUSE_DEBUG_CONTEXT 1
#define wxUSE_MEMORY_TRACING 1
#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
#define wxUSE_DEBUG_NEW_ALWAYS 0
#define wxUSE_ON_FATAL_EXCEPTION 1
#define wxUSE_STACKWALKER 1
#define wxUSE_DEBUGREPORT 1
#define wxUSE_FSVOLUME 1

BUGBUG what about these:
#define wxUSE_UNICODE 1

// wxHandleFatalExceptions() may be used to catch the program faults at run
// time and, instead of terminating the program with a usual GPF message
box,
// call the user-defined wxApp::OnFatalException() function. If you set
// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work.
//
// This setting is for Win32 only and can only be enabled if your compiler
// supports Win32 structured exception handling (currently only VC++ does)
//
// Default is 1
//
// Recommended setting: 1 if your compiler supports it.
#define wxUSE_ON_FATAL_EXCEPTION 1





mkdir DEBUG && cd DEBUG


export CFLAGS="-mno-cygwin -mthreads" CXXFLAGS="-mno-cygwin -mthreads"
CPPFLAGS="-mno-cygwin -mthreads" LDFLAGS="-mno-cygwin -mwindows -mthreads"

BUGBUG review these (working!) settings for export, for instance about
(need to add -mthreads though!)
export CFLAGS="-mno-cygwin -O4" CXXFLAGS="-mno-cygwin -O4"
CPPFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin -mwindows"

../configure --enable-unicode --with-msw --disable-precomp-headers
--without-expat --enable-shared --disable-static --enable-debug
--enable-debug_gdb  --disable-optimise --build=i686-pc-mingw32
--with-cppunit-prefix=/usr/local

make  


make install




* * * CPP Unit * * * 
!!! close window and open new cygwin shell !!!

Add C:\Cygwin\usr\local\bin (or whatever the DOS path to your Cygwin
/usr/local/bin directory is) to your Windows PATH environment variable.

Download CPPUNIT from Sourceforge:

wget
http://kent.dl.sourceforge.net/sourceforge/cppunit/cppunit-1.12.0.tar.gz

Configure, make and install:

./configure CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin"
make
make install





* * * BOXI * * * 
!!! close window and open new cygwin shell !!!

Download Boxi from SVN (also fetches latest boxbackup from svn)

svn co https://svn.sourceforge.net/svnroot/boxi/trunk/boxi

cd boxi/
./configure-mingw.sh

Will not result in a working Makefile for box, so we need to do that
manually and downgrade to compilabe R2465 at the same time:

cd boxbackup
./infrastructure/mingw/configure.sh

cd /usr/src/boxi
./make-image-headers.pl
make

boxbackup compiles fine, boxi stops (details below) unless we apply the
following changes:

* * * wxFileDialog() * * *
Remove line 20 with the faulty (empty) default constructor in
include/TestFileDialog.h

        TestFileDialog () : wxFileDialog() { }



* * * wxStackFrame and wxStackWalker * * *
wxStackFrame and wxStackWalker are not available even after the changes in
setup.h.in and the corresponding MSW file.
change following lines (around 82) in
/usr/local/include/wx-2.8/wx/msw/chkconf.h
#    define wxUSE_ON_FATAL_EXCEPTION 1
#    define wxUSE_CRASHREPORT 1
#    define wxUSE_STACKWALKER 1

Does this perhaps von MSVC++? From the file:

/*
 * All of the settings below require SEH support (__try/__catch) and can't
work
 * without it.
 */


* * * regex.h * * *
regex.h: No such file or directory
include/ClientConfig.h:30

ln -s /usr/include/mingw/pcreposix.h /usr/include/mingw/regex.h

change include/ClientConfig.h
#ifndef _REGEX_H_
#include <regex.h> // needed by ExcludeList
#endif



* * * <windows.h> * * *
Add in line 27 for include/BoxiApp.h
#include <wx/msw/winundef.h>
(before #include <wx/app.h>)



* * * __MSVCRT_VERSION__ * * *
/usr/i686-pc-mingw32/include/_mingw.h

#ifndef __MSVCRT_VERSION__
# define __MSVCRT_VERSION__ 0x0600

change to

# define __MSVCRT_VERSION__ 0x0601


* * * Wrong type 'emu_stat&' * * *
invalid initialization of reference of type 'emu_stat&' from expression of
type 'stat'
../boxbackup/lib/common/FileModificationTime.h:18: error: in passing
argument 1 of `box_time_t FileModificationTime(emu_stat&)'

solution: leave out for now in src/TestBackup.cc around line 319

//                 return FileModificationTime((emu_stat)st)
//                         - SecondsToBoxTime(rClientConfig.GetKeyValueInt(
//                               "MinimumFileAge"));
                 return 0;


* * * BBParams * * *
CompareProgressPanel.cc:465: error: cannot declare variable `BBParams' 
to be of type `BoxiCompareParamsShim'

Solution: comment out all 5 occurences of BBParams in
src/CompareProgressPanel.cc







Build process works fine now until the link stage, which stops with
references to wxStackWalker (again!) and some functions in
boxbackup/bin/bbackupd/Win32ServiceFunctions.h:


/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/ld:
warning: auto-importing has been activated without --enable-auto-import
specified on the command line.
This should work unless it involves constant data structures referencing
symbols from auto-imported

DLLs.TestFrame.o: In function `_ZN11StackWalker13GetStackTraceEv':
/usr/src/boxi/src/TestFrame.cc:465: undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
TestFrame.o: In function
`_ZThn4_N7CppUnit10TestCallerI14TestOpenWizardE5setUpEv':
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerD2Ev[wxStackWalker::~wxStackWalker()]+0xa):
undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerC2EPKc[wxStackWalker::wxStackWalker(char
const*)]+0x15): undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x10): undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x14): undefined reference to
`wxStackWalker::WalkFromException()'

../boxbackup/release/bin/bbackupd/BackupDaemon.o: In function
`_ZN12BackupDaemon4MainERKSs':
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:306: undefined
reference to `InstallService(char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:311: undefined
reference to `RemoveService(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
/usr/src/boxi/boxbackup/bin/bbackupd/BackupDaemon.cpp:323: undefined
reference to `OurService(char const*)'

Info: resolving vtable for CppUnit::TestSetUpby linking to
__imp___ZTVN7CppUnit9TestSetUpE (auto-import)

collect2: ld returned 1 exit status







==== messy details and error messages ====
In file included from ../include/MainFrame.h:30,
                  from main.cc:52:
../include/ClientConfig.h:30:44: regex.h: No such file or directory
In file included from ../include/Location.h:34,
                  from ../include/ClientConfig.h:36,
                  from ../include/MainFrame.h:30,
                  from main.cc:52:
../boxbackup/lib/common/ExcludeList.h:62: error: `regex_t' was not 
declared in t
his scope
../boxbackup/lib/common/ExcludeList.h:62: error: template argument 1 is 
invalid
../boxbackup/lib/common/ExcludeList.h:62: error: template argument 2 is 
invalid
../boxbackup/lib/common/ExcludeList.h:62: error: ISO C++ forbids 
declaration of
`mRegex' with no type
../boxbackup/lib/common/ExcludeList.h: In member function `unsigned int 
ExcludeL
ist::SizeOfRegexList() const':
../boxbackup/lib/common/ExcludeList.h:54: error: request for member 
`size' in `(
(const ExcludeList*)this)->ExcludeList::mRegex', which is of non-class 
type `con
st int'
In file included from main.cc:54:
../include/TestFileDialog.h: In constructor 
`TestFileDialog::TestFileDialog()':
../include/TestFileDialog.h:20: error: no matching function for call to 
`wxFileD
ialog::wxFileDialog()'
/usr/local/include/wx-2.8/wx/msw/filedlg.h:51: note: candidates are: 
wxFileDialo
g::wxFileDialog(const wxFileDialog&)
/usr/local/include/wx-2.8/wx/msw/filedlg.h:30: note: 
wxFileDialog::wxFileDialog
(wxWindow*, const wxString&, const wxString&, const wxString&, const 
wxString&,
long int, const wxPoint&, const wxSize&, const wxString&)
make[2]: *** [main.o] Error 1
make[2]: Leaving directory `/usr/src/boxi/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/boxi'
make: *** [all] Error 2



so we remove line 20 with the faulty (empty) default constructor in 
../include/TestFileDialog.h:20

        TestFileDialog () : wxFileDialog() { }









regex.h: No such file or directory
../include/ClientConfig.h:30


ln -s /usr/include/mingw/pcreposix.h /usr/include/mingw/regex.h

change ../include/ClientConfig.h
#ifndef _REGEX_H_
#include <regex.h> // needed by ExcludeList
#endif












TestFrame.cc:441: error: `StackWalker' has not been declared
TestFrame.cc:441: error: expected `,' or `...' before '&' token
TestFrame.cc:442: error: ISO C++ forbids declaration of `wxStackFrame' with
no type
TestFrame.cc: In function `void OnStackFrame(int)':


with no type
change following lines (around 82) in
/usr/local/include/wx-2.8/wx/msw/chkconf.h
#    define wxUSE_ON_FATAL_EXCEPTION 1
#    define wxUSE_CRASHREPORT 1
#    define wxUSE_STACKWALKER 1

/*
 * All of the settings below require SEH support (__try/__catch) and can't
work
 * without it.
 */

perhaps we need to try with an older wxWidgets (2.6.4?) that does not rely
on _MSC_VER?











In file included from ../include/BoxiApp.h:28,
                  from TestWizard.cc:38:
/usr/local/include/wx-2.8/wx/app.h:230:59: macro "Yield" passed 1 
arguments, but takes just 0
In file included from ../include/BoxiApp.h:28,
                  from TestWizard.cc:38:
/usr/local/include/wx-2.8/wx/app.h:230: error: invalid member function 
declaration
/usr/local/include/wx-2.8/wx/app.h:406:49: macro "Yield" passed 1 
arguments, but takes just 0
/usr/local/include/wx-2.8/wx/app.h:406: error: ISO C++ forbids 
initialization of member `Yield'
/usr/local/include/wx-2.8/wx/app.h:406: error: making `Yield' static
/usr/local/include/wx-2.8/wx/app.h:406: error: ISO C++ forbids in-class 
initialization of non-const static member `Yield'
/usr/local/include/wx-2.8/wx/app.h:406: error: `Yield' declared as a 
`virtual' field
In file included from /usr/local/include/wx-2.8/wx/app.h:562,
                  from ../include/BoxiApp.h:28,
                  from TestWizard.cc:38:
/usr/local/include/wx-2.8/wx/msw/app.h:38:49: macro "Yield" passed 1 
arguments, but takes just 0
In file included from /usr/local/include/wx-2.8/wx/app.h:562,
                  from ../include/BoxiApp.h:28,
                  from TestWizard.cc:38:
/usr/local/include/wx-2.8/wx/msw/app.h:38: error: `Yield' declared as a 
`virtual' field
make: *** [TestWizard.o] Error 1


See http://www.wxwidgets.org/faqmsw.htm#asuffix

Add in line 27 for ../include/BoxiApp.h
#include <wx/msw/winundef.h>
(before #include <wx/app.h>)


Reason: grep windows.h *

boxbackup/lib/common/.svn/text-base/TemporaryDirectory.h.svn-base: 
#include <windows.h>
boxbackup/lib/common/.svn/text-base/Test.cpp.svn-base:#include <windows.h>
boxbackup/lib/common/TemporaryDirectory.h:      #include <windows.h>
boxbackup/lib/common/Test.cpp:#include <windows.h>
boxbackup/lib/server/.svn/text-base/WinNamedPipeStream.cpp.svn-base:#include

<windows.h>
boxbackup/lib/server/WinNamedPipeStream.cpp:#include <windows.h>
boxbackup/lib/win32/.svn/text-base/emu.cpp.svn-base:#include <windows.h>
boxbackup/lib/win32/emu.cpp:#include <windows.h>
boxbackup/test/win32/.svn/text-base/testlibwin32.cpp.svn-base://#include 
<windows.h>
boxbackup/test/win32/.svn/text-base/timezone.cpp.svn-base:#include 
<windows.h>
boxbackup/test/win32/testlibwin32.cpp://#include <windows.h>
boxbackup/test/win32/timezone.cpp:#include <windows.h>
intl/.svn/text-base/localcharset.c.svn-base:# include <windows.h>
intl/localcharset.c:# include <windows.h>


ideally every inclusion of windows.h would be matched:
#include <windows.h>
#include "wx/msw/winundef.h"







../boxbackup/lib/common/BoxPlatform.h:34:5: #error Must include Box.h 
before sys/types.h

$ grep __MSVCRT_VERSION__

/usr/i686-pc-mingw32/include/_mingw.h

#ifndef __MSVCRT_VERSION__
# define __MSVCRT_VERSION__ 0x0600

change to

# define __MSVCRT_VERSION__ 0x0601










TestBackup.cc: In function `box_time_t GetLatestFileUploadTime(const
Configuration&)':
TestBackup.cc:319: error: invalid initialization of reference of type
'emu_stat&' from expression of
 type 'stat'
../boxbackup/lib/common/FileModificationTime.h:18: error: in passing
argument 1 of `box_time_t FileM
odificationTime(emu_stat&)'
make: *** [TestBackup.o] Error 1


solution: leave out for now in TestBackup.cc:319

//                 return FileModificationTime((emu_stat)st)
//                         - SecondsToBoxTime(rClientConfig.GetKeyValueInt(
//                               "MinimumFileAge"));
                 return 0;







CompareProgressPanel.cc: In member function `void 
CompareProgressPanel::StartCompare(const BoxiCompareParams&)':
CompareProgressPanel.cc:465: error: cannot declare variable `BBParams' 
to be of type `BoxiCompareParamsShim'
CompareProgressPanel.cc:465: error:   because the following virtual 
functions are abstract:
../boxbackup/bin/bbackupquery/BoxBackupCompareParams.h:94: error: 
virtual void BoxBackupCompareParams::NotifyDirComparing(const std
::string&, const std::string&)
../boxbackup/bin/bbackupquery/BoxBackupCompareParams.h:99: error: 
virtual void BoxBackupCompareParams::NotifyFileComparing(const st
d::string&, const std::string&)
make[2]: *** [CompareProgressPanel.o] Error 1
make[2]: Leaving directory `/usr/src/boxi/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/boxi'
make: *** [all] Error 2

Solution: comment out all occurences of BBParams in CompareProgressPanel.cc











DLLs.TestFrame.o: In function `_ZN11StackWalker13GetStackTraceEv':
/usr/src/boxi.626/src/TestFrame.cc:465: undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
TestFrame.o: In function
`_ZThn4_N7CppUnit10TestCallerI14TestOpenWizardE5setUpEv':
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerD2Ev[wxStackWalker::~wxStackWalker()]+0xa):
undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.text$_ZN13wxStackWalkerC2EPKc[wxStackWalker::wxStackWalker(char
const*)]+0x15): undefined reference to `__imp___ZTV13wxStackWalker'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x10): undefined reference to
`wxStackWalker::Walk(unsigned int, unsigned int)'
/usr/local/include/cppunit/TestCaller.h:(.rdata$_ZTV11StackWalker[vtable
for StackWalker]+0x14): undefined reference to
`wxStackWalker::WalkFromException()'



Remove all references to TestFrame* in Makefile


        MainFrame.$(OBJEXT) TestFrame.$(OBJEXT) \


        MainFrame.cc\
        TestFrame.cc\
        WxGuiTestHelper.cpp\


	include ./$(DEPDIR)/MainFrame.Po
	include ./$(DEPDIR)/TestFrame.Po
	include ./$(DEPDIR)/ParamPanel.Po



../boxbackup/release/bin/bbackupd/BackupDaemon.o: In function
`_ZN12BackupDaemon4MainERKSs':
/usr/src/boxi.626/boxbackup/bin/bbackupd/BackupDaemon.cpp:306: undefined
reference to `InstallService(char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/usr/src/boxi.626/boxbackup/bin/bbackupd/BackupDaemon.cpp:311: undefined
reference to `RemoveService(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)'
/usr/src/boxi.626/boxbackup/bin/bbackupd/BackupDaemon.cpp:323: undefined
reference to `OurService(char const*)'

Info: resolving vtable for CppUnit::TestSetUpby linking to
__imp___ZTVN7CppUnit9TestSetUpE (auto-import)

















what about msw port
http://graphics.cs.uiuc.edu/svn/wickbert/trunk/wxModeler/wx-mswd/wx/setup.h


make clean
make



#if wxUSE_STACKWALKER && defined( __WXDEBUG__ )



#ifdef __WXDEBUG__
     #if wxUSE_STACKWALKER
         #include "wx/stackwalk.h"
         #ifdef __WXMSW__
             #include "wx/msw/debughlp.h"
         #endif
     #endif // wxUSE_STACKWALKER
#endif // __WXDEBUG__



__WXDEBUG__

http://docs.wxwidgets.org/trunk/page_wxusedef.html
wxUSE_FSVOLUME
wxUSE_STACKWALKER
http://docs.wxwidgets.org/trunk/classwx_stack_walker.html
http://docs.wxwidgets.org/trunk/classwx_f_s_volume.html

how to enable Debugging
http://docs.wxwidgets.org/trunk/overview_debugging.html

what about wxUSE_DEBUG_CONTEXT is set to 1 in setup.h

If you don't need wxThread, just pass --disable-threads to configure.
If you need wxThread then you are stuck with mingwm10.dll.



More information about the Boxbackup mailing list