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

Achim boxbackup@boxbackup.org
Wed, 18 Mar 2009 15:01:55 +0100


Hello Chris:

On Tue, 17 Mar 2009 23:01:29 +0000 (GMT), Chris Wilson <chris@qwirx.com>
wrote:
>> * OpenSSL 0.9.8b works if you change e_os2.h and remove the modifier
>> "static" marked below.
>>    #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
>>    # define OPENSSL_IMPLEMENT_GLOBAL(type,name)			     \
>>    	extern type _hide_##name;				     \
>>    	type *_shadow_##name(void) { return &_hide_##name; }	     \
>>    	static type _hide_##name
>> ........^^^
>>
>> This compiles the package successfully, otherwise recent GCC complain
>> with an error
> 
> What error?

make CC=i586-mingw32msvc-gcc RANLIB=i586-mingw32msvc-ranlib
NM=i586-mingw32msvc-nm
[..]
set_key.c:72: error: static declaration of _hide_DES_check_key follows
non-static declaration
set_key.c:72: error: previous declaration of _hide_DES_check_key was here

>> * PCRE configure works fine, but "make winshared" or "make winshared
>> wininstall" fails with
>> /bin/bash: ./dftables.exe: cannot execute binary file
>> make: *** [pcre_chartables.c] Error 126
>>
>> so I compiled dftable myself (gcc dftables.c -o dftables), ran it with
>> (./dftables pcre_chartables.c) and after that the make process completes
>> and created the libraries
> 
> You might need to enable the Win32 PE binary loaded on your Linux distro 
> to make this work. I think it works out of the box on Ubuntu with Wine
and 
> the MinGW cross-compiler installed.

OK, I did not think of installing wine. Once I did that, it ran just fine
with no need to hand compile:

# make winshared
i586-mingw32msvc-gcc -c -g -O2 -I. ./dftables.c
/bin/bash ./libtool --mode=link i586-mingw32msvc-gcc -g -O2  -I. -I. -o
dftables.exe dftables.o
mkdir .libs
i586-mingw32msvc-gcc -g -O2 -I. -I. -o dftables.exe dftables.o
./dftables.exe pcre_chartables.c
 i586-mingw32msvc-gcc -c -g -O2 -I. -I. pcre_chartables.c  -DDLL_EXPORT
-DPIC -o .libs/pcre_chartables.o
 i586-mingw32msvc-gcc -c -g -O2 -I. -I. pcre_chartables.c -o
pcre_chartables.o >/dev/null 2>&1

>> [Box Backup]
>> ./configure --target=i586-mingw32msvc
>>
>> but compilation fails (also exporting all the variables above such as
>> CXXFLAGS etc):
>>
>> make WINDRES="i586-mingw32msvc-windres"
>>
>> [CXX]     BackupClientDirectoryRecord.cpp
>> BackupClientDirectoryRecord.cpp: In member function âvoid
>>
BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams&,
>> int64_t, const std::string&, bool)â:
>> BackupClientDirectoryRecord.cpp:231: error: âDIRâ was not declared in
>> this scope
> 
> Unfortunately there is no packaged mingw32 cross-compiler for the
platform 
> I'm working on at the moment, CentOS 5. I'm working on building one now. 
> If it works, I'll give cross-compliation another try with it.

I started to look into cross-compiling in the first place because it was
impossible for me to set up a sane build environment under Windows XP. 

Would somebody on the list perhaps be willing to upload their complete
build directory (with all dependencies and tool such as GCC, MinGW,
OpenSSL, wxWidgets, ...) that they use for Boxi and/or Box backup
compilation from SVN? 

I would offer to host that build environment as a public download on our
servers, so that everybody on the list can benefit from it.

This would be so useful and much much appreciated!