Bug #4634
Error in ffmpeg static when compiling the last git e16f4ec
100%
Description
I'm unable to compile the latest git build e16f5ec because of ffmpeg, I think:
CC src/transcoding/transcode/transcoder.o CC src/transcoding/transcode/video.o CC src/transcoding/codec/codec.o CC src/transcoding/codec/module.o CC src/transcoding/codec/profile_audio_class.o CC src/transcoding/codec/profile.o CC src/transcoding/codec/profile_class.o CC src/transcoding/codec/profile_video_class.o CC src/transcoding/codec/codecs/aac.o src/transcoding/codec/codecs/aac.c:135: error: unknown field ‘name’ specified in initializer cc1: warnings being treated as errors src/transcoding/codec/codecs/aac.c:135: error: missing braces around initializer src/transcoding/codec/codecs/aac.c:135: error: (near initialization for ‘tvh_codec_aac.<anonymous>’) src/transcoding/codec/codecs/aac.c:136: error: unknown field ‘size’ specified in initializer src/transcoding/codec/codecs/aac.c:136: error: initialization makes pointer from integer without a cast src/transcoding/codec/codecs/aac.c:137: error: unknown field ‘idclass’ specified in initializer src/transcoding/codec/codecs/aac.c:137: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:138: error: unknown field ‘profiles’ specified in initializer src/transcoding/codec/codecs/aac.c:138: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:139: error: unknown field ‘profile_init’ specified in initializer src/transcoding/codec/codecs/aac.c:139: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:139: error: (near initialization for ‘tvh_codec_aac’) src/transcoding/codec/codecs/aac.c:140: error: unknown field ‘profile_destroy’ specified in initializer src/transcoding/codec/codecs/aac.c:140: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:140: error: (near initialization for ‘tvh_codec_aac’) make[1]: *** [/root/tvheadend2/tvheadend/build.linux/src/transcoding/codec/codecs/aac.o] Error 1My version of gcc is:
root@debian-x64:~/tvheadend2/tvheadend# gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.5 (Debian 4.4.5-8)And the configure options were:
./configure --disable-pcre --disable-avahi --enable-bundle --disable-dbus_1 --enable-hdhomerun_client --disable-libx265 --disable-libvpxI've checked other versions and for example git 575531d (a month old) builds fine.
If there are problems with ffmpeg, what is the correct way to troubleshoot? I disabled libx265 and libvpx with the switches because of this.
History
Updated by virtual dj about 7 years ago
The problem persists with latest commit d7d83b6
I've tried to edit the ffmpeg makefile to roll back to 3.3:
# diff Makefile.ffmpeg_old Makefile.ffmpeg 97c97 < FFMPEG = ffmpeg-3.3.3 --- > FFMPEG = ffmpeg-3.3 100c100 < FFMPEG_SHA1 = 23bce5ccc4aeae23e1893d6cea7b1bd57b2591cb --- > FFMPEG_SHA1 = 2590af8c754ce8d55745b1e5647e498bf271dc77but it still doesnt't build, with the same error.
Updated by virtual dj about 7 years ago
So, I made some additional tests using a different VM with x86 architecture.
The gcc version is the same:
root@debian-x86:~/tvheadend/tvheadend# gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.5 (Debian 4.4.5-8)and the configure switches similar:
./configure --disable-pcre --disable-avahi --enable-bundle --disable-dbus_1 --disable-libx265 --enable-libffmpeg_static --disable-libvpxI tried to "make clean" and "git reset --hard" several times until I found the latest version that builds correctly, which is ebbbc3b (newer than 575531d).
Based on Makefile.ffmpeg, this version uses ffmpeg-3.3.3 so I think this is not a ffmpeg error but something that resides on the source code, so maybe the subject of this "bug" must be changed.
After ebbbc3b, the subsequent commit is 014bb95 which fails with the following error:
CC src/version.o CC src/uuid.o CC src/main.o In file included from src/main.c:71: src/transcoding/codec.h:67: error: redefinition of typedef ‘TVHCodec’ src/transcoding/codec.h:38: note: previous declaration of ‘TVHCodec’ was here src/transcoding/codec.h:96: error: redefinition of typedef ‘TVHCodecProfile’ src/transcoding/codec.h:41: note: previous declaration of ‘TVHCodecProfile’ was here make: *** [/root/tvheadend/tvheadend/build.linux/src/main.o] Error 1Then I started to compile next, next, next and this error persists until 6c45b85 (included).
Then the following aa052ac which fails with:
CC src/transcoding/codec/profile_audio_class.o CC src/transcoding/codec/profile.o CC src/transcoding/codec/profile_class.o CC src/transcoding/codec/profile_video_class.o CC src/transcoding/codec/codecs/aac.o src/transcoding/codec/codecs/aac.c:126: error: unknown field ‘name’ specified in initializer cc1: warnings being treated as errors src/transcoding/codec/codecs/aac.c:126: error: missing braces around initializer src/transcoding/codec/codecs/aac.c:126: error: (near initialization for ‘tvh_codec_aac.<anonymous>’) src/transcoding/codec/codecs/aac.c:127: error: unknown field ‘size’ specified in initializer src/transcoding/codec/codecs/aac.c:127: error: initialization makes pointer from integer without a cast src/transcoding/codec/codecs/aac.c:128: error: unknown field ‘idclass’ specified in initializer src/transcoding/codec/codecs/aac.c:128: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:129: error: unknown field ‘profiles’ specified in initializer src/transcoding/codec/codecs/aac.c:129: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:130: error: unknown field ‘profile_init’ specified in initializer src/transcoding/codec/codecs/aac.c:130: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:130: error: (near initialization for ‘tvh_codec_aac’) make: *** [/root/tvheadend/tvheadend/build.linux/src/transcoding/codec/codecs/aac.o] Error 1The exact same message (on a different line, though, i.e. 135 vs 126) appears even on the latest build 5be1a5a.
So I think that this error is present since aa052ac, maybe people with different configurations (or better, newer gcc and libraries) do not notice it; unfortunately it would be great if the code can be fixed to work with non-recent gcc, because this allows TVHeadend to run on embedded systems like QNAPs in an easier way.
I'm trying my best to troubleshoot but I need some help. ;)
Thanks!
Updated by Jaroslav Kysela about 7 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset commit:tvheadend|1e61f580495adde3836c9e0c01b8f2d714071827.
Updated by virtual dj about 7 years ago
I've updated to a37d5bc but it didn't fix, the error is still there:
CC src/transcoding/codec/module.o CC src/transcoding/codec/profile_audio_class.o CC src/transcoding/codec/profile.o CC src/transcoding/codec/profile_class.o CC src/transcoding/codec/profile_video_class.o CC src/transcoding/codec/codecs/aac.o src/transcoding/codec/codecs/aac.c:135: error: unknown field ‘name’ specified in initializer cc1: warnings being treated as errors src/transcoding/codec/codecs/aac.c:135: error: missing braces around initializer src/transcoding/codec/codecs/aac.c:135: error: (near initialization for ‘tvh_codec_aac.<anonymous>’) src/transcoding/codec/codecs/aac.c:136: error: unknown field ‘size’ specified in initializer src/transcoding/codec/codecs/aac.c:136: error: initialization makes pointer from integer without a cast src/transcoding/codec/codecs/aac.c:137: error: unknown field ‘idclass’ specified in initializer src/transcoding/codec/codecs/aac.c:137: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:138: error: unknown field ‘profiles’ specified in initializer src/transcoding/codec/codecs/aac.c:138: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:139: error: unknown field ‘profile_init’ specified in initializer src/transcoding/codec/codecs/aac.c:139: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:139: error: (near initialization for ‘tvh_codec_aac’) src/transcoding/codec/codecs/aac.c:140: error: unknown field ‘profile_destroy’ specified in initializer src/transcoding/codec/codecs/aac.c:140: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:140: error: (near initialization for ‘tvh_codec_aac’) make: *** [/root/tvheadend/tvheadend/build.linux/src/transcoding/codec/codecs/aac.o] Error 1Same error in x86_64 too.
Updated by virtual dj about 7 years ago
New update to 1873c1cf but still:
CC src/transcoding/codec/module.o CC src/transcoding/codec/profile_audio_class.o CC src/transcoding/codec/profile.o CC src/transcoding/codec/profile_class.o CC src/transcoding/codec/profile_video_class.o CC src/transcoding/codec/codecs/aac.o src/transcoding/codec/codecs/aac.c:135: error: unknown field ‘name’ specified in initializer cc1: warnings being treated as errors src/transcoding/codec/codecs/aac.c:135: error: missing braces around initializer src/transcoding/codec/codecs/aac.c:135: error: (near initialization for ‘tvh_codec_aac.<anonymous>’) src/transcoding/codec/codecs/aac.c:136: error: unknown field ‘size’ specified in initializer src/transcoding/codec/codecs/aac.c:136: error: initialization makes pointer from integer without a cast src/transcoding/codec/codecs/aac.c:137: error: unknown field ‘idclass’ specified in initializer src/transcoding/codec/codecs/aac.c:137: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:138: error: unknown field ‘profiles’ specified in initializer src/transcoding/codec/codecs/aac.c:138: error: initialization from incompatible pointer type src/transcoding/codec/codecs/aac.c:139: error: unknown field ‘profile_init’ specified in initializer src/transcoding/codec/codecs/aac.c:139: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:139: error: (near initialization for ‘tvh_codec_aac’) src/transcoding/codec/codecs/aac.c:140: error: unknown field ‘profile_destroy’ specified in initializer src/transcoding/codec/codecs/aac.c:140: error: excess elements in struct initializer src/transcoding/codec/codecs/aac.c:140: error: (near initialization for ‘tvh_codec_aac’) make: *** [/root/tvheadend/tvheadend/build.linux/src/transcoding/codec/codecs/aac.o] Error 1
@Jaroslav
Please, if you need any test let me know! I would like to help you to fix this and build TVHeadend like I did a couple of months ago.
Updated by Jaroslav Kysela about 7 years ago
gcc 4.8.2 no problem.. It appears like a bug in your specific gcc version.
Updated by g siviero about 7 years ago
Of course.
But the problem here is:
"..maybe people with different configurations (or better, newer gcc and libraries) do not notice it; unfortunately it would be great if the code can be fixed to work with non-recent gcc, because this allows TVHeadend to run on embedded systems like QNAPs in an easier way."
Updated by g siviero about 7 years ago
Could it be that older gcc compilers cannot find where the definition of TVHAudioCodec is?
Updated by virtual dj about 7 years ago
Jaroslav Kysela wrote:
gcc 4.8.2 no problem.. It appears like a bug in your specific gcc version.
Your version is newer (4.8.2 >> 4.4.5), so that's why you don't see the errors.
But ebbbc3b compiled correctly... Upgrading libraries on QNAPs is doable but very time-expensive because I'll have to ship the new glibc with all the required dependencies; I thought it was only a matter of missing declarations, as g siviero said.
Updated by Jaroslav Kysela about 7 years ago
src/transcoding/codec/codecs/aac:135: TVHAudioCodec tvh_codec_aac = { .name = "aac", // here is the reported issue (unknown 'name' field) ... }; #include "transcoding/codec/internals.h" defines: typedef struct tvh_codec_audio { TVHCodec; } TVHAudioCodec; src/transcoding/codec.h defines (included from internals.h): typedef struct tvh_codec TVHCodec; struct tvh_codec { const char *name; };
So there is no missing definition, gcc 4.8+, clang are fine..
Updated by virtual dj about 7 years ago
I've made some additional tests using the code snippet that you posted.
Situation 1 (that should work with your gcc 4.8+)¶
Consider the following 3 files:
root@debian-x86:~/test/1# cat codec.h typedef struct tvh_codec TVHCodec; struct tvh_codec { const char *name; }; root@debian-x86:~/test/1# cat internals.h #include "codec.h" typedef struct tvh_codec_audio { TVHCodec; } TVHAudioCodec; root@debian-x86:~/test/1# cat test.c #include "internals.h" void main() { TVHAudioCodec tvh_codec_aac = { .name = "aac" }; };If I try to compile this sample with my gcc-4.4.5 I get:
root@debian-x86:~/test/1# gcc test.c In file included from test.c:1: internals.h:4: warning: declaration does not declare anything test.c: In function ‘main’: test.c:4: error: unknown field ‘name’ specified in initializer test.c:4: warning: excess elements in struct initializer test.c:4: warning: (near initialization for ‘tvh_codec_aac’)As you correctly said, it's a problem of gcc which - in my opinion but I may be wrong - doesn't detect the anonymous struct TVHCodec correctly.
Situation 2 (removing the anonymous field)¶
New content of the 3 files:
root@debian-x86:~/test/2# cat codec.h typedef struct tvh_codec TVHCodec; struct tvh_codec { const char *name; }; root@debian-x86:~/test/2# cat internals.h #include "codec.h" typedef struct tvh_codec_audio { TVHCodec mycodec; } TVHAudioCodec; root@debian-x86:~/test/2# cat test.c #include "internals.h" void main() { TVHAudioCodec tvh_codec_aac = { .mycodec.name = "aac" }; };
Basically I added "mycodec" name to the inner struct and this seems to compile using my gcc without any warning:
root@debian-x86:~/test/2# gcc test.c root@debian-x86:~/test/2#
So, are the two versions doing the same "work"? Because it if they do, then naming the anonymous field allow to build the sources using even older gcc.
Updated by Jaroslav Kysela about 7 years ago
The project use a lot of anonymous structures to inherit the members (fields) - look to the mpegts_service structure for example. I just don't see the reason, why it does not work for this specific case. Perhaphs, you can try to replace 'TVHCodec;' with 'struct tvh_audio_codec;'.
Updated by Em Smith about 7 years ago
My understanding is that it's not legal C, but a gcc extension.
Have you tried compiling with
-fms-extensions
For me, that compiles your example in 12. I don't know if it will compile the proper code though.
You'd then run the compile using something similar to:
CFLAGS="-std=gnu90 -fms-extensions" ./Autobuild.sh -t precise-amd64
Section 5.28:
[[http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1490.pdf]]
and
[[https://gcc.gnu.org/ml/gcc-patches/2011-03/msg01151.html]]
Updated by virtual dj about 7 years ago
Jaroslav Kysela wrote:
Perhaphs, you can try to replace 'TVHCodec;' with 'struct tvh_audio_codec;'.
Nope, it doesn't compile by replacing that way.
The version that actually compiles must have a name on the TVHCodec field, i.e. this branch compiles correctly:
https://github.com/tvheadend/tvheadend/compare/master...virtualdj:anonymousfields-rename-c
These are the minimum modifications to build with my switches (if you look there are other codecs which need the modification, but as they're not included in my configuration they are actually skipped).
The project use a lot of anonymous structures to inherit the members (fields) - look to the mpegts_service structure for example. I just don't see the reason, why it does not work for this specific case.
Yes, you're right and I still doesn't undestand while only TVHCodec anonymous field "offends" my gcc.
Is this the bug of gcc you're referring to?
Em Smith wrote:
My understanding is that it's not legal C, but a gcc extension.
Have you tried compiling with
-fms-extensions
I do not use Autobuild.sh, but configure and make. So I think I should add those switches to the configure script in this manner:
./configure --disable-pcre --disable-avahi --enable-bundle --disable-dbus_1 --disable-libx265 --enable-libffmpeg_static --disable-libvpx --cflags="-std=gnu90 -fms-extensions"... but, unfortunately, it does not make any difference (same error of post 6).
Updated by virtual dj about 7 years ago
I've updated my VMs (and thus gcc) and the code builds correctly.
So you may close this bug with the WontFix tag... does it exist here? Google has it for sure!