[GRASS-dev] Error compiling develbranch_6

As of r39206 the following error appears causing lib/gis to fail to compile:

/src/dev_6/lib/gis
$ make
gcc -I/src/dev_6/dist.i686-pc-mingw32/include
-I/OSGeo4W/apps/gdal-16/include -I/OSGeo4W/include -g -O2
-I/OSGeo4W/apps/gdal-16/include -I/OSGeo4W/include
-DPACKAGE=\""grasslibs"\" -D_FILE_OFFSET_BITS=64 -DGDAL_LINK=1
-DGDAL_DYNAMIC=1 -DPACKAGE=\""grasslibs"\" -I/c/OSGeo4W/include
-I/c/OSGeo4W/include -I/src/dev_6/dist.i686-pc-mingw32/include -o
OBJ.i686-pc-mingw32/parser.o -c parser.c
parser.c:75:26: localcharset.h: No such file or directory
parser.c: In function `G_usage_xml':
parser.c:1287: warning: assignment makes pointer from integer without a cast
make: *** [OBJ.i686-pc-mingw32/parser.o] Error 1

-Colin

Colin Nielsen wrote:

As of r39206 the following error appears causing lib/gis to fail to compile:

/src/dev_6/lib/gis
$ make
gcc -I/src/dev_6/dist.i686-pc-mingw32/include
-I/OSGeo4W/apps/gdal-16/include -I/OSGeo4W/include -g -O2
-I/OSGeo4W/apps/gdal-16/include -I/OSGeo4W/include
-DPACKAGE=\""grasslibs"\" -D_FILE_OFFSET_BITS=64 -DGDAL_LINK=1
-DGDAL_DYNAMIC=1 -DPACKAGE=\""grasslibs"\" -I/c/OSGeo4W/include
-I/c/OSGeo4W/include -I/src/dev_6/dist.i686-pc-mingw32/include -o
OBJ.i686-pc-mingw32/parser.o -c parser.c
parser.c:75:26: localcharset.h: No such file or directory
parser.c: In function `G_usage_xml':
parser.c:1287: warning: assignment makes pointer from integer without a cast
make: *** [OBJ.i686-pc-mingw32/parser.o] Error 1

It should be part of gettext.

The other NLS code is all conditionalised upon:

  #if defined(HAVE_LIBINTL_H) && defined(USE_NLS)

So if you use --with-nls but don't have libintl.h in the standard
include path (i.e. built-in directories plus --with-includes=
directories), configure will accept the option but GRASS will be built
without NLS.

The configure checks for --with-nls only test for the existence of the
gettext() function. The check for libintl.h is unconditional, and
doesn't complain if it isn't found.

There are 3 main options here:

1. Modify lib/gis/parser.c to check for HAVE_LIBINTL_H.

2. Modify configure.in to check for localcharset.h, and modify
lib/gis/parser.c to check for HAVE_LOCALCHARSET_H.

3. Modify configure.in to fail if --with-nls is used but libintl.h
isn't found.

Option #3 is probably preferable, as it prevents the situation where
you use --with-nls but (silently) get a build which lacks NLS.

For the time being, you can just omit the --with-nls switch.

The one thing which I find confusing is that the configure check for
gettext() appears to have passed (if you use --with-nls, you get an
error if the check fails, and if you didn't use --with-nls, USE_NLS
wouldn't be defined).

--
Glynn Clements <glynn@gclements.plus.com>

It should be part of gettext.

So if you use --with-nls but don't have libintl.h in the standard
include path (i.e. built-in directories plus --with-includes=
directories), configure will accept the option but GRASS will be built
without NLS.

I have gettext installed and libintl.h is in the standard include
path. That path is passed to the grass configure with (with the
variable defined):

--with-includes="$OSGEO4W_ROOT_MSYS/apps/gdal-16/include
$OSGEO4W_ROOT_MSYS/include" \

I found localcharset.h not in the gettext package that I had, but in
the iconv-lib package. OSGeo4W has an iconv-bin package so I didn't
think I needed this extra one, but it seems that the additional lib
package with localcharset.h isn't included. With it installed,
compiling now works fine.

-Colin