Opened 11 years ago

Closed 11 years ago

#3569 closed defect (invalid)

"initializer element is not constant" compiling bug in libavdevice/avfoundation.m

Reported by: xnohat Owned by:
Priority: normal Component: avdevice
Version: git-master Keywords: osx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Error when compiling avfoundation.m in Mac OS Maverick, gcc 4.2:

libavdevice/avfoundation.m:43: error: initializer element is not constant
libavdevice/avfoundation.m:43: error: (near initialization for ‘avf_time_base_q.den’)
libavdevice/avfoundation.m: In function ‘avf_read_header’:

Bug in

static const int avf_time_base = 100;

static const AVRational avf_time_base_q = {
    .num = 1,
    .den = avf_time_base # <--- bug here
};

it should be patch with:

.den = 100

Change History (8)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: osx added

Please provide your configure line, run make V=1 twice and provide the complete console output of the second run.

comment:2 by xnohat, 11 years ago

I running compile process again

Last edited 11 years ago by xnohat (previous) (diff)

comment:3 by xnohat, 11 years ago

hi ceboyos,

This is output you need

$ ./configure  --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-indev=avfoundation

$ make V=1 #first
 make V=1
touch .version
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -mllvm -stack-alignment=16  -MMD -MF libavdevice/alldevices.d -MT libavdevice/alldevices.o -c -o libavdevice/alldevices.o libavdevice/alldevices.c
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -mllvm -stack-alignment=16  -MMD -MF libavdevice/avdevice.d -MT libavdevice/avdevice.o -c -o libavdevice/avdevice.o libavdevice/avdevice.c
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -mllvm -stack-alignment=16  -MMD -MF libavdevice/avfoundation.d -MT libavdevice/avfoundation.o -c -o libavdevice/avfoundation.o libavdevice/avfoundation.m
libavdevice/avfoundation.m:43: error: initializer element is not constant
libavdevice/avfoundation.m:43: error: (near initialization for ‘avf_time_base_q.den’)
libavdevice/avfoundation.m: In function ‘avf_read_header’:
libavdevice/avfoundation.m:152: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:162: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:207: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:213: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:244: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:253: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:273: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:281: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m: In function ‘avf_read_packet’:
libavdevice/avfoundation.m:310: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:325: warning: ISO C90 forbids mixed declarations and code

$ make V=1 #second
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/fribidi -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -mllvm -stack-alignment=16  -MMD -MF libavdevice/avfoundation.d -MT libavdevice/avfoundation.o -c -o libavdevice/avfoundation.o libavdevice/avfoundation.m
libavdevice/avfoundation.m:43: error: initializer element is not constant
libavdevice/avfoundation.m:43: error: (near initialization for ‘avf_time_base_q.den’)
libavdevice/avfoundation.m: In function ‘avf_read_header’:
libavdevice/avfoundation.m:152: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:162: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:207: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:213: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:244: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:253: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:273: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:281: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m: In function ‘avf_read_packet’:
libavdevice/avfoundation.m:310: warning: ISO C90 forbids mixed declarations and code
libavdevice/avfoundation.m:325: warning: ISO C90 forbids mixed declarations and code
make: *** [libavdevice/avfoundation.o] Error 1
Version 2, edited 11 years ago by xnohat (previous) (next) (diff)

in reply to:  3 ; comment:4 by Carl Eugen Hoyos, 11 years ago

Replying to xnohat:

$ ./configure  --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-indev=avfoundation

I don't understand: Didn't you report in ticket #3570 that this configure line does not enable the avfoundation device? How can compilation fail if the device is not enabled?

comment:5 by Michael Niedermayer, 11 years ago

what do you mean by "gcc 4.2" ? whats the full output of that compiler with --version ?

also does the whole build succeed when you change that one line or does it just fail later ?

in reply to:  4 ; comment:6 by xnohat, 11 years ago

Replying to cehoyos:

Replying to xnohat:

$ ./configure  --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-indev=avfoundation

I don't understand: Didn't you report in ticket #3570 that this configure line does not enable the avfoundation device? How can compilation fail if the device is not enabled?

Yes, I also need patched ./configure to enable avfoundation device, then I compile it, I got these errors (above)

in reply to:  5 comment:7 by xnohat, 11 years ago

Replying to michael:

what do you mean by "gcc 4.2" ? whats the full output of that compiler with --version ?

also does the whole build succeed when you change that one line or does it just fail later ?

This is full output:

gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

After I change that one line, build successful and ffmpeg binary compiled can working properly on Mac OS with avfoundation input dev enabled

Last edited 11 years ago by xnohat (previous) (diff)

in reply to:  6 comment:8 by Carl Eugen Hoyos, 11 years ago

Priority: importantnormal
Resolution: invalid
Status: newclosed

Replying to xnohat:

Replying to cehoyos:

I don't understand: Didn't you report in ticket #3570 that this configure line does not enable the avfoundation device? How can compilation fail if the device is not enabled?

Yes, I also need patched ./configure to enable avfoundation device

Making this ticket invalid.
If you have a patch fixing ticket #3570 (and this one), please send it - made with git format-patch - to the ffmpeg-devel mailing list where it can be reviewed.

Note: See TracTickets for help on using tickets.