[GRASS-dev] Re: [Ffmpeg-devel] Problems with preC99 compilers

For the record, here a followup...

m.

On Thu, Oct 05, 2006 at 02:11:05AM +0300, Uoti Urpala wrote:

On Fri, 2006-09-29 at 12:37 +0300, M??ris Narti??s wrote:
> I was compiling recent GRASS GIS version but it failed on ffmpeg includes due
> to one line comments. One line comments (//) where introduced in C99, thus
> preC99 compilers do not understand them.

All widely used compilers from the past several years understand them.
Even the obsolete gcc versions from before any real C99 support
understood them.

> gcc version 4.1.2 20060920 (prerelease)

Supports not only // but most of the more complex features of C99 too.

> Error message:
> gcc -I/home/maris/soft/grass-6.2.0RC1/dist.i686-pc-linux-gnu/include -g -ansi -Wall

The -ansi switch explicitly sets the standard back to C89 and disables
support for any features of current C and GNU extensions that were not
present in C89. Remove that switch and it'll compile.

Markus Neteler wrote:

For the record, here a followup...

... which completely misses the point.

> > I was compiling recent GRASS GIS version but it failed on ffmpeg includes due
> > to one line comments. One line comments (//) where introduced in C99, thus
> > preC99 compilers do not understand them.
>
> All widely used compilers from the past several years understand them.
> Even the obsolete gcc versions from before any real C99 support
> understood them.
>
> > gcc version 4.1.2 20060920 (prerelease)
>
> Supports not only // but most of the more complex features of C99 too.
>
> > Error message:
> > gcc -I/home/maris/soft/grass-6.2.0RC1/dist.i686-pc-linux-gnu/include -g -ansi -Wall
>
> The -ansi switch explicitly sets the standard back to C89 and disables
> support for any features of current C and GNU extensions that were not
> present in C89. Remove that switch and it'll compile.

Shorter version: "we aren't going to fix it".

It isn't really a problem; ffmpeg itself won't compile on a system
which only supports C89. But as Maris suggests, we might want to
document this issue somewhere.

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

> > I was compiling recent GRASS GIS version but it failed on ffmpeg
> > includes due to one line comments. One line comments (//) where
> > introduced in C99, thus preC99 compilers do not understand them.
>
> All widely used compilers from the past several years understand
> them. Even the obsolete gcc versions from before any real C99
> support understood them.
>
> > gcc version 4.1.2 20060920 (prerelease)
>
> Supports not only // but most of the more complex features of C99
> too.
>
> > Error message:
> > gcc
> > -I/home/maris/soft/grass-6.2.0RC1/dist.i686-pc-linux-gnu/include
> > -g -ansi -Wall
>
> The -ansi switch explicitly sets the standard back to C89 and
> disables support for any features of current C and GNU extensions
> that were not present in C89. Remove that switch and it'll compile.

The current state:

grass63$ grep -rI '^//' * | grep -v terraflow

swig/python/python_grass6.i://File : python_grass6.i
swig/python/my_typemaps.i:// G_free_list($1);
vector/v.edit/del.c:// Vect_delete_line(Map, id);
vector/v.edit/del.c:// Vect_delete_line(Map, area);
vector/v.edit/del.c:// Vect_delete_line(Map, id);
vector/v.edit/cat.c:// G_message(_("Reading vector: "));
vector/v.edit/cat.c:// G_percent(line, nlines, 1);
vector/v.edit/add.c:// ret = Vect_get_point_in_poly(line, &xc, &yc);
vector/v.edit/main.c://static int error_routine(const char*msg, int fatal);
vector/v.edit/main.c:// G_set_error_routine(error_routine);
vector/v.edit/main.c:// Vect_set_open_level(2);
vector/v.edit/main.c:// Vect_set_category_index_update ( &Map );
vector/v.edit/main.c:// G_unset_error_routine();
vector/v.drape/spearfish.pov://background { color SkyBlue }

(v.edit isn't built by default)

However, currently ffmpeg build is broken on Debian/stable if using
libavcodeccvs from Christian Marillat's unofficial packages.

me:

nviz: relocation error: /usr/lib/libavcodec.so.0: undefined symbol:
faacDecOpen

Christian:

you also need to backport the latest faac and faad packages.

It's fine if using the official libavcodec-dev packages. (?)

Hamish

Hamish wrote:

> > > I was compiling recent GRASS GIS version but it failed on ffmpeg
> > > includes due to one line comments. One line comments (//) where
> > > introduced in C99, thus preC99 compilers do not understand them.
> >
> > All widely used compilers from the past several years understand
> > them. Even the obsolete gcc versions from before any real C99
> > support understood them.
> >
> > > gcc version 4.1.2 20060920 (prerelease)
> >
> > Supports not only // but most of the more complex features of C99
> > too.
> >
> > > Error message:
> > > gcc
> > > -I/home/maris/soft/grass-6.2.0RC1/dist.i686-pc-linux-gnu/include
> > > -g -ansi -Wall
> >
> > The -ansi switch explicitly sets the standard back to C89 and
> > disables support for any features of current C and GNU extensions
> > that were not present in C89. Remove that switch and it'll compile.

The current state:

grass63$ grep -rI '^//' * | grep -v terraflow

swig/python/python_grass6.i://File : python_grass6.i
swig/python/my_typemaps.i:// G_free_list($1);
vector/v.edit/del.c:// Vect_delete_line(Map, id);
vector/v.edit/del.c:// Vect_delete_line(Map, area);
vector/v.edit/del.c:// Vect_delete_line(Map, id);
vector/v.edit/cat.c:// G_message(_("Reading vector: "));
vector/v.edit/cat.c:// G_percent(line, nlines, 1);
vector/v.edit/add.c:// ret = Vect_get_point_in_poly(line, &xc, &yc);
vector/v.edit/main.c://static int error_routine(const char*msg, int fatal);
vector/v.edit/main.c:// G_set_error_routine(error_routine);
vector/v.edit/main.c:// Vect_set_open_level(2);
vector/v.edit/main.c:// Vect_set_category_index_update ( &Map );
vector/v.edit/main.c:// G_unset_error_routine();
vector/v.drape/spearfish.pov://background { color SkyBlue }

IOW, it's just v.edit; the others aren't C files.

(v.edit isn't built by default)

That would probably explain why no-one has noticed it before; people
do occasionally build with -ansi.

Fixed in CVS.

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