pkg-config v. -I/opt/local/include

Craig Treleaven ctreleaven at macports.org
Mon Jan 11 11:59:51 PST 2016


> On Jan 11, 2016, at 10:03 AM, Craig Treleaven <ctreleaven at macports.org> wrote:
> I’m having buiild failures due to includes pointing to old/other headers installed in /opt/local/include.
> 
> As I understand it, 'pig-config —cflags’ returns an empty string when a header is installed in /usr/include.  The port I’m working on, MythTV 0.28-pre, uses pkg-config to check for several dependencies.  Under MacPorts, I end up with '-I/opt/local/include’ early in the compiler arguments and thus picks up old or unintended versions of headers.  Under Linux, no problem.
> 
> Is there some way I can coerce pkg-config to treat /opt/local/include like it does /usr/include?  I’ve looked at the man page for pkg-config and tried using some of the environment variables but without success.
> 
> Eg, with MacPorts:
> $ pkg-config --cflags x264
> -I/opt/local/include                     ## want to make this disappear!
> 
> is there a magic recipe?

Didn’t find a magic recipe but I did come up with a workaround.  I overrode the pkg-config command used by configure ala:

set pkg_config_cmd  "${prefix}/bin/pkg-config $@ | sed 's|-I${prefix}/include ||g’”

and added --pkg_config="${pkg_config_cmd}” to the configure arguments.  I get one no-harm warning but that is much better than random build failures!

I’m still open to better solutions.

Craig




More information about the macports-dev mailing list