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

Re: [MiNT] libio compile error



On Mon, Jul 03, 2000 at 08:46:06AM +0000, Mandin Patrice wrote:
> > p.s. I'm still trying to set up the gcc 
> cross-compiler...
> > it *does* build the actual xgcc binary, but then dies 
> when 
> > trying to reconfigure itself to build `libio'... I'll 
> keep
> > trying though
> 
> I had this problem too.
> After the 'configure' step for target m68k-atari-mint, 
> edit
> the file 'm68k-atari-mint/libio/Makefile'.
> You must modify the line 'CFLAGS= something' by adding 
> '-D_GNU_SOURCE'.

Changing the CFLAGS after configure ran may be dangerous.  I would prefer
to run configure like this:

	DEFS="-D_GNU_SOURCE -DWHATEVER_ELSE_YOU_LIKE" ./configure ...

The configure scripts normally preserves certain Makefile variables found 
in the environment, notably CFLAGS, LDFLAGS, DEFS, LIBS, and so on.  It
just adds them to the values it finds out itself.

Why not edit the Makefile directly? Imagine, configure would check whether
/usr/include/time.h declares the array "tzname".  If the test is compiled
without "-D_GNU_SOURCE" or "-D_POSIX_SOURCE" the declaration is not
visible (because in /usr/include/time.h, it is embedded into "#ifdef
__USE_POSIX").  It is possible that the sources contain something like

	#ifndef HAVE_TZNAME
	char* tzname;

	...
	fill_tzname_array ();
	...
	#endif

If you later add -D_GNU_SOURCE to DEFS or CFLAGS, this prototype will
conflict with the one from /usr/include/time.h which is now visible.

Not very likely but if it arises, the error may be hard to find.

Ciao

Guido

P.S.: You have to look carefully which options you really set when
manipulating CFLAGS or DEFS.  It may be the options for the host compiler,
the build compiler or the target compiler.  Watch out and double check.
-- 
http://www.stud.uni-saarland.de/
Send your spam to president@whitehouse.gov and your replies to
mailto:guido at freemint dot de