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

Achim boxbackup@boxbackup.org
Sun, 22 Mar 2009 01:44:51 +0100


Hello Chris:

On 22/3/09 00:40, Chris Wilson wrote:
> Is this a clean build, i.e. did you delete any existing openssl sources
> before doing this?

Absolutely:

$ rm -r openssl-0.9.8b
$ rm tar xvzf openssl-0.9.8b.tar.gz
$ ./Configure --prefix=/usr/local/i586-mingw32msvc mingw
$ make makefile.one
$ 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
patching file makefile.one
patching file ms/test.sh
patching file include/openssl/e_os2.h

> Also, could you double-check whether the patch actually removed the word
> static from include/openssl/e_os2.h or not?

$  grep -A 3 -B 3 static e_os2.h
# define OPENSSL_IMPLEMENT_GLOBAL(type,name)                         \
         extern type _hide_##name;                                    \
         type *_shadow_##name(void) { return &_hide_##name; }         \
         static type _hide_##name
# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
#else

So it appears that the patch is not applied.

>> $ grep regex config.log
>> configure:10158: checking regex.h usability
>> configure:10199: checking regex.h presence
>> conftest.cpp:35:19: error: regex.h: No such file or directory
>> | #include <regex.h>
>> configure:10240: WARNING: regex.h: accepted by the compiler, rejected
>> by the preprocessor!
>> configure:10242: WARNING: regex.h: proceeding with the compiler's result
>> configure:10267: checking for regex.h
>> ac_cv_header_regex_h=yes

$ rm trunk
$ svn co https://www.boxbackup.org/svn/box/trunk/
Checked out revision 2461.

$ cd trunk
$  ./bootstrap /usr/share/aclocal/libmcrypt.m4:17: warning: underquoted 
definition of AM_PATH_LIBMCRYPT
/usr/share/aclocal/libmcrypt.m4:17:   run info '(automake)Extending aclocal'
/usr/share/aclocal/libmcrypt.m4:17:   or see 
http://sources.redhat.com/automake/automake.html#Extending-aclocal

$ ./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"

[..]
Regular expressions: yes
Large files:         no
Berkeley DB:         no
Readline:            no
Extended attributes: no

 > Please could you tell me what happens between configure:10158 and
 > configure:10267,

configure:10158: checking regex.h usability
configure:10175: i586-mingw32msvc-g++ -c -mthreads 
-I/usr/local/i586-mingw32msvc/include  conftest.cpp >&5
configure:10181: $? = 0
configure:10195: result: yes
configure:10199: checking regex.h presence
configure:10214: i586-mingw32msvc-g++ -E  conftest.cpp
conftest.cpp:35:19: error: regex.h: No such file or directory
configure:10220: $? = 1configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "Box Backup"
| #define PACKAGE_TARNAME "box-backup"
| #define PACKAGE_VERSION "0.11"
| #define PACKAGE_STRING "Box Backup 0.11"
| #define PACKAGE_BUGREPORT "boxbackup@boxbackup.org"
| #define HAVE_EXCEPTIONS
| #define HAVE_NAMESPACES
| #define PERL_EXECUTABLE "perl"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_LIBZ 1
| #define HAVE_OPENSSL_SSL_H 1
| #define HAVE_LIBSSL 1
| #define HAVE_SSL 1
| #define HAVE_LIBCRYPTO 1
| #define STDC_HEADERS 1
| #define HAVE_GETOPT_H 1
| #define HAVE_PROCESS_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_TIME_H 1
| #define HAVE_CXXABI_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| /* end confdefs.h.  */
| #include <regex.h>
configure:10234: result: no
configure:10240: WARNING: regex.h: accepted by the compiler, rejected by 
the preprocessor!
configure:10242: WARNING: regex.h: proceeding with the compiler's result
configure:10267: checking for regex.h
configure:10274: result: yes

 > and also what config.log says about pcreposix.h?
config.log does not mention pcreposix.h at all!


$ locate regex.h
/usr/local/i586-mingw32msvc/include/regex.h


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:

if [ ! -r "/usr/local/i586-mingw32msvc/lib/libpcreposix.a" \
         -o ! -r "/usr/local/i586-mingw32msvc/lib/libpcre.a" \
         -o ! -r "/usr/local/i586-mingw32msvc/include/pcreposix.h" ]; then
         echo "Error: install PCRE as instructed by" \
                 "docs/backup/win32_build_on_cygwin_using_mingw.txt" >&2
         exit 2


$ make
[..]
   [CXX]     bbackupd.cpp
   [LINK]    ../../release/bin/bbackupd/bbackupd.exe
../../release/lib/common/common.a(ExcludeList.o): In function 
`~ExcludeList':
/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:60: undefined reference 
to `_regfree'
/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:60: undefined reference 
to `_regfree'
../../release/lib/common/common.a(ExcludeList.o):/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:325: 
undefined reference to `_regfree'
../../release/lib/common/common.a(ExcludeList.o):/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:375: 
undefined reference to `_regcomp'
../../release/lib/common/common.a(ExcludeList.o):/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:198: 
undefined reference to `_regcomp'
../../release/lib/common/common.a(ExcludeList.o):/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:203: 
undefined reference to `_regerror'
../../release/lib/common/common.a(ExcludeList.o):/usr/src/boxi/trunk/lib/common/ExcludeList.cpp:266: 
undefined reference to `_regexec'
collect2: ld returned 1 exit status
make[1]: *** [../../release/bin/bbackupd/bbackupd.exe] Error 1
make[1]: Leaving directory `/usr/src/boxi/trunk/bin/bbackupd'
make: *** [release/bin/bbackupd/bbackupd.exe] Error 2