[Box Backup] Cross-compilation with i586-mingw32msvc under Ubuntu Hard
Achim
boxbackup@boxbackup.org
Tue, 17 Mar 2009 16:37:04 +0100
Good afternoon:
Below are my experiences with the cross-compiling instructions available on
SVN [1, 2]. All the requirements seem to work for 0.11rc2 (with
modifications, see below), but Box Backup itself fails with
"BackupClientDirectoryRecord.cpp:231: error: DIR was not declared in this
scope" (see bottom for details).
Could someone point me in the right direction as to how get
cross-compilation working:
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)
Linux 2.6.24-23-server #1 SMP Thu Feb 5 15:01:34 UTC 2009 x86_64
For instance, I can easily cross-compile and run all wxWidget examples.
Thank you in advance,
Achim
PS: Perhaps you want to include the suggestions below in the official
documentation?
===== snip =======
* Zlib works fine as per instructions
* 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
* For OpenSSL 0.9.8j you have to apply the patch from
<http://marc.info/?l=openssl-dev&m=116134515700535&q=p3>, and run
./Configure --prefix=/usr/local/i586-mingw32msvc mingw shared zlib-dynamic
followed by
make CC=i586-mingw32msvc-gcc RANLIB=i586-mingw32msvc-ranlib
NM=i586-mingw32msvc-nm
Optional: make install (we use the compile location for include later, no
need to install new libs)
* 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
* Boxbackup 0.11rc2 is a bit of a longer story, based on the "official
instructions" for 0.11rc2 [1] or the latest version [2]
this fails:
(from
https://www.boxbackup.org/svn/box/trunk/docs/api-docs/backup/win32_build_on_linux_using_mingw.txt)
./configure --target=i586-mingw32msvc CXXFLAGS="-mthreads
-I/usr/local/i586-mingw32msvc/include" LDFLAGS=" -mthreads
-L/usr/local/i586-mingw32msvc/lib" LIBS="-lcrypto -lws2_32 -lgdi32"
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... i586-pc-mingw32msvc
checking for g++... g++
checking for C++ compiler default output file name... configure: error: C++
compiler cannot create executables
See `config.log' for more details.
this also fails:
(https://www.boxbackup.org/svn/box/trunk/docs/api-docs/backup/win32_build_on_linux_using_mingw.txt)
export CXX=i586-mingw32msvc-g++
export AR=i586-mingw32msvc-ar
export RANLIB=i586-mingw32msvc-ranlib
export CFLAGS="-mthreads"
export CXXFLAGS="-mthreads"
export LDFLAGS="-mthreads"
export LIBS="-lcrypto -lws2_32 -lgdi32"
./configure --target=i586-mingw32msvc
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... i586-pc-mingw32msvc
checking for C++ compiler default output file name... configure: error: C++
compiler cannot create executables
See `config.log' for more details.
this works:
./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
BackupClientDirectoryRecord.cpp:231: error: âdirHandleâ was not declared
in this scope
BackupClientDirectoryRecord.cpp:237: error: â::opendirâ has not been
declared
BackupClientDirectoryRecord.cpp:272: error: â::readdirâ has not been
declared
BackupClientDirectoryRecord.cpp:279: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:280: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:280: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:280: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:287: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:348: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:367: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:425: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:425: error: invalid use of incomplete type
âstruct direntâ
BackupClientDirectoryRecord.cpp:269: error: forward declaration of âstruct
direntâ
BackupClientDirectoryRecord.cpp:443: error: â::closedirâ has not been
declared
BackupClientDirectoryRecord.cpp:453: error: â::closedirâ has not been
declared
make[1]: *** [../../release/bin/bbackupd/BackupClientDirectoryRecord.o]
Error 1
make[1]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/bin/bbackupd'
make: *** [parcels/boxbackup-0.11rc2-backup-client-mingw32msvc.tgz] Error 2
[1]
<https://www.boxbackup.org/svn/box/RELEASE/0.11rc2/docs/backup/win32_build_on_linux_using_mingw.txt>
[2]
<https://www.boxbackup.org/svn/box/trunk/docs/api-docs/backup/win32_build_on_linux_using_mingw.txt>