Subject: Re: bug#32927: 27.0.50; libxml not found when building on macOS Mojave

From: Xu Xin <[email-masked]>
Date: Mon, 15 Oct 2018 10:52:32 -0400

On Thu, Oct 4, 2018 at 8:35 PM YAMAMOTO Mitsuharu
<[email-masked]> wrote:
>
> tags 32927 notabug
> close 32927
> quit
>
> On Fri, 05 Oct 2018 06:22:22 +0900,
> Philipp Stephani wrote:
>
> > Yes, looks like this is the problem:
> >
> > $ pkg-config --cflags --libs "libxml-2.0 > 2.6.17"
> >
> > -I/usr/include/libxml2 -lxml2
> >
> > $ pkg-config --variable pcfiledir "libxml-2.0 > 2.6.17"
> >
> > /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12
>
> The file libxml-2.0.pc there (installed via Homebrew?) does not make
> sense (and actually does harm) unless the header files are installed
> into /usr/include.  You can do that by following the workaround
> mentioned in the Xcode release notes, but I'm not sure this is the way
> intended by the Homebrew developers (and I'm not using Homebrew).
> Maybe you want to ask it at some Homebrew forum.
>
> Anyway, this is not a bug in Emacs.  Closing.
>
>                                      YAMAMOTO Mitsuharu
>                                 [email-masked]
>
>
>

A ticket opened for Homebrew, but looks like there's no plan to fix it
for now: https://github.com/Homebrew/brew/issues/5068

A patch like this can also be a hack:

% cat pkgconfig_10.14.diff
diff --git a/Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc
b/Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc
index c297c6b45..7a037a9cf 100644
--- a/Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc
+++ b/Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc
@@ -1,7 +1,8 @@
 prefix=/usr
+xcode_prefix=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk${prefix}
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+includedir=${xcode_prefix}/include
 modules=1

 Name: libXML

Another interesting thing is Homebrew itself able to build emacs
successfully by command `brew install --build-from-source emacs`
without any header file error and any hack/workaround to *.pc files.
Maybe because of some internal settings.

- Xin