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

Uoti Urpala uoti.urpala at pp1.inet.fi
Tue Jul 17 06:18:47 CEST 2007


On Mon, 2007-07-16 at 22:00 -0500, SciFi wrote:
> Some months ago I opened a couple bugreports to try convincing TPTB 
> here to use pkg-config over-and-above the other ways of detections 
> being used in mplayer's configure et al.
> 
> As far as this png debacle is concerned, ATM I'm testinuseg their official
> libpng-1.2.19beta23.tar.gz code.  My full path include-dir for the

> We must reconsider relying on the *-config scripts again please if they 
> are available & provided by the project.  It is the only way to fix 
> some of these configure problems IMO.

The issue with the png.h header is independent of pkg-config use. The
problem is not that MPlayer wouldn't find the header - in fact no
explicit include path setting is needed at all, "#include <png.h>" works
fine by itself in a normal configuration where png.h is in /usr/include.

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.




More information about the MPlayer-dev-eng mailing list