#66904 closed defect (fixed)

cairo @1.17.6 fails to build with gcc-4.2: cairo-svg-surface.c: error: ‘for’ loop initial declaration used outside C99 mode

Reported by: barracuda156 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: tiger leopard Cc:
Port: cairo

Description

libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I. -D_REENTRANT -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -isystem/opt/local/include/LegacySupport -I/opt/local/include -pipe -Os -arch ppc -MT cairo-svg-surface.lo -MD -MP -MF .deps/cairo-svg-surface.Tpo -c cairo-svg-surface.c  -fno-common -DPIC -o .libs/cairo-svg-surface.o
cairo-svg-surface.c: In function ‘_cairo_svg_stream_copy’:
cairo-svg-surface.c:303: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_stream_copy_to_output_stream’:
cairo-svg-surface.c:335: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_stream_destroy’:
cairo-svg-surface.c:385: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_paint_compute’:
cairo-svg-surface.c:863: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_surface_clipper_intersect_clip_path’:
cairo-svg-surface.c:994: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_surface_reset_clip’:
cairo-svg-surface.c:1033: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_surface_emit_transform’:
cairo-svg-surface.c:1217: warning: function might be possible candidate for ‘printf’ format attribute
cairo-svg-surface.c: In function ‘_cairo_svg_surface_finish’:
cairo-svg-surface.c:1658: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_surface_emit_pattern_stops’:
cairo-svg-surface.c:2582: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c:2608: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c:2624: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c:2667: error: redefinition of ‘i’
cairo-svg-surface.c:2624: error: previous definition of ‘i’ was here
cairo-svg-surface.c:2667: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c:2678: error: redefinition of ‘i’
cairo-svg-surface.c:2667: error: previous definition of ‘i’ was here
cairo-svg-surface.c:2678: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_surface_show_glyphs_impl’:
cairo-svg-surface.c:4032: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_document_create’:
cairo-svg-surface.c:4209: error: ‘for’ loop initial declaration used outside C99 mode
cairo-svg-surface.c: In function ‘_cairo_svg_document_finish’:
cairo-svg-surface.c:4365: error: ‘for’ loop initial declaration used outside C99 mode
make[3]: *** [cairo-svg-surface.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I. -D_REENTRANT -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -isystem/opt/local/include/LegacySupport -I/opt/local/include -pipe -Os -arch ppc -MT cairo-tee-surface.lo -MD -MP -MF .deps/cairo-tee-surface.Tpo -c cairo-tee-surface.c -o cairo-tee-surface.o >/dev/null 2>&1
libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I. -D_REENTRANT -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -isystem/opt/local/include/LegacySupport -I/opt/local/include -pipe -Os -arch ppc -MT cairo-xml-surface.lo -MD -MP -MF .deps/cairo-xml-surface.Tpo -c cairo-xml-surface.c  -fno-common -DPIC -o .libs/cairo-xml-surface.o
cairo-xml-surface.c: In function ‘_cairo_xml_emit_pattern’:
cairo-xml-surface.c:723: warning: enumeration value ‘CAIRO_PATTERN_TYPE_MESH’ not handled in switch
cairo-xml-surface.c:723: warning: enumeration value ‘CAIRO_PATTERN_TYPE_RASTER_SOURCE’ not handled in switch
cairo-pdf-surface.c: In function ‘_cairo_pdf_surface_finish’:
cairo-pdf-surface.c:2468: warning: ‘status’ may be used uninitialized in this function
libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I. -D_REENTRANT -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -isystem/opt/local/include/LegacySupport -I/opt/local/include -pipe -Os -arch ppc -MT cairo-pdf-surface.lo -MD -MP -MF .deps/cairo-pdf-surface.Tpo -c cairo-pdf-surface.c -o cairo-pdf-surface.o >/dev/null 2>&1
libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I. -D_REENTRANT -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include/libpng16 -Wall -Wextra -Wmissing-declarations -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline -fno-strict-aliasing -fno-common -Wp,-D_FORTIFY_SOURCE=2 -isystem/opt/local/include/LegacySupport -I/opt/local/include -pipe -Os -arch ppc -MT cairo-xml-surface.lo -MD -MP -MF .deps/cairo-xml-surface.Tpo -c cairo-xml-surface.c -o cairo-xml-surface.o >/dev/null 2>&1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_cairo/cairo/work/cairo-1.17.6/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_cairo/cairo/work/cairo-1.17.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_cairo/cairo/work/cairo-1.17.6'
make: *** [all] Error 2

Change History (11)

comment:1 Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)

Please report it to the developers of cairo; it is not specific to MacPorts.

comment:2 Changed 21 months ago by kencu (Ken)

Keywords: tiger leopard added

comment:3 Changed 21 months ago by kencu (Ken)

In b782c1d1876b8a500172f67a1a2e104f84b982a3/macports-ports (master):

cairo: blacklist older gcc versions

pending a possible upstream fix at some point
see: #66904

comment:4 in reply to:  3 Changed 21 months ago by barracuda156

Replying to kencu:

In b782c1d1876b8a500172f67a1a2e104f84b982a3/macports-ports (master):

cairo: blacklist older gcc versions

pending a possible upstream fix at some point
see: #66904

Thank you!

comment:5 Changed 21 months ago by jlinnosa (Jaakko Linnosaari)

This worked for me:

platform darwin 9 powerpc {
    # gcc-4 on OS X 10.5 defaults to gnu89 which is "ISO C90 plus GNU extensions". We need gnu99.
    configure.cflags-append  -std=gnu99
}

comment:6 in reply to:  5 ; Changed 21 months ago by barracuda156

Replying to jlinnosa:

This worked for me:

platform darwin 9 powerpc {
    # gcc-4 on OS X 10.5 defaults to gnu89 which is "ISO C90 plus GNU extensions". We need gnu99.
    configure.cflags-append  -std=gnu99
}

It should be for Tiger and Snow Leopard too.

comment:7 Changed 21 months ago by kencu (Ken)

However, if it is upstream's intention to have the software confirm to the c99 standard, they should use and require it all the time, on all systems, and with all compilers.

Nothing to do with Tiger, Leopard, Snow Leopard, or PowerPC.

If the cairo project wants to adhere to a certain C standard, however, it not visible after 10 minutes perusing their documentation or source code.

https://cgit.freedesktop.org/cairo/tree/

comment:8 in reply to:  6 ; Changed 21 months ago by jlinnosa (Jaakko Linnosaari)

Replying to barracuda156:

Replying to jlinnosa:

This worked for me:

platform darwin 9 powerpc {
    # gcc-4 on OS X 10.5 defaults to gnu89 which is "ISO C90 plus GNU extensions". We need gnu99.
    configure.cflags-append  -std=gnu99
}

It should be for Tiger and Snow Leopard too.

I can only test on my trusty old G4. Maybe just use platform darwin powerpc for now?

comment:9 in reply to:  8 ; Changed 21 months ago by barracuda156

Replying to jlinnosa:

Replying to barracuda156:

Replying to jlinnosa:

This worked for me:

platform darwin 9 powerpc {
    # gcc-4 on OS X 10.5 defaults to gnu89 which is "ISO C90 plus GNU extensions". We need gnu99.
    configure.cflags-append  -std=gnu99
}

It should be for Tiger and Snow Leopard too.

I can only test on my trusty old G4. Maybe just use platform darwin powerpc for now?

I would assume gcc-4.2 on Intel will also need the same. Therefore, IMO:

if {[string match *gcc-4.* ${configure.compiler}]} {

}

comment:10 in reply to:  9 Changed 21 months ago by jlinnosa (Jaakko Linnosaari)

Replying to barracuda156:

Replying to jlinnosa:

I can only test on my trusty old G4. Maybe just use platform darwin powerpc for now?

I would assume gcc-4.2 on Intel will also need the same. Therefore, IMO:

if {[string match *gcc-4.* ${configure.compiler}]} {

}

That looks good. I'll revise my pull request.

comment:11 Changed 21 months ago by jlinnosa (Jaakko Linnosaari)

Resolution: fixed
Status: assignedclosed

In 9e4bb5da82a15a7c33969b2cddf92289a3d13ad6/macports-ports (master):

cairo, cairo-devel: use -std=gnu99 with gcc 4.2

Closes: #66904

Note: See TracTickets for help on using tickets.