[Box Backup] Crosscompiling boxbackup-0.10 for a Router (freetz)
Mirko
boxbackup@boxbackup.org
Tue, 31 Mar 2009 10:46:21 +0200
--Boundary-00=_dhd0Jll26YQbIxQ
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi Chris
Am Sonntag, 29. M=E4rz 2009 15:33:09 schrieb Chris Wilson:
> Hi Mirko,
>
> On Sun, 29 Mar 2009, Mirko wrote:
> > /home/m/freetz/freetz-trunk/toolchain/target/bin/mipsel-linux-uclibc-g+=
+-
> >uc -DNDEBUG -O2 -Wall -I../../lib/common -DBOX_VERSION=3D"\"0.10\"" -Os
> > -pipe -march=3D4kc -Wa,--trap -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> > -D_FILE_OFFSET_BITS=3D64 -Wall -c Daemon.cpp -o
> > ../../release/lib/server/Daemon.o
> > Daemon.cpp: In member function 'int Daemon::Main(const char*, int, const
> > char**)':
> > Daemon.cpp:174: error: no match for 'operator=3D' in 'pconfig =3D
> > Configuration::LoadAndVerify(const char*, const ConfigurationVerify*,
> > std::string&)(Daemon::GetConfigVerify(), ((std::string&)(& errors)))'
>
> I've checked in a change which I hope will fix this particular case, but I
> expect that other parts of the code will fail in the same way, and will
> need the same fix (initialise std::auto_ptr with the pointer rather than
> assigning to it).
>
> Unfortunately, until or unless I can get a toolchain build, I can't find
> those problems myself, as I don't see them on other platforms for some
> reason.
>
> Cheers, Chris.
it turns out, that your change to the source code is not necessary to compi=
le=20
Daemon.cpp, but you hint at the right direction. I have attached a patch=20
(against the 0.10 Sources) which will make the sources compile with this=20
cross-compiler. But as I get linking errors afterwards,
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<false>::Compress()':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb0EEC1Ev+0xa8): undefine=
d=20
reference to `inflateInit_'
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<false>::Output(void*, int, bool)':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb0EE6OutputEPvib+0xd4):=
=20
undefined reference to `inflate'
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<false>::~Compress()':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb0EED1Ev+0x84): undefine=
d=20
reference to `inflateEnd'
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<true>::Compress()':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb1EEC1Ev+0xa8): undefine=
d=20
reference to `deflateInit_'
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<true>::Output(void*, int, bool)':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb1EE6OutputEPvib+0xd4):=
=20
undefined reference to `deflate'
=2E./../release/lib/backupclient/backupclient.a(BackupStoreFile.o): In func=
tion=20
`Compress<true>::~Compress()':
BackupStoreFile.cpp:(.gnu.linkonce.t._ZN8CompressILb1EED1Ev+0x84): undefine=
d=20
reference to `deflateEnd'
collect2: ld returned 1 exit status
I don't know if this is worth the trouble. Thanks so far,
Mirko
--Boundary-00=_dhd0Jll26YQbIxQ
Content-Type: text/x-diff;
charset="iso-8859-1";
name="boxbackup.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="boxbackup.patch"
diff -rupN boxbackup-0.10/lib/backupclient/BackupClientFileAttributes.cpp lib/backupclient/BackupClientFileAttributes.cpp
--- lib/backupclient/BackupClientFileAttributes.cpp 2006-02-23 21:47:37.000000000 +0100
+++ lib/backupclient/BackupClientFileAttributes.cpp 2009-03-30 15:00:02.000000000 +0200
@@ -481,7 +481,7 @@ void BackupClientFileAttributes::FillAtt
char* buffer = static_cast<char*>(outputBlock.GetBuffer());
// Add the path name for the symbolic link, and add 0 termination
- std::memcpy(buffer+oldSize, linkedTo, linkedToSize);
+ memcpy(buffer+oldSize, linkedTo, linkedToSize);
buffer[oldSize+linkedToSize] = '\0';
}
#endif
@@ -549,9 +549,9 @@ void BackupClientFileAttributes::FillExt
// Store length and text for attibute name
u_int16_t keyLength = htons(attrKey.size()+1);
- std::memcpy(buffer+xattrSize, &keyLength, sizeof(u_int16_t));
+ memcpy(buffer+xattrSize, &keyLength, sizeof(u_int16_t));
xattrSize += sizeof(u_int16_t);
- std::memcpy(buffer+xattrSize, attrKey.c_str(), attrKey.size()+1);
+ memcpy(buffer+xattrSize, attrKey.c_str(), attrKey.size()+1);
xattrSize += attrKey.size()+1;
// Leave space for value size
@@ -584,12 +584,12 @@ void BackupClientFileAttributes::FillExt
// Fill in value size
u_int32_t valueLength = htonl(valueSize);
- std::memcpy(buffer+valueSizeOffset, &valueLength, sizeof(u_int32_t));
+ memcpy(buffer+valueSizeOffset, &valueLength, sizeof(u_int32_t));
}
// Fill in attribute block size
u_int32_t xattrBlockLength = htonl(xattrSize-xattrBlockSizeOffset-sizeof(u_int32_t));
- std::memcpy(buffer+xattrBlockSizeOffset, &xattrBlockLength, sizeof(u_int32_t));
+ memcpy(buffer+xattrBlockSizeOffset, &xattrBlockLength, sizeof(u_int32_t));
outputBlock.ResizeBlock(xattrSize);
}
@@ -676,7 +676,7 @@ void BackupClientFileAttributes::WriteAt
}
#endif
- xattrOffset += std::strlen(reinterpret_cast<char*>(pattr+1))+1;
+ xattrOffset += strlen(reinterpret_cast<char*>(pattr+1))+1;
}
// If working as root, set user IDs
@@ -817,7 +817,7 @@ void BackupClientFileAttributes::WriteEx
const char* buffer = static_cast<char*>(mpClearAttributes->GetBuffer());
u_int32_t xattrBlockLength = 0;
- std::memcpy(&xattrBlockLength, buffer+xattrOffset, sizeof(u_int32_t));
+ memcpy(&xattrBlockLength, buffer+xattrOffset, sizeof(u_int32_t));
int xattrBlockSize = ntohl(xattrBlockLength);
xattrOffset += sizeof(u_int32_t);
@@ -831,7 +831,7 @@ void BackupClientFileAttributes::WriteEx
while(xattrOffset<xattrEnd)
{
u_int16_t keyLength = 0;
- std::memcpy(&keyLength, buffer+xattrOffset, sizeof(u_int16_t));
+ memcpy(&keyLength, buffer+xattrOffset, sizeof(u_int16_t));
int keySize = ntohs(keyLength);
xattrOffset += sizeof(u_int16_t);
@@ -839,7 +839,7 @@ void BackupClientFileAttributes::WriteEx
xattrOffset += keySize;
u_int32_t valueLength = 0;
- std::memcpy(&valueLength, buffer+xattrOffset, sizeof(u_int32_t));
+ memcpy(&valueLength, buffer+xattrOffset, sizeof(u_int32_t));
int valueSize = ntohl(valueLength);
xattrOffset += sizeof(u_int32_t);
diff -rupN lib/server/Daemon.cpp lib/server/Daemon.cpp
--- lib/server/Daemon.cpp 2006-02-23 21:47:35.000000000 +0100
+++ lib/server/Daemon.cpp 2009-03-30 15:40:07.000000000 +0200
@@ -169,9 +169,13 @@ int Daemon::Main(const char *DefaultConf
try
{
- pconfig = Configuration::LoadAndVerify(
+ std::auto_ptr<Configuration> temp = Configuration::LoadAndVerify(
mConfigFileName.c_str(),
- GetConfigVerify(), errors);
+ GetConfigVerify(), errors);
+ pconfig = temp;
+/* pconfig = Configuration::LoadAndVerify(
+ mConfigFileName.c_str(),
+ GetConfigVerify(), errors); */
}
catch(BoxException &e)
{
--Boundary-00=_dhd0Jll26YQbIxQ--