Opened 3 years ago

Closed 3 years ago

#63231 closed defect (fixed)

mpg123 @1.28.0: /audio.c:352: error: ‘for’ loop initial declaration used outside C99 mode

Reported by: kencu (Ken) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: tiger leopard snowleopard Cc: evanmiller (Evan Miller)
Port: mpg123

Description

On older systems that default to gcc-4.2, this port fails:

:info:build Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_mpg123/mpg123/work/mpg123-1.28.0" && /usr/bin/make -j8 -w all 
:debug:build system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_mpg123/mpg123/work/mpg123-1.28.0" && /usr/bin/make -j8 -w all 
:info:build make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_audio_mpg123/mpg123/work/mpg123-1.28.0'
:info:build depbase=`echo src/audio.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/audio.o -MD -MP -MF $depbase.Tpo -c -o src/audio.o src/audio.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/common.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/common.o -MD -MP -MF $depbase.Tpo -c -o src/common.o src/common.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/sysutil.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/sysutil.o -MD -MP -MF $depbase.Tpo -c -o src/sysutil.o src/sysutil.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/control_generic.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/control_generic.o -MD -MP -MF $depbase.Tpo -c -o src/control_generic.o src/control_generic.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/equalizer.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/equalizer.o -MD -MP -MF $depbase.Tpo -c -o src/equalizer.o src/equalizer.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/getlopt.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/getlopt.o -MD -MP -MF $depbase.Tpo -c -o src/getlopt.o src/getlopt.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/httpget.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/httpget.o -MD -MP -MF $depbase.Tpo -c -o src/httpget.o src/httpget.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build depbase=`echo src/resolver.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
:info:build 	/usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I./src  -DPKGLIBDIR="\"/opt/local/lib/mpg123\""  -I./src -I./src/compat -I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123 -I./src/libout123 -DOPT_I586 -DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -I/opt/local/include  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math  -pipe -Os -arch i386 -MT src/resolver.o -MD -MP -MF $depbase.Tpo -c -o src/resolver.o src/resolver.c &&\
:info:build 	mv -f $depbase.Tpo $depbase.Po
:info:build src/audio.c: In function ‘match_enc’:
:info:build src/audio.c:352: error: ‘for’ loop initial declaration used outside C99 mode
:info:build src/audio.c: In function ‘audio_capabilities’:
:info:build src/audio.c:478: error: ‘for’ loop initial declaration used outside C99 mode

setting the c standard in the Portfile with

configure.cflags-append -std=c99

fixes the build

Attachments (1)

mpg123-fail-gcc42-leopard-Intel.log (31.8 KB) - added by kencu (Ken) 3 years ago.

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by kencu (Ken)

comment:1 Changed 3 years ago by jmroot (Joshua Root)

According to https://www.mpg123.de/hacking.shtml the code is supposed to be C89. But the committed fix for this issue, which will be in 1.28.1, is to enable C99 mode in the configure script: https://github.com/madebr/mpg123/commit/fbbf27ae6d45d591af6fd72cdade8a43694d4661

comment:2 Changed 3 years ago by kencu (Ken)

what do you make of the message in the commit there that dnl For autocinf 2.69, the C99 macro still does something.?

MacPorts is using autoconf 2.71, so if the macro does nothing in 2.71, perhaps we still need to add the flag ourselves?

Have to try it I guess. But I have a suspicion their commit won't fix us.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

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

According to https://savannah.gnu.org/support/?110425 autoconf 2.70 had a bug where it did not add the -std=gnu99 flag when needed but it was fixed in autoconf 2.71. I'm not sure if AC_PROG_CC_C99 (as in the above mpg123 commit) or something else needs to be added to cause that to happen. It's also fine if we add the flag ourselves in the portfile.

comment:4 Changed 3 years ago by kencu (Ken)

good find. indeed, looks fixed in autoconf.

comment:5 Changed 3 years ago by evanmiller (Evan Miller)

Cc: evanmiller added

comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Resolution: fixed
Status: newclosed

In a47918826b653b69a772e817f43868dd7e276a70/macports-ports (master):

mpg123: Update to 1.28.2

Closes: #63231

Remove libtool dependency which seems no longer to be used, at least on
current macOS systems.

Switch i386 CPU optimizations from i586 to sse now that the upstream
bug with text relocations is fixed (since several years already).

Remove Portfile code duplication regarding CPU optimization flags.

Note: See TracTickets for help on using tickets.