[Box Backup] Cross-compilation with i586-mingw32msvc under Ubuntu Hardy

Achim boxbackup@boxbackup.org
Mon, 23 Mar 2009 15:32:37 +0100


Hello Chris:

On Sun, 22 Mar 2009 10:35:16 +0000 (GMT), Chris Wilson <chris@qwirx.com>
>> So it appears that the patch is not applied.
> 
> Thers's another copy of e_os2.h. Updated patch checked in.

OK

> Not surprisingly, the preprocessor test fails when 
> -I/usr/local/i586-mingw32msvc/include is not included on GCC's command 
> line. Will investigate why it's not there. Possibly it's in CFLAGS and 
> shouldn't be.

OK.

>> $ locate regex.h
>> /usr/local/i586-mingw32msvc/include/regex.h
> 
> Do you know why this file is there? It's confusing the build system and I

> don't think it should be there. pcreposix.h on the other hand should be.

I have no idea how it got there. I can try to purge the existing
installation, start from scratch and see where the file comes from.

>> Could this have something to do with libpcre.a that you are looking for
>> in
>> infrastructure/mingw/configure.sh, but is not contained anywhere in the 
>> instructions:
> 
> You're right that libpcre.a needs to be copied from the PCRE build 
> directory as well as libpcreposix.a. However, even doing so is not
enough, 
> as long as you still have regex.h in /usr/local/i586-mingw32msvc/include,

> as the libraries will not be detected and used.
> 
> If you remove /usr/local/i586-mingw32msvc/include/regex.h, copy libpcre.a

> and configure Box Backup again, that should hopefully fix the 
> cross-compile.

As outlined in my other post, adding -lpcre to the LIBS makes the
compilation work:

$ ./configure --host=i586-mingw32msvc \
    CXXFLAGS="-mthreads -I/usr/local/i586-mingw32msvc/include" \
    LDFLAGS=" -mthreads -L/usr/local/i586-mingw32msvc/lib" \
    LIBS="-lpcre -lcrypto -lws2_32 -lgdi32" 
[..]
Regular expressions: yes
Large files:         no
Berkeley DB:         no
Readline:            no
Extended attributes: no

$ make
[..]
make[1]: Leaving directory `/usr/src/boxi/trunk/docs'
mkdir -p parcels/boxbackup-trunk_2461M-backup-server-mingw32msvc
cp -p docs/man/raidfile.conf.5.gz
parcels/boxbackup-trunk_2461M-backup-server-mingw32msvc
test -d parcels/boxbackup-trunk_2461M-backup-server-mingw32msvc || mkdir
parcels/boxbackup-trunk_2461M-backup-server-mingw32msvc
(cd parcels; tar cf - boxbackup-trunk_2461M-backup-server-mingw32msvc |
gzip -9 - > boxbackup-trunk_2461M-backup-server-mingw32msvc.tgz )

:-) 

The only problem now is that running the resulting binaries on a Windows
machine always leads to a segfault as soon as the SSL certificates become
available.

> bbackupquery.exe
NOTICE:  Box Backup Query Tool vtrunk_2461M, (c) Ben Summers and
contributors 2003-2008
ERROR:   SSL error while loading certificates from
D:\install\boxbackup\cli.2461\1-cert.pem: error:02001002:system
library:fopen:No
such file or directory
ERROR:   SSL error while loading certificates from
D:\install\boxbackup\cli.2461\1-cert.pem: error:20074002:BIO
routines:FILE_CTRL:s
ystem lib
ERROR:   SSL error while loading certificates from
D:\install\boxbackup\cli.2461\1-cert.pem: error:140DC002:SSL
routines:SSL_CTX_use
_certificate_chain_file:system lib
WARNING: Exception thrown: ServerException(TLSLoadCertificatesFailed) at
TLSContext.cpp(81)
Exception: Server TLSLoadCertificatesFailed (3/25)

> ren 1-cert.pem.old 1-cert.pem

crashes, and the debug log (don't have an actual debugger installed) shows

AppName: bbackupquery.exe	 AppVer: 0.0.0.0	 ModName: bbackupquery.exe
ModVer: 0.0.0.0	 Offset: 0013aec2

<?xml version="1.0" encoding="UTF-16"?>
<DATABASE>
<EXE NAME="bbackupquery.exe" FILTER="GRABMI_FILTER_PRIVACY">
    <MATCHING_FILE NAME="bbackupctl.exe" SIZE="2547662"
CHECKSUM="0x9C60E2B9" MODULE_TYPE="WIN32" PE_CHECKSUM="0x275B3F" 

LINKER_VERSION="0x10000" LINK_DATE="03/22/2009 01:49:19"
UPTO_LINK_DATE="03/22/2009 01:49:19" />
    <MATCHING_FILE NAME="bbackupd.exe" SIZE="10798630"
CHECKSUM="0x9882B562" MODULE_TYPE="WIN32" PE_CHECKSUM="0xA55F8E" 

LINKER_VERSION="0x10000" LINK_DATE="03/22/2009 01:49:13"
UPTO_LINK_DATE="03/22/2009 01:49:13" />
    <MATCHING_FILE NAME="bbackupquery.exe" SIZE="8088674"
CHECKSUM="0x86A17670" MODULE_TYPE="WIN32" PE_CHECKSUM="0x7BDA67" 

LINKER_VERSION="0x10000" LINK_DATE="03/22/2009 01:49:18"
UPTO_LINK_DATE="03/22/2009 01:49:18" />
    <MATCHING_FILE NAME="mingwm10.dll" SIZE="1169788" CHECKSUM="0x61C07720"
MODULE_TYPE="WIN32" PE_CHECKSUM="0x1286C0" 

LINKER_VERSION="0x10000" LINK_DATE="10/28/2007 10:06:36"
UPTO_LINK_DATE="10/28/2007 10:06:36" />
</EXE>
<EXE NAME="kernel32.dll" FILTER="GRABMI_FILTER_THISFILEONLY">
    <MATCHING_FILE NAME="kernel32.dll" SIZE="1037824" CHECKSUM="0x1506EFBE"
BIN_FILE_VERSION="5.1.2600.3119" 

BIN_PRODUCT_VERSION="5.1.2600.3119" PRODUCT_VERSION="5.1.2600.3119"
FILE_DESCRIPTION="DLL de cliente API BASE de Windows NT" 

COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Sistema operativo
Microsoft® Windows®" FILE_VERSION="5.1.2600.3119 

(xpsp_sp2_gdr.070416-1301)" ORIGINAL_FILENAME="kernel32"
INTERNAL_NAME="kernel32" LEGAL_COPYRIGHT="Copyright (C) Microsoft 

Corporation. Reservados todos los derechos." VERFILEDATEHI="0x0"
VERFILEDATELO="0x0" VERFILEOS="0x40004" VERFILETYPE="0x2" 

MODULE_TYPE="WIN32" PE_CHECKSUM="0x10CBAD" LINKER_VERSION="0x50001"
UPTO_BIN_FILE_VERSION="5.1.2600.3119" 

UPTO_BIN_PRODUCT_VERSION="5.1.2600.3119" LINK_DATE="04/16/2007 15:54:21"
UPTO_LINK_DATE="04/16/2007 15:54:21" 

VER_LANGUAGE="Español (alfabetización internacional) [0xc0a]" />
</EXE>
</DATABASE>