#159 minidlna.c fails compile with ffmpeg v1.0

open-fixed
None
5
2012-11-05
2012-10-14
Lew
No

ffmpeg-1.0, minidlna-1.0.25

FFMpeg v1.0 creates several new */include/ directories. In */include/libavutil, there is a "time.h" header. With the -I include directives for the GCC compile in the Makefile, the compiler will search the specified -I directories when it encounters #include <time.h>. This in turn causes the libavutil/time.h header to be used, causing compile errors when the compiler encounters the <sys/stat.h> include.

Error manifests itself as
Compiling minidlna.c
In file included from /usr/include/sys/stat.h:107,
from /usr/include/fcntl.h:38,
from minidlna.c:58:
/usr/include/bits/stat.h:70: error: field 'st_atim' has incomplete type
/usr/include/bits/stat.h:71: error: field 'st_mtim' has incomplete type
/usr/include/bits/stat.h:72: error: field 'st_ctim' has incomplete type
/usr/include/bits/stat.h:116: error: field 'st_atim' has incomplete type
/usr/include/bits/stat.h:117: error: field 'st_mtim' has incomplete type
/usr/include/bits/stat.h:118: error: field 'st_ctim' has incomplete type

Removing */include/libavutil from the Makefile results in
~/Code/minidlna-1.0.25 $ make
Compiling upnpdescgen.c
Compiling upnpsoap.c
Compiling upnpreplyparse.c
Compiling minixml.c
Compiling getifaddr.c
Compiling daemonize.c
Compiling upnpglobalvars.c
Compiling options.c
Compiling minissdp.c
Compiling uuid.c
Compiling upnpevents.c
Compiling sql.c
Compiling utils.c
Compiling metadata.c
metadata.c:33:20: error: avutil.h: No such file or directory

While I realize that the offending header file comes from FFMPEG, and is beyond your control (hopefully, FFMPEG is careful in their compile setup), the minidlna Makefile is the thing that encounters this problem.

Contents of the include/av* directories:
include/libavcodec:
avcodec.h avfft.h dxva2.h old_codec_ids.h vaapi.h vda.h vdpau.h version.h xvmc.h

include/libavdevice:
avdevice.h version.h

include/libavfilter:
asrc_abuffer.h avcodec.h avfilter.h avfiltergraph.h buffersink.h buffersrc.h version.h

include/libavformat:
avformat.h avio.h version.h

include/libavutil:
adler32.h audioconvert.h avutil.h bswap.h dict.h file.h intreadwrite.h mathematics.h parseutils.h rational.h timecode.h
aes.h avassert.h base64.h common.h error.h imgutils.h lfg.h md5.h pixdesc.h samplefmt.h timestamp.h
attributes.h avconfig.h blowfish.h cpu.h eval.h intfloat.h log.h mem.h pixfmt.h sha.h version.h
audio_fifo.h avstring.h bprint.h crc.h fifo.h intfloat_readwrite.h lzo.h opt.h random_seed.h time.h xtea.h

Discussion

  • Lew
    Lew
    2012-10-14

    Correction: With include/libavutil removed from the makefile, a clean compile now
    results in:
    ~/Code/minidlna-1.0.25 $ make
    Compiling minidlna.c
    Compiling upnphttp.c
    Compiling upnpdescgen.c
    Compiling upnpsoap.c
    Compiling upnpreplyparse.c
    Compiling minixml.c
    Compiling getifaddr.c
    Compiling daemonize.c
    Compiling upnpglobalvars.c
    Compiling options.c
    Compiling minissdp.c
    Compiling uuid.c
    Compiling upnpevents.c
    Compiling sql.c
    Compiling utils.c
    Compiling metadata.c
    metadata.c:33:20: error: avutil.h: No such file or directory

     
  • Lew
    Lew
    2012-10-14

    I note that only metadata.c uses headers specifically from the FFMPEG av* suite.
    Specifically, it uses
    metadata.c:#include <avcodec.h>
    metadata.c:#include <avcodec.h>
    metadata.c:#include <avformat.h>
    metadata.c:#include <avutil.h>

    Perhaps a combination of some make-time scripting and C macro language could
    remedy this problem. Have the Makefile pass a -D value to metadata.c that tells it
    which variation of include directory structure is valid for ffmpeg's headers, and in
    metadata.c, use that value to create the appropriate
    #include <PATH_TO_HEADER/HEADER>
    strings. See the C standard Section 6.10.2 ("Source File Inclusion") paragraphs 4
    through 8 (of the C 9899-1999 standard) for details

     
  • Lew
    Lew
    2012-11-04

    musuruan: The patch at http://inmmc.org/ftp/soft/minidlna.diff is a step in the right direction,
    but it doesn't go far enough. It is neither comprehensive nor even complete, and fails to properly
    deliniate the location of the ffmpeg av* header files.

    Specifically, ffmpeg's libav* headers have moved from version to version; on one of my systems,
    avutil.h can be found in /usr/include/ffmpeg/avutil.h, while on another system, it can be found in
    /usr/local/include/libavutil/avutil.h

    The inmmc.org patch /does/ remove the GCC -I dependancy, and /does/ approach the av* header include
    in a "proper" manner, but /does not/ properly identify the location of the headers on some systems.
    The compile of metadata.c will fail on one of my systems because avutil.h /is not/ in directory
    libavutil, but is, instead, in directory ffmpeg. For /that system/ the proper include should be
    #include <ffmpeg/avutil.h>
    instead of the patched version's
    #include <libavutil/avutil.h>

    Similar arguments can be made for avformat.h and avcodec.h

    What is necessary is that the include file be properly located at make time, before the code
    is compiled. And the mechanism that locates it should be something like autoconf or some
    home-grown script or tool that then patches the source (or creates an intermediary header)
    with the proper locations for the av* headers.

     
  • Justin Maggard
    Justin Maggard
    2012-11-05

    Fix compiling with new ffmpeg version

     
    Attachments
  • Justin Maggard
    Justin Maggard
    2012-11-05

    Please try with either the attached patch, code from CVS. This should already have been working using the HEAD branch in CVS.

     
  • Justin Maggard
    Justin Maggard
    2012-11-05

    • assigned_to: nobody --> jmaggard
    • status: open --> open-fixed