[MPlayer-dev-eng] include dirs ordering: build errors related to #include <png.h>

Roberto Togni rxt at rtogni.it
Mon Jul 23 22:20:49 CEST 2007


On Tue, 17 Jul 2007 07:18:47 +0300
Uoti Urpala <uoti.urpala at pp1.inet.fi> wrote:

> On Mon, 2007-07-16 at 22:00 -0500, SciFi wrote:
[...]
> 
> Rather the problem is that the name libavcodec/png.h conflicts with the
> system header. This is not something that could be automatically
> resolved by using any particular method of configuring the include path.
> 
> 
> You could first attempt to solve this generally (rather than
> reordering/changing the include path on a file-by-file basis) by not
> having libavcodec in the include path to avoid picking its private
> headers accidentally and using "#include "libavcodec/foo.h" to
> intentionally include them. Unfortunately avformat.h in libavformat/
> uses '#include "avcodec.h"'. That can't work unless avcodec.h is either
> in the same directory as avformat.h or avcodec.h is in the include path.
> So just dropping libavcodec/ from the include path will fail at least
> for files which include avformat.h.
> 
> This could be fixed quite nicely using gccs -iquote instead of -I for
> avcodec. Then the headers in avcodec would not be confused with anything
> included with <>, and the option would also make sense semantically -
> headers in libavcodec/ are not part of the installed header namespace.
> Unfortunately other compilers lack support for this.
> 
> Another way would be to copy/link the "installed" headers from FFmpeg to
> a new directory as a part of the build process. Then avformat.h and
> avcodec.h would be in the same directory and the avformat->avcodec
> dependency would work independently of include path. This would be
> somewhat ugly but might work OK in practice. As long as there aren't
> more files including avformat.h (currently there seem to be 3) it's
> probably simpler to use a custom include path for those though.
> 

The same kind of problem is reported with libdca 0.0.5, the dts.h header
includes dca.h, and it conflicts with libavcodec/dca.h.
What about addinh -Ilibavcodec and/or -Ilibavformat only to the files
that really need them? It could eventually be done automatically by
configure with some grep magic. Any better ideas?

Ciao,
 Roberto



More information about the MPlayer-dev-eng mailing list