cross-compiling to mingw32

Simon Josefsson jas at extundo.com
Thu Jan 19 11:17:03 CET 2006


I'm trying to get GnuTLS working under mingw32 again, but I can't seem
to get libgcrypt 1.2.2 to build.  libgpg-error 1.1 built fine.  The
cipher/ and src/ directories build fine, but the tests/ fails.  The
resulting library isn't usable, it seems all symbols are prefixed with
an unnecessary '_' if I run 'nm' on it.  Any ideas?

Building libgsasl against the generated libgcrypt fails with similar
errors:

i586-mingw32msvc-gcc -g -O2 -o test-gc-hmac-md5.exe test-gc-hmac-md5.o  ../gl/.libs/libgl.a -L/usr/local/w32root//lib /usr/local/w32root//lib/libgcrypt.a /usr/local/w32root//lib/libgpg-error.a
/usr/local/w32root//lib/libgcrypt.a(mpi-bit.o): In function `gcry_mpi_rshift':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-bit.c:206: undefined reference to `__gcry_mpih_rshift'
/usr/local/w32root//lib/libgcrypt.a(mpi-div.o): In function `_gcry_mpi_tdiv_qr':/home/jas/src/libgcrypt-1.2.2/mpi/mpi-div.c:223: undefined reference to `__gcry_mpih_lshift'

Libgsasl without libgcrypt builds fine and work fine from both
self-tests and on Windows, so I have confidence in the compiler.  I'm
using current mingw32 from Debian testing.

Build log of libgcrypt 1.2.2 below.

Thanks!

jas at latte:~/src/libgcrypt-1.2.2$ ./configure --host=i586-mingw32msvc --prefix=/usr/local/w32root/ --with-gpg-error-prefix=/usr/local/w32root/
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... i586-pc-mingw32msvc
checking target system type... i586-pc-mingw32msvc
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for i586-mingw32msvc-strip... i586-mingw32msvc-strip
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make sets $(MAKE)... (cached) yes
checking for i586-mingw32msvc-gcc... i586-mingw32msvc-gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i586-mingw32msvc-gcc accepts -g... yes
checking for i586-mingw32msvc-gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of i586-mingw32msvc-gcc... gcc3
checking how to run the C preprocessor... i586-mingw32msvc-gcc -E
checking for library containing strerror... none required
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... (cached) gawk
checking for a sed that does not truncate output... /bin/sed
checking for egrep... grep -E
checking for ld used by i586-mingw32msvc-gcc... /usr/i586-mingw32msvc/bin/ld
checking if the linker (/usr/i586-mingw32msvc/bin/ld) is GNU ld... yes
checking for /usr/i586-mingw32msvc/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/i586-mingw32msvc-nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... file_magic file format pei*-i386(.*architecture: i386)?
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for i586-mingw32msvc-g++... i586-mingw32msvc-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i586-mingw32msvc-g++ accepts -g... yes
checking dependency style of i586-mingw32msvc-g++... gcc3
checking how to run the C++ preprocessor... i586-mingw32msvc-g++ -E
checking for i586-mingw32msvc-g77... no
checking for i586-mingw32msvc-f77... no
checking for i586-mingw32msvc-xlf... no
checking for i586-mingw32msvc-frt... no
checking for i586-mingw32msvc-pgf77... no
checking for i586-mingw32msvc-fort77... no
checking for i586-mingw32msvc-fl32... no
checking for i586-mingw32msvc-af77... no
checking for i586-mingw32msvc-f90... no
checking for i586-mingw32msvc-xlf90... no
checking for i586-mingw32msvc-pgf90... no
checking for i586-mingw32msvc-epcf90... no
checking for i586-mingw32msvc-f95... no
checking for i586-mingw32msvc-fort... no
checking for i586-mingw32msvc-xlf95... no
checking for i586-mingw32msvc-ifc... no
checking for i586-mingw32msvc-efc... no
checking for i586-mingw32msvc-pgf95... no
checking for i586-mingw32msvc-lf95... no
checking for i586-mingw32msvc-gfortran... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/i586-mingw32msvc-nm -B output from i586-mingw32msvc-gcc object... ok
checking for objdir... .libs
checking for i586-mingw32msvc-ar... i586-mingw32msvc-ar
checking for i586-mingw32msvc-ranlib... i586-mingw32msvc-ranlib
checking for i586-mingw32msvc-strip... (cached) i586-mingw32msvc-strip
checking if i586-mingw32msvc-gcc static flag  works... yes
checking if i586-mingw32msvc-gcc supports -fno-rtti -fno-exceptions... no
checking for i586-mingw32msvc-gcc option to produce PIC... -DDLL_EXPORT
checking if i586-mingw32msvc-gcc PIC flag -DDLL_EXPORT works... yes
checking if i586-mingw32msvc-gcc supports -c -o file.o... yes
checking whether the i586-mingw32msvc-gcc linker (/usr/i586-mingw32msvc/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by i586-mingw32msvc-g++... /usr/i586-mingw32msvc/bin/ld
checking if the linker (/usr/i586-mingw32msvc/bin/ld) is GNU ld... yes
checking whether the i586-mingw32msvc-g++ linker (/usr/i586-mingw32msvc/bin/ld) supports shared libraries... yes
checking for i586-mingw32msvc-g++ option to produce PIC... -DDLL_EXPORT
checking if i586-mingw32msvc-g++ PIC flag -DDLL_EXPORT works... yes
checking if i586-mingw32msvc-g++ supports -c -o file.o... yes
checking whether the i586-mingw32msvc-g++ linker (/usr/i586-mingw32msvc/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
appending configuration tag "F77" to libtool
checking whether byte ordering is bigendian... no
checking for unsigned short... yes
checking size of unsigned short... 2
checking for unsigned int... yes
checking size of unsigned int... 4
checking for unsigned long... yes
checking size of unsigned long... 4
checking for unsigned long long... yes
checking size of unsigned long long... 8
configure: WARNING: No 64-bit types.  Disabling TIGER/192, SHA-384, and SHA-512
checking which symmetric ciphers to include... arcfour blowfish cast5 des aes twofish serpent rfc2268
checking which public-key ciphers to include... dsa elgamal rsa
checking which message digests to include... crc md4 md5 rmd160 sha1 sha256
checking which random module to use... default
checking whether use of /dev/random is requested... yes
checking whether assembler modules are requested... yes
checking whether memory guard is requested... no
checking whether use of capabilities is requested... no
checking whether non excutable stack support is requested... no
checking for gpg-error-config... /usr/local/w32root//bin/gpg-error-config
checking for GPG Error - version >= 0.5... yes
checking for gethostbyname in -lnsl... no
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... (cached) no
checking for ANSI C header files... (cached) yes
checking for unistd.h... (cached) yes
checking sys/select.h usability... no
checking sys/select.h presence... no
checking for sys/select.h... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking return type of signal handlers... void
checking whether sys_siglist is declared... no
checking for byte typedef... no
checking for ushort typedef... no
checking for ulong typedef... no
checking for u16 typedef... no
checking for u32 typedef... no
checking for socklen_t... no
checking for vprintf... yes
checking for _doprnt... no
checking for stpcpy... no
checking for strcasecmp... yes
checking for strtoul... yes
checking for memmove... yes
checking for stricmp... yes
checking for atexit... yes
checking for raise... yes
checking for strerror... yes
checking for rand... yes
checking for mmap... no
checking for getpagesize... yes
checking for waitpid... no
checking for wait4... no
checking for gettimeofday... no
checking for getrusage... no
checking for gethrtime... no
checking for clock_gettime... no
checking for mlock... no
checking sys/mman.h usability... no
checking sys/mman.h presence... no
checking for sys/mman.h... no
checking for random device... (cached) no
checking for _ prefix in compiled symbols... no
checking for mpi assembler functions... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mpi/Makefile
config.status: creating cipher/Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating src/libgcrypt-config
config.status: creating tests/Makefile
config.status: creating w32-dll/Makefile
config.status: creating config.h
config.status: linking ./mpi/i586/mpih-add1.S to mpi/mpih-add1.S
config.status: linking ./mpi/i586/mpih-sub1.S to mpi/mpih-sub1.S
config.status: linking ./mpi/i586/mpih-mul1.S to mpi/mpih-mul1.S
config.status: linking ./mpi/i586/mpih-mul2.S to mpi/mpih-mul2.S
config.status: linking ./mpi/i586/mpih-mul3.S to mpi/mpih-mul3.S
config.status: linking ./mpi/i586/mpih-lshift.S to mpi/mpih-lshift.S
config.status: linking ./mpi/i586/mpih-rshift.S to mpi/mpih-rshift.S
config.status: linking ./mpi/generic/mpi-asm-defs.h to mpi/mpi-asm-defs.h
config.status: executing depfiles commands
config.status: executing gcrypt-conf commands

                Configured for: MingW32 (i586-pc-mingw32msvc)

jas at latte:~/src/libgcrypt-1.2.2$
jas at latte:~/src/libgcrypt-1.2.2$ make
...
make[2]: Entering directory `/home/jas/src/libgcrypt-1.2.2/tests'
if i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../src   -I/usr/local/w32root//include -g -O2 -Wall -MT prime.o -MD -MP -MF ".deps/prime.Tpo" -c -o prime.o prime.c; \
        then mv -f ".deps/prime.Tpo" ".deps/prime.Po"; else rm -f ".deps/prime.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link i586-mingw32msvc-gcc -I/usr/local/w32root//include -g -O2 -Wall   -o prime.exe  prime.o ../src/libgcrypt.la
mkdir .libs
i586-mingw32msvc-gcc -I/usr/local/w32root//include -g -O2 -Wall -o prime.exe prime.o  ../src/.libs/libgcrypt.a -L/usr/local/w32root//lib /usr/local/w32root//lib/libgpg-error.a
../src/.libs/libgcrypt.a(mpi-add.o): In function `gcry_mpi_add':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-inline.h:118: undefined reference to `__gcry_mpih_sub_n'
../src/.libs/libgcrypt.a(mpi-add.o): In function `gcry_mpi_add':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-add.c:140: undefined reference to `__gcry_mpih_sub_n'
../src/.libs/libgcrypt.a(mpi-add.o): In function `gcry_mpi_add':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-inline.h:72: undefined reference to `__gcry_mpih_add_n'
../src/.libs/libgcrypt.a(mpi-add.o): In function `gcry_mpi_add':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-add.c:133: undefined reference to `__gcry_mpih_sub_n'
../src/.libs/libgcrypt.a(mpi-div.o): In function `_gcry_mpi_tdiv_qr':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-div.c:223: undefined reference to `__gcry_mpih_lshift'
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-div.c:229: undefined reference to `__gcry_mpih_lshift'
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-div.c:274: undefined reference to `__gcry_mpih_rshift'
../src/.libs/libgcrypt.a(mpi-div.o): In function `_gcry_mpi_tdiv_q_2exp':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-div.c:308: undefined reference to `__gcry_mpih_rshift'
../src/.libs/libgcrypt.a(mpi-bit.o): In function `gcry_mpi_rshift':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-bit.c:206: undefined reference to `__gcry_mpih_rshift'
../src/.libs/libgcrypt.a(mpi-pow.o): In function `gcry_mpi_powm':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-pow.c:92: undefined reference to `__gcry_mpih_lshift'
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-pow.c:258: undefined reference to `__gcry_mpih_lshift'
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-pow.c:277: undefined reference to `__gcry_mpih_rshift'
../src/.libs/libgcrypt.a(mpi-pow.o): In function `gcry_mpi_powm':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-inline.h:118: undefined reference to `__gcry_mpih_sub_n'
../src/.libs/libgcrypt.a(mpi-pow.o): In function `gcry_mpi_powm':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-pow.c:285: undefined reference to `__gcry_mpih_rshift'
../src/.libs/libgcrypt.a(mpi-mul.o): In function `gcry_mpi_mul_ui':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-mul.c:55: undefined reference to `__gcry_mpih_mul_1'
../src/.libs/libgcrypt.a(mpi-mul.o): In function `_gcry_mpi_mul_2exp':
/home/jas/src/libgcrypt-1.2.2/mpi/mpi-mul.c:90: undefined reference to `__gcry_mpih_lshift'
../src/.libs/libgcrypt.a(mpih-div.o): In function `_gcry_mpih_divrem':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-div.c:322: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-div.c:367: undefined reference to `__gcry_mpih_submul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-div.c:370: undefined reference to `__gcry_mpih_add_n'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `mul_n_basecase':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:106: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:91: undefined reference to `__gcry_mpih_mul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:103: undefined reference to `__gcry_mpih_add_n'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `mul_n':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:135: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:137: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:171: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:179: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:194: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:199: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:213: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:218: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:201: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:175: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:183: undefined reference to `__gcry_mpih_sub_n'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `_gcry_mpih_sqr_n_basecase':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:258: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:243: undefined reference to `__gcry_mpih_mul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:255: undefined reference to `__gcry_mpih_add_n'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `_gcry_mpih_sqr_n':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:285: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:287: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:308: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:317: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:321: undefined reference to `__gcry_mpih_sub_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:331: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:337: undefined reference to `__gcry_mpih_add_n'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `_gcry_mpih_mul':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:515: undefined reference to `__gcry_mpih_addmul_1'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:512: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:500: undefined reference to `__gcry_mpih_mul_1'
../src/.libs/libgcrypt.a(mpih-mul.o): In function `_gcry_mpih_mul_karatsuba_case':
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:412: undefined reference to `__gcry_mpih_add_n'
/home/jas/src/libgcrypt-1.2.2/mpi/mpih-mul.c:434: undefined reference to `__gcry_mpih_add_n'
collect2: ld returned 1 exit status
make[2]: *** [prime.exe] Error 1
make[2]: Leaving directory `/home/jas/src/libgcrypt-1.2.2/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jas/src/libgcrypt-1.2.2'
make: *** [all] Error 2
jas at latte:~/src/libgcrypt-1.2.2$



More information about the Gcrypt-devel mailing list