bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext-0.12.1 msgfmt (built with bison 1.875) cannot read .po files


From: Alexander Dupuy
Subject: Re: gettext-0.12.1 msgfmt (built with bison 1.875) cannot read .po files
Date: Mon, 15 Sep 2003 15:00:39 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314

Bruno Haible wrote:
There is a Makefile rule for generating po-gram-gen2.h from po-gram-gen.h.
Why is this rule not being executed on your machine when you do "make"?

Interesting - I didn't notice that rule, and in fact, the rule *is* being executed and a po-gram-gen2.h file is created.

The problem is that I am using a subdirectory build (implicit --srcdir=..), so the generated po-gram-gen.h and po-gram-gen2.h end up in ./$ARCH/gettext-tools/src/ but the only file that includes it is in the source directory:

./gettext-tools/src/po-lex.c:49:#include "po-gram-gen2.h"

The command used to compile po-lex.c (`pwd`==$ARCH/gettext-tools/src/):

/bin/sh ../libtool --mode=compile gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale\" -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/usr/local/lib/gettext\" -DGETTEXTJAR=\"/usr/local/share/gettext/gettext.jar\" -DLIBDIR=\"/usr/local/lib\" -DGETTEXTDATADIR=\"/usr/local/share/gettext\" -DPROJECTSDIR=\"/usr/local/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I../../../gettext-tools/src -I.. -I. -I../../../gettext-tools/src -I.. -I../../../gettext-tools/libuniname -I../lib -I../../../gettext-tools/lib -I../intl -I../../../gettext-tools/../gettext-runtime/intl -g -O2 -c -o po-lex.lo ../../../gettext-tools/src/po-lex.c

actually puts the directory (.) where the generated po-gram-gen2.h exists pretty early in the include search path, but because the file is included with #include "" rather than #include <>, the directory containing the po-lex.c file is searched *before* the -I directories.

As a result, po-lex.c gets the po-gram-gen2.h (built with bison 1.35) that is part of the gettext distribution, but the po-gram-gen.c that is compiled is the one built with bison-1.875, which for whatever reason (perhaps related to the %token '[' ']' line?) starts numbering tokens at 258 instead of 257. The result, as can be imagined, is that all .po files get a syntax error.

+%token NUMBER  264
+%token STRING  265

This is horrible.

I never said it was pretty, in fact I suggested that it would be better to use the generated file (I wasn't aware that the po-gram-gen2.h file was generated).

I suppose that changing line 49 of po-lex.c to use <> instead of "" for the po-gram-gen2.h include would fix this problem, but it seems that this is a bit sensitive to peculiarities of (arguably buggy) non-gcc C compilers regarding include search paths.

Alternately, the Makefile could explicitly copy po-lex.c (if not already present) into the build directory and compile it from there, providing more assurance that it will get the locally generated po-gram-gen2.h file.

But both of those mechanisms seem vulnerable to being undone by directory rearrangements, left-over copies of files from previous versions, etc. etc. It seems far more reliable (if not as elegant) to explicitly specify the token values so that there is no possibility of getting confusion between locally built and distributed versions.

@alex
--
mailto:address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]