[Box Backup] Cygwin build

Ben Summers boxbackup at fluffy.co.uk
Thu Apr 15 09:47:17 BST 2004


On 15 Apr 2004, at 07:04, Paul Arch wrote:

> Hi,
>
> today I have been attempting to build box backup under cygwin, with 
> **some**
> success - getting the thing to build has been a little tricky, but I am
> getting close. So below are a few notes, and some questions :)
> Before I start, I must admit I have never programmed in c++ before, so 
> I am
> in a little over my head when trying to debug some things ;)

Thanks for attempting this, it'd be nice to have it running on Cygwin.

>
> I have pretty much set the CYGWIN build environment/platform the same 
> as if
> built under LINUX
>
> 1.  Obviously there are no make options for CYGWIN environment, so I 
> changed
> makebuildenv scripts the same as if the ENV was linux

In BoxPlatform.pm, make sure everything is set as for Linux. Make sure 
$platform_define is set to PLATFORM_CYGWIN.


> 2.  Need to define the following :
>     #define PLATFORM_LINUX
>     #define PLATFORM_BERKLEY_DB_NOT_SUPPORTED
>     #define PLATFORM_KQUEUE_NOT_SUPPORTED
>   I dont know where to set this up globally, could someone please 
> advise the
> right way ?

In lib/common/BoxPlatform.h, add a section like this:

#ifdef PLATFORM_CYGWIN
   #define PLATFORM_LINUX
   #define PLATFORM_BERKLEY_DB_NOT_SUPPORTED
   #define PLATFORM_KQUEUE_NOT_SUPPORTED
   #define INFTIM		-1
#endif

but put it *above* the PLATFORM_LINUX section (as it defines 
PLATFORM_LINUX, so needs to get the contents of that section too.)

> 3.  There were some 'missing' or extra files that needed to be included
> along the way:
>     #include <stdint.h>
>     #include <stdlib.h>
>     #include <netinet/in.h>
>     #include <sys/socket.h>
>     #include <sys/stat.h>
>
>
>     But this might of been something to do with me not using the
> 'makebuildenv' properly ?  I dont know, I am no expert - I just 
> figured out
> they needed to be included
>    somewhere for something to work ;)

It's probably that Cygwin's include files include different include 
files than other platforms. It'll probably be easiest to put these 
#includes within the PLATFORM_CYGWIN BoxPlatform.h section.

> 4.
>   // This doesnt work :
>   switch(::poll(&p, 1, (Timeout ==
> IOStream::TimeOutInfinite)?INFTIM:Timeout))
>   Complained about INFTIM unknown.
>
>   So I did this (dont know what I am doing here ;) )
>   switch(::poll(&p, 1, (Timeout == IOStream::TimeOutInfinite)))
>   which allowed compile to continue

That won't work, as I'm sure you'll have guessed. INFTIM needs to be 
-1, I added it to the BoxPlatform.h section above.

>
> 5.
> ./lib/common/BoxTime.cpp :
> BoxTime.cpp: In function `box_time_t GetCurrentBoxTime()':
> BoxTime.cpp:66: error: call of overloaded 
> `SecondsToBoxTime(u_int32_t)' is
>    ambiguous
> BoxTime.h:66: error: candidates are: box_time_t SecondsToBoxTime(long
> unsigned
>    int)
> BoxTime.h:70: error:                 box_time_t SecondsToBoxTime(long 
> long
>    unsigned int)
> make[1]: *** [../../debug/lib/common/BoxTime.o] Error 1
> make[1]: Leaving directory `/boxbackup-0.05/lib/common'
> make: *** [dep_modules] Error 2
>
> changed SecondsToBoxTime to return(1) - dont know whats going on here ?
>   which allowed compile to continue

That's possibly me making a tiny mistake. Try changing the function to 
read

box_time_t GetCurrentBoxTime()
{
	ASSERT(sizeof(uint32_t) == sizeof(time_t));
	return SecondsToBoxTime((uint32_t)time(0));
}

but it does worry me that the u_int32_t definition isn't quite right on 
Cygwin. But it could just be that the compiler is being totally 
paranoid for some reason. See what happens.


>
>
> After all of the above (hopefully thats all I did ;) , I got from :
> /boxbackup-0.05/debug/bin/bbackupctl
> $ make
>
> [blah blah blah ]
>
> $ cd ../../debug/bin/bbackupctl
>
> /boxbackup-0.05/debug/bin/bbackupctl
> $ ls
> bbackupctl.exe  bbackupctl.o
>
> /boxbackup-0.05/debug/bin/bbackupctl
> $ bbackupctl.exe
> Usage: bbackupctl [-q] [-c config_file] <command>
> Commands are:
>   sync -- start a syncronisation run now
>   reload -- reload daemon configuration
>   terminate -- terminate daemon now
>   wait-for-sync -- wait until the next sync starts, then exit
>
> /boxbackup-0.05/debug/bin/bbackupctl
> $

Looks promising!

>
> Sooo.... I will try building everything else, and then I will have a 
> play !
> If people could offer advice where I can put these changes, and how to
> generate diffs, I would be more than happy to provide :)

Hopefully you'll just need minor changes to the BoxPlatform.* files, 
and you can just send me a new version.

Unless Cygwin emulates UNIX filesystem behaviour, you may have problems 
with some of the tests. You may need to set up a server on a UNIX 
machine, and point bbackupd at it to test. This isn't ideal.

Ben






More information about the Boxbackup mailing list