[Box Backup] Cygwin build

Paul Arch boxbackup@fluffy.co.uk
Fri, 16 Apr 2004 09:34:47 +0800


> 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
>
Done.

> 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.
>
Done

>
> 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.
>
Done

I really like how all of this is structured. This is the first time I have
ever 'ported' something (well kinda ;) )

>
> 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));
> }
>
Yep that worked.  But I also had another problem, I added this to BoxTime.h
to resolve ( please advise ? )
typedef unsigned int int32;
inline box_time_t SecondsToBoxTime(int32 Seconds)
{
 return ((box_time_t)Seconds * MICRO_SEC_IN_SEC_LL);
}

>
> Looks promising!
>

With the above changes, and some more includes etc, I have compiled
successfully :
    bbackupctl
    bbackupd

I am currently tracking down issues in:
    bbackupquery
    bbstored
    bbstoreaccounts
 I seem to be having this problem (which relates to LinuxWorkaround somehow
? )
RaidFileRead.cpp: In static member function `static bool
   RaidFileRead::ReadDirectoryContents(int, const std::string&, int,
   std::vector<std::string, std::allocator<std::string> >&)':
RaidFileRead.cpp:1597: error: 'struct dirent' has no member named 'd_type'
RaidFileRead.cpp:1597: error: `DT_REG' undeclared (first use this function)
RaidFileRead.cpp:1597: error: (Each undeclared identifier is reported only
once

   for each function it appears in.)
RaidFileRead.cpp:1625: error: 'struct dirent' has no member named 'd_type'
RaidFileRead.cpp:1625: error: `DT_DIR' undeclared (first use this function)
make[1]: *** [../../debug/lib/raidfile/RaidFileRead.o] Error 1
make[1]: Leaving directory `/boxbackup-0.05/lib/raidfile'
make: *** [dep_modules] Error 2


Urgh ! Something to do with Cygwin and it determining difference between DIR
and FILEs.
Anyway, I added a definition for "d_type" ( ** WARNING - I DONT KNOW WHAT I
AM DOING ;) )for my dirent structure in /usr/include/sys/dirent.h, since it
didnt seem to exist, and LinuxWorkaround_FinishDirentStruct was attempting
to set it.  I do believe this is correct, I have read elsewhere you need to
use 'stat' within cygwin for DIR/FILE type.
struct dirent
{
  long d_version;
  ino_t d_ino;
  long d_fd;
  unsigned long __ino32;
  char d_name[256];
  int d_type;
};


So, it looks like **EVERYTHING** seems to compile **OK**.
I do get these warnings :
warning: ISO C requires whitespace after the macro name
warning: extra tokens at end of #ifdef directive

I will now setup server on linux box (actually upgrade to v0.05 from
0.03PLUS2), and try running the backup client.  If this works, I have
achieved what I have
set out to do.  I am reluctant to try running the server, especially because
of the DIR/FILE issue. Shall keep you posted ;)
cheers


Paul Arch
Software Engineer

S.D.M. Group Pty. Ltd.
http://www.sdmgroup.com.au