[GRASS-dev] lib/pngdriver Mingw compile error

Glynn Clements glynn at gclements.plus.com
Mon Oct 30 22:14:52 EST 2006

Paul Kelly wrote:

> I've just been experimenting with compiling GRASS under Mingw32 on 
> Windows. Half my time's been spent ripping out Mingw-specific hacks in the 
> Makefiles and configure scripts as they make it impossible to see what's 
> really going on. Anyway it seems to be compiling and running for the most 
> part OK (well as well as can be expected) using shared dlls for the GRASS 
> internal libraries, but am having the following problem with lib/pngdriver 
> (compiler output reproduced below). I might be able to get to the bottom 
> of it but thought perhaps there might be a chance of resolving it much 
> more quickly if posting to the list? A few people have done MinGW compiles 
> now. I'm using libpng 1.2.12.

> OBJ.i686-pc-mingw32/Color_table.o(.text+0x20f): In function `init_color_table': c:/grass/grass6/lib/pngdriver/Color_table.c:77: variable 'standard_colors_rgb' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
> OBJ.i686-pc-mingw32/Color_table.o(.text+0x223):c:/grass/grass6/lib/pngdriver/Color_table.c:77: variable 'standard_colors_rgb' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.

According to the Info file, you need to do something like:

void init_color_table(void)
	volatile const struct color_rgb *std_rgb = standard_colors_rgb;
	int colorindex;

	if (true_color)

	/* Generate lookup for "standard" colors */
	for (colorindex = 1; colorindex <= MAX_COLOR_NUM; colorindex++)
				(int) std_rgb[colorindex].r,
				(int) std_rgb[colorindex].g,
				(int) std_rgb[colorindex].b)) ;

The alternative is to add a function to libgis, e.g.:

const struct color_rgb *get_standard_color_rgb(int index)
	return &standard_colors_rgb[index];

and use that instead of accessing the array directly.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list