Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#49013 closed defect (fixed)

gstreamer1 @1.6.0 fails building in 10.6.8

Reported by: udbraumann Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: gstreamer1

Description

While upgrading gstreamer1 from 1.4.5_0 to 1.6.0_0 I ended up with this problem:

error: ‘for’ loop initial declaration used outside C99 mode

Here is where the problem has occurred:

...
:info:build libtool: compile:  /usr/bin/llvm-gcc-4.2 -arch x86_64 -DHAVE_CONFIG_H -I. -I.. -I/opt/local/include -D_GNU_SOURCE -DGST_EXPORTS -DG_LOG_DOMAIN=g_log_domain_gstreamer -DGST_API_VERSION=\"1.0\" -DGST_DISABLE_DEPRECATED -I../libs
 -I.. -I../libs -I.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -Wall -Wdeclaration-after-statement -Wpointer-arith -W
missing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-exter
ns -g -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -arch x86_64 -MT libgstreamer_1.0_la-gstprotection.lo -MD -MP -MF .deps/libgstreamer_1.0_la-gstprotection.Tpo -c gstprotection.c  -fno-common -DPIC -o .libs/libgstreamer_1.0_la-
gstprotection.o
:info:build libtool: compile:  /usr/bin/llvm-gcc-4.2 -arch x86_64 -DHAVE_CONFIG_H -I. -I.. -I/opt/local/include -D_GNU_SOURCE -DGST_EXPORTS -DG_LOG_DOMAIN=g_log_domain_gstreamer -DGST_API_VERSION=\"1.0\" -DGST_DISABLE_DEPRECATED -I../libs
 -
I.. -I../libs -I.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -Wall -Wdeclaration-after-statement -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs -g -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -arch x86_64 -MT libgstreamer_1.0_la-gstpreset.lo -MD -MP -MF .deps/libgstreamer_1.0_la-gstpreset.Tpo -c gstpreset.c  -fno-common -DPIC -o .libs/libgstreamer_1.0_la-gstpreset.o
:info:build mv -f .deps/libgstreamer_1.0_la-gstpluginloader.Tpo .deps/libgstreamer_1.0_la-gstpluginloader.Plo
:info:build gstprotection.c: In function ‘gst_protection_factory_check’:
:info:build gstprotection.c:207: error: ‘for’ loop initial declaration used outside C99 mode
:info:build gstprotection.c:217: error: ‘for’ loop initial declaration used outside C99 mode
:info:build /bin/sh ../libtool  --tag=CC   --mode=compile /usr/bin/llvm-gcc-4.2 -arch x86_64 -DHAVE_CONFIG_H -I. -I..   -I/opt/local/include -D_GNU_SOURCE -DGST_EXPORTS -DG_LOG_DOMAIN=g_log_domain_gstreamer -DGST_API_VERSION=\""1.0"\" -DGST_DISABLE_DEPRECATED  -I../libs -I.. -I../libs -I.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include  -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs  -g     -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -arch x86_64 -MT libgstreamer_1.0_la-gstregistrychunks.lo -MD -MP -MF .deps/libgstreamer_1.0_la-gstregistrychunks.Tpo -c -o libgstreamer_1.0_la-gstregistrychunks.lo `test -f 'gstregistrychunks.c' || echo './'`gstregistrychunks.c
:info:build make[4]: *** [libgstreamer_1.0_la-gstprotection.lo] Error 1
:info:build make[4]: *** Waiting for unfinished jobs....
...

Since I have Xcode 4.2 llvm-gcc-4.2 is my preset compiler, but gcc-4.2 ends up with exactly the same problem. Full log is attached.

I have briefly tested if more modern compilers like gcc5 (from MacPorts) or clang 3.0 (from Xcode 4.2) or clang-3.7 (from MacPorts) will help to circumvent the problem above, which indeed could work with the C99-style code, but instead other problems have occurred:

...
:info:build /opt/local/bin/gcc-mp-5 -m64 -DHAVE_CONFIG_H -I. -I../../..   -I/opt/local/include -I../../../libs -I../../.. -I../../../libs -I../../.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local
/include  -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT  -Wall -Wdeclaration-after-statement -Wvla -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonlitera
l -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs  -g     -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/i
nclude  -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -m64 -MT gst_ptp_helper-gst-ptp-helper.o -MD -MP -MF .deps/gst_ptp_helper-gst-ptp-helper.Tpo -c -o gst_ptp_helper-gst-ptp-helper.o `test -f 'gst-ptp-helper.c' || echo './'`gst
-ptp-helper.c
:info:build In file included from gst-ptp-helper.c:40:0:
:info:build /usr/include/net/if.h:265:19: error: field 'ifru_addr' has incomplete type
:info:build    struct sockaddr ifru_addr;
:info:build                    ^
:info:build /usr/include/net/if.h:266:19: error: field 'ifru_dstaddr' has incomplete type
:info:build    struct sockaddr ifru_dstaddr;
:info:build                    ^
:info:build /usr/include/net/if.h:267:19: error: field 'ifru_broadaddr' has incomplete type
:info:build    struct sockaddr ifru_broadaddr;
:info:build                    ^
:info:build /usr/include/net/if.h:308:18: error: field 'ifra_addr' has incomplete type
:info:build   struct sockaddr ifra_addr;
:info:build                   ^
:info:build /usr/include/net/if.h:309:18: error: field 'ifra_broadaddr' has incomplete type
:info:build   struct sockaddr ifra_broadaddr;
:info:build                   ^
:info:build /usr/include/net/if.h:310:18: error: field 'ifra_mask' has incomplete type
:info:build   struct sockaddr ifra_mask;
:info:build                   ^
:info:build /usr/include/net/if.h:393:26: error: field 'addr' has incomplete type
:info:build   struct sockaddr_storage addr;   /* in/out */
:info:build                           ^
:info:build /usr/include/net/if.h:394:26: error: field 'dstaddr' has incomplete type
:info:build   struct sockaddr_storage dstaddr; /* out */
:info:build                           ^
:info:build mv -f .deps/gst_plugin_scanner-gst-plugin-scanner.Tpo .deps/gst_plugin_scanner-gst-plugin-scanner.Po
:info:build /bin/sh ../../../libtool  --tag=CC   --mode=link /opt/local/bin/gcc-mp-5 -m64 -I../../../libs -I../../.. -I../../../libs -I../../.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/incl
ude  -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT  -Wall -Wdeclaration-after-statement -Wvla -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wf
ormat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs  -g     -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -m64  -L/opt/local/lib -Wl,-headerpad_max
_install_names -o gst-plugin-scanner gst_plugin_scanner-gst-plugin-scanner.o ../../../gst/libgstreamer-1.0.la -L/opt/local/lib -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl  -L/opt/local/lib -lintl -R/opt/local/lib -Wl,-framework -Wl,Core
Foundation  -ldl
:info:build gst-ptp-helper.c: In function 'setup_sockets':
:info:build gst-ptp-helper.c:295:2: warning: #warning "Implement something to list all network interfaces" [-Wcpp]
:info:build  #warning "Implement something to list all network interfaces"
:info:build   ^
:info:build gst-ptp-helper.c:411:2: warning: #warning "Implement something to get MAC addresses of network interfaces" [-Wcpp]
:info:build  #warning "Implement something to get MAC addresses of network interfaces"
:info:build   ^
:info:build mv -f .deps/gst_completion_helper_1.0-gst-completion-helper.Tpo .deps/gst_completion_helper_1.0-gst-completion-helper.Po
:info:build /bin/sh ../../../libtool  --tag=CC   --mode=link /opt/local/bin/gcc-mp-5 -m64 -I../../../libs -I../../.. -I../../../libs -I../../.. -D_REENTRANT -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include  -DG_THREADS_MANDATORY -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT  -Wall -Wdeclaration-after-statement -Wvla -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs  -g     -pipe -Os -funroll-loops -fstrict-aliasing -fno-common -m64  -L/opt/local/lib -Wl,-headerpad_max_install_names -o gst-completion-helper-1.0 gst_completion_helper_1.0-gst-completion-helper.o ../../../gst/libgstreamer-1.0.la -L/opt/local/lib -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl  -L/opt/local/lib -lintl -R/opt/local/lib -Wl,-framework -Wl,CoreFoundation  -ldl
:info:build make[4]: *** [gst_ptp_helper-gst-ptp-helper.o] Error 1
:info:build make[4]: *** Waiting for unfinished jobs....
...

Full log is also attached.

Any ideas?

Attachments (2)

main.log.gz (12.7 KB) - added by udbraumann 9 years ago.
obtained with llvm-gcc-4.2
main-gcc5.log.gz (23.0 KB) - added by udbraumann 9 years ago.
obtained with gcc-5

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by udbraumann

Attachment: main.log.gz added

obtained with llvm-gcc-4.2

Changed 9 years ago by udbraumann

Attachment: main-gcc5.log.gz added

obtained with gcc-5

comment:1 Changed 9 years ago by dbevans (David B. Evans)

The build errors encountered when using the newer compilers are a duplication of the issue reported in #49012 (now fixed).

comment:2 in reply to:  1 Changed 9 years ago by udbraumann

Thanks for fixing the second part of the abovementioned problems, i.e. this means that on my 10.6.8 system I could build gstreamer1 @1.6.0 using this invocation:

sudo port upgrade gstreamer1 configure.compiler=macports-gcc-5

What remains open is if the C99-style encoding of a for-loop in gstprotection.c (which means that there is no prior declaration of the control variable) is rectifying the effort to blacklist lots of compilers, or if some patch adding the definition of the respective control variable in that source code file should be easier, so that the good old gcc-4.2 or thelike would still do.

comment:3 Changed 9 years ago by dbevans (David B. Evans)

Looks like the simpler approach is to just append -std=c99 to CFLAGS when building with llvm-gcc-4.2 or gcc-4.2.

Fix committed in r140727. Let me know if this works for you.

comment:4 in reply to:  3 Changed 9 years ago by udbraumann

Thanks, have tested building on 10.5.8 with gcc-4.2, and it works, so I guess it also works on 10.6.8 with or without llvm-gcc-4.2.

comment:5 Changed 9 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: newclosed

Thanks for the test results.

comment:6 in reply to:  3 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to devans@…:

Looks like the simpler approach is to just append -std=c99 to CFLAGS when building with llvm-gcc-4.2 or gcc-4.2.

Since it requires C99, why not add -std=c99 unconditionally?

comment:7 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

Really, the developers should add -std=c99 into their build system, if they require it.

comment:8 in reply to:  3 Changed 9 years ago by udbraumann

Replying to devans@…:

Looks like the simpler approach is to just append -std=c99 to CFLAGS when building with llvm-gcc-4.2 or gcc-4.2.

Fix committed in r140727. Let me know if this works for you.

Could you please add the same C99 switch to CFLAGS for the gstreamer1-gst-plugins-base port? Similarily, I also obtain error: ‘for’ loop initial declaration used outside C99 mode. It hopefully is not necessary to draw another ticket. Thank you!

Note: See TracTickets for help on using tickets.