Build failure on MinGW32 with libgpg-error 1.5

Simon Josefsson simon at josefsson.org
Sat Oct 27 23:02:27 CEST 2007


Hi!  I discovered and solved this problem some time ago, and may have
reported it but I couldn't find the report now.  So in case I never
reported it, or if it was forgotten, here is a complete report.  In case
I reported this and my suggested patch was incorrect, perhaps we could
restart any old discussion.

Building libgpg-error 1.5 under mingw32 on a debian machine fails:

$ tar xfj libgpg-error-1.5.tar.bz2
$ cd libgpg-error-1.5
$ ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu && make
...
make[3]: Entering directory `/home/jas/gnutls4win/dist/libgpg-error-1.5/src'
if /bin/sh ../libtool --tag=CC --mode=compile i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\"   -g -O2 -MT libgpg_error_la-w32-gettext.lo -MD -MP -MF ".deps/libgpg_error_la-w32-gettext.Tpo" -c -o libgpg_error_la-w32-gettext.lo `test -f 'w32-gettext.c' || echo './'`w32-gettext.c; \
        then mv -f ".deps/libgpg_error_la-w32-gettext.Tpo" ".deps/libgpg_error_la-w32-gettext.Plo"; else rm -f ".deps/libgpg_error_la-w32-gettext.Tpo"; exit 1; fi
 i586-mingw32msvc-gcc -DHAVE_CONFIG_H -I. -I. -I.. -DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -MT libgpg_error_la-w32-gettext.lo -MD -MP -MF .deps/libgpg_error_la-w32-gettext.Tpo -c w32-gettext.c  -DDLL_EXPORT -DPIC -o .libs/libgpg_error_la-w32-gettext.o
w32-gettext.c: In function '_nl_locale_name':
w32-gettext.c:851: error: duplicate case value
w32-gettext.c:850: error: previously used here
w32-gettext.c:1059: error: duplicate case value
w32-gettext.c:1058: error: previously used here
w32-gettext.c:1067: error: duplicate case value
w32-gettext.c:1066: error: previously used here
make[3]: *** [libgpg_error_la-w32-gettext.lo] Error 1
make[3]: Leaving directory `/home/jas/gnutls4win/dist/libgpg-error-1.5/src'

The relevant code (line ~850) reads:

      switch (sub)
	{
	case SUBLANG_BENGALI_INDIA: return "bn_IN";
	case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
	}

The reason is that the system headers declare one of the symbols:

jas at mocca:~$ grep SUBLANG_BENGALI /usr/i586-mingw32msvc/include/*
/usr/i586-mingw32msvc/include/winnt.h:#define SUBLANG_BENGALI_INDIA     0x01
jas at mocca:~$ 

And w32-gettext.c declares the other symbol:

# ifndef SUBLANG_BENGALI_INDIA
# define SUBLANG_BENGALI_INDIA 0x00
# endif
# ifndef SUBLANG_BENGALI_BANGLADESH
# define SUBLANG_BENGALI_BANGLADESH 0x01
# endif

I'm using the patch below to solve this.  What do you think?

--- src/libgpg-error-1.5/src/w32-gettext.c.orig	2007-06-27 12:40:37.000000000 +0200
+++ src/libgpg-error-1.5/src/w32-gettext.c	2007-06-27 12:41:11.000000000 +0200
@@ -522,10 +522,10 @@
 # define SUBLANG_AZERI_CYRILLIC 0x02
 # endif
 # ifndef SUBLANG_BENGALI_INDIA
-# define SUBLANG_BENGALI_INDIA 0x00
+# define SUBLANG_BENGALI_INDIA 0x01
 # endif
 # ifndef SUBLANG_BENGALI_BANGLADESH
-# define SUBLANG_BENGALI_BANGLADESH 0x01
+# define SUBLANG_BENGALI_BANGLADESH 0x00
 # endif
 # ifndef SUBLANG_CHINESE_MACAU
 # define SUBLANG_CHINESE_MACAU 0x05
@@ -618,16 +618,16 @@
 # define SUBLANG_NEPALI_INDIA 0x02
 # endif
 # ifndef SUBLANG_PUNJABI_INDIA
-# define SUBLANG_PUNJABI_INDIA 0x00
+# define SUBLANG_PUNJABI_INDIA 0x01
 # endif
 # ifndef SUBLANG_PUNJABI_PAKISTAN
-# define SUBLANG_PUNJABI_PAKISTAN 0x01
+# define SUBLANG_PUNJABI_PAKISTAN 0x00
 # endif
 # ifndef SUBLANG_ROMANIAN_ROMANIA
-# define SUBLANG_ROMANIAN_ROMANIA 0x00
+# define SUBLANG_ROMANIAN_ROMANIA 0x01
 # endif
 # ifndef SUBLANG_ROMANIAN_MOLDOVA
-# define SUBLANG_ROMANIAN_MOLDOVA 0x01
+# define SUBLANG_ROMANIAN_MOLDOVA 0x00
 # endif
 # ifndef SUBLANG_SERBIAN_LATIN
 # define SUBLANG_SERBIAN_LATIN 0x02

Thanks,
Simon



More information about the Gcrypt-devel mailing list