[Box Backup] Cross-compilation with i586-mingw32msvc under Ubuntu Hard
Achim
boxbackup@boxbackup.org
Fri, 20 Mar 2009 13:20:32 +0100
Hello Chris:
Please find below an update on the cross-compilation process that now works
smoother, based on your updated instructions at
<https://www.boxbackup.org/svn/box/trunk/docs/api-docs/backup/win32_build_on_linux_using_mingw.txt>
Hoever, it still fails at the final Box Backup compilation stage with
BoxPlatform.h:217:4: error: #error No way to get file descriptor from DIR
structure
* * * OpenSSL * * *
> cd openssl-0.9.8b
> ./Configure --prefix=/usr/local/i586-mingw32msvc mingw
> make makefile.one
Can't locate Mingw32f.pl in @INC (@INC contains: /etc/perl
/usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
/usr/local/lib/site_perl /usr/local/lib/perl/5.8.7
/usr/local/share/perl/5.8.7 . util/pl pl) at util/mk1mf.pl line 146.
# ls -l /usr/src/openssl-0.9.8b/util/pl/
total 48
-rw-rw-r-- 1 root root 3070 2005-09-20 09:09 BC-32.pl
-rw-rw-r-- 1 root root 2484 2003-02-22 00:19 linux.pl
-rw-rw-r-- 1 root root 2404 2003-06-26 13:58 Mingw32.pl
-rw-rw-r-- 1 root root 8755 2005-06-13 05:20 netware.pl
-rw-rw-r-- 1 root root 2796 2005-10-19 20:38 OS2-EMX.pl
-rw-rw-r-- 1 root root 616 1999-04-26 18:43 ultrix.pl
-rw-rw-r-- 1 root root 1454 1999-04-01 14:34 unix.pl
-rw-rw-r-- 1 root root 9164 2006-01-15 14:46 VC-32.pl
> wget
http://www.boxbackup.org/svn/box/chris/win32/support/openssl-0.9.8b-mingw-cross.patch
> patch -p1 < openssl-0.9.8b-mingw-cross.patch
The patch applies cleanly, but
> make -f makefile.one
still fails because of the static definition error, even though it is
included in the last lines of the patch
./crypto/des/set_key.c:68: error: static declaration of
â_hide_DES_check_keyâ follows non-static declaration
./crypto/des/set_key.c:68: error: previous declaration of
â_hide_DES_check_keyâ was here
After manually removing the static identifier in e_os2.h, the compilation
works
> make -f makefile.one install
works as expected
As an obersvation, I believe we should encourage the use of the latest
openssl-0.9.8j as opposed to the outdated "b" version? Only two hunks of
your patch fail in the first place, so perhaps it is not too hard to update
the patch?
patch -p1 < openssl-0.9.8b-mingw-cross.patch
patching file makefile.one
Hunk #1 FAILED at 15.
Hunk #3 succeeded at 70 with fuzz 2 (offset 5 lines).
Hunk #4 succeeded at 180 (offset 20 lines).
Hunk #5 FAILED at 382.
Hunk #6 succeeded at 459 (offset 28 lines).
Hunk #7 succeeded at 795 with fuzz 2 (offset 34 lines).
Hunk #8 succeeded at 2211 (offset 97 lines).
Hunk #9 succeeded at 2839 (offset 109 lines).
2 out of 9 hunks FAILED -- saving rejects to file makefile.one.rej
patching file ms/test.sh
patching file include/openssl/e_os2.h
* * * PCRE * * *
> export AR=i586-mingw32msvc-ar
> ./configure --host=i586-mingw32msvc --prefix=/usr/local/i586-mingw32msvc/
> make winshared
> cp .libs/libpcreposix.a /usr/local/i586-mingw32msvc/lib
> cp pcreposix.h /usr/local/i586-mingw32msvc/include
works as expected
PCRE is at version 7.8 at the moment, as opposed to 6.3
using the default instructions, 7.8 builds also just fine. The only
difference is that make does not know the target winshared any longer (in
case we need that), but "make" standalone also just works. In addition,
there is this (if needed):
# A PCRE user submitted the following addition, saying that it "will allow
# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and
get a
# nice DLL for Windows use". (It is used by the pcre.dll target.)
* * * mingw DLL * * *
cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz
/usr/local/i586-mingw32msvc/bin
gunzip /usr/local/i586-mingw32msvc/bin/mingwm10.dll.gz
* * * Box Backup * * *
changed the path to mingwm10.dll in parcels.txt to
/usr/local/i586-mingw32msvc/bin/mingwm10.dll
> ./configure --host=i586-mingw32msvc \
> CXXFLAGS="-mthreads -I/usr/local/i586-mingw32msvc/include" \
> LDFLAGS=" -mthreads -L/usr/local/i586-mingw32msvc/lib" \
> LIBS="-lcrypto -lws2_32 -lgdi32"
works as expected
> Regular expressions: yes
> Large files: no
> Berkeley DB: no
> Readline: no
> Extended attributes: no
but
> make
fails with
test -d parcels/boxbackup-0.11rc2-backup-client-mingw32msvc || mkdir
parcels/boxbackup-0.11rc2-backup-client-mingw32msvc
(cd bin/bbackupd; make RELEASE=1)
make[1]: Entering directory `/usr/src/boxi/boxbackup-0.11rc2/bin/bbackupd'
make[2]: Entering directory `/usr/src/boxi/boxbackup-0.11rc2/lib/win32'
[WINDRES] messages.rc
/bin/sh: windres: not found
make[2]: *** [../../release/lib/win32/messages.o] Error 127
make[2]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/lib/win32'
make[1]: *** [dep_modules] Error 2
make[1]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/bin/bbackupd'
make: *** [parcels/boxbackup-0.11rc2-backup-client-mingw32msvc.tgz] Error 2
/bin/sh: windres: not found
so I tried
> make WINDRES="i586-mingw32msvc-windres"
which in turn fails with
[WINDRES] messages.rc
[AR] ../../release/lib/win32/win32.a
i586-mingw32msvc-ar: creating ../../release/lib/win32/win32.a
[RANLIB] ../../release/lib/win32/win32.a
make[2]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/lib/win32'
make[2]: Entering directory `/usr/src/boxi/boxbackup-0.11rc2/lib/common'
[CXX] BoxException.cpp
In file included from Box.h:57,
from BoxException.cpp:49:
BoxPlatform.h:217:4: error: #error No way to get file descriptor from DIR
structure
make[2]: *** [../../release/lib/common/BoxException.o] Error 1
make[2]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/lib/common'
make[1]: *** [dep_modules] Error 2
make[1]: Leaving directory `/usr/src/boxi/boxbackup-0.11rc2/bin/bbackupd'
make: *** [parcels/boxbackup-0.11rc2-backup-client-mingw32msvc.tgz] Error 2
I then tried the alternative approach:
> 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
which fails with
./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.
So I don't even get to the compilation stage because of the configure
error...
> make CXX="$CXX" AR="$AR" RANLIB="$RANLIB" WINDRES="i386-mingw32-windres"