homebrew-postgresql icon indicating copy to clipboard operation
homebrew-postgresql copied to clipboard

macOS Mojave 10.14: configure: error: header file <libxml/parser.h> is required for XML support

Open madrobby opened this issue 7 years ago β€’ 24 comments
trafficstars

On the current beta of macOS Mojave 10.14 (18A314k) I get this error:

$ brew install petere/postgresql/postgresql@10
==> Installing postgresql@10 from petere/postgresql
==> Downloading https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.bz2
Already downloaded: /Users/thomasfuchs/Library/Caches/Homebrew/[email protected]
==> ./configure --prefix=/usr/local/Cellar/postgresql@10/10.4 --enable-dtrace --enable-nls --with-bonjour --with-gssapi --with-i
Last 15 lines from /Users/thomasfuchs/Library/Logs/Homebrew/postgresql@10/01.configure:
checking gssapi/gssapi.h presence... yes
checking for gssapi/gssapi.h... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking security/pam_appl.h usability... yes
checking security/pam_appl.h presence... yes
checking for security/pam_appl.h... yes
checking libxml/parser.h usability... no
checking libxml/parser.h presence... no
checking for libxml/parser.h... no
configure: error: header file <libxml/parser.h> is required for XML support

I do have libxml2 installed.

madrobby avatar Jul 01 '18 18:07 madrobby

Update, on Beta 3, I get another error:

 brew install petere/postgresql/postgresql@10
==> Installing postgresql@10 from petere/postgresql
==> Downloading https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.bz2
Already downloaded: /Users/thomasfuchs/Library/Caches/Homebrew/[email protected]
==> ./configure --prefix=/usr/local/Cellar/postgresql@10/10.4 --enable-dtrace --enable-nls --with-bonjour --wi
Last 15 lines from /Users/thomasfuchs/Library/Logs/Homebrew/postgresql@10/01.configure:
checking for library containing bind_textdomain_codeset... -lintl
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for msgfmt... /usr/local/opt/gettext/bin/msgfmt
checking for msgfmt flags... -c
checking for msgmerge... /usr/local/opt/gettext/bin/msgmerge
checking for xgettext... /usr/local/opt/gettext/bin/xgettext
checking for tclsh... /usr/local/opt/tcl-tk/bin/tclsh
checking for tclConfig.sh... /usr/local/Cellar/tcl-tk/8.6.8/lib/tclConfig.sh
checking tcl.h usability... yes
checking tcl.h presence... yes
checking for tcl.h... yes
checking for perl.h... no
configure: error: header file <perl.h> is required for Perl

madrobby avatar Jul 12 '18 21:07 madrobby

The only temporary workaround for the error: header file <perl.h> is required for Perl issue I've found so far is to:

brew edit petere/postgresql/postgresql@10

Replace --with-perl line, with: --without-perl, and

brew install petere/postgresql/postgresql@10

Same works for @11 --devel.

Obv won't work if you rely on PLperl…

meeDamian avatar Jul 14 '18 20:07 meeDamian

Can you post the entire configure output and perhaps even config.log. Maybe the system Perl and libxml installations have changed in Mojave. Or perhaps a matching XCode update is needed.

petere avatar Jul 28 '18 13:07 petere

I'm not sure what exactly are you asking for. My best guess being contents of ~/Library/Logs/Homebrew/postgresql@11, and that would be: https://gist.github.com/meeDamian/141ab9e517fa34a320fc28b4b128a97a - lmk if you need sth different instead.

I've found in some other thread that Mojave lacks some header files, and that installing this: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg would help, unfortunately it doesn't seem to cut it for me :/.

meeDamian avatar Jul 29 '18 02:07 meeDamian

So according to config.log, there is a perl.h, which includes EXTERN.h, which is missing. Take a look around /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/ to see what's going on there. Maybe after the upgrade there is also a newer Perl version under /System/Library/Perl/.

petere avatar Jul 29 '18 18:07 petere

$ ls -lha /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/
total 4832
drwxr-xr-x   3 root  wheel    96B Jul 22 08:31 .
drwxr-xr-x  56 root  wheel   1.8K Jul 22 08:31 ..
-rwxr-xr-x   1 root  wheel   2.4M Jul 13 17:53 libperl.dylib

$ tree -L 2 /System/Library/Perl/
/System/Library/Perl/
β”œβ”€β”€ 5.18
β”‚Β Β  β”œβ”€β”€ AnyDBM_File.pm
β”‚Β Β  β”œβ”€β”€ App
β”‚Β Β  β”œβ”€β”€ Archive
β”‚Β Β  β”œβ”€β”€ Attribute
β”‚Β Β  β”œβ”€β”€ AutoLoader.pm
β”‚Β Β  β”œβ”€β”€ AutoSplit.pm
β”‚Β Β  β”œβ”€β”€ B
β”‚Β Β  β”œβ”€β”€ Benchmark.pm
β”‚Β Β  β”œβ”€β”€ CGI
β”‚Β Β  β”œβ”€β”€ CGI.pm
β”‚Β Β  β”œβ”€β”€ CORE.pod
β”‚Β Β  β”œβ”€β”€ CPAN
β”‚Β Β  β”œβ”€β”€ CPAN.pm
β”‚Β Β  β”œβ”€β”€ CPANPLUS
β”‚Β Β  β”œβ”€β”€ CPANPLUS.pm
β”‚Β Β  β”œβ”€β”€ Carp
β”‚Β Β  β”œβ”€β”€ Carp.pm
β”‚Β Β  β”œβ”€β”€ Class
β”‚Β Β  β”œβ”€β”€ Compress
β”‚Β Β  β”œβ”€β”€ Config
β”‚Β Β  β”œβ”€β”€ DB.pm
β”‚Β Β  β”œβ”€β”€ DBM_Filter
β”‚Β Β  β”œβ”€β”€ DBM_Filter.pm
β”‚Β Β  β”œβ”€β”€ Devel
β”‚Β Β  β”œβ”€β”€ Digest
β”‚Β Β  β”œβ”€β”€ Digest.pm
β”‚Β Β  β”œβ”€β”€ DirHandle.pm
β”‚Β Β  β”œβ”€β”€ Dumpvalue.pm
β”‚Β Β  β”œβ”€β”€ Encode
β”‚Β Β  β”œβ”€β”€ English.pm
β”‚Β Β  β”œβ”€β”€ Env.pm
β”‚Β Β  β”œβ”€β”€ Exporter
β”‚Β Β  β”œβ”€β”€ Exporter.pm
β”‚Β Β  β”œβ”€β”€ ExtUtils
β”‚Β Β  β”œβ”€β”€ Fatal.pm
β”‚Β Β  β”œβ”€β”€ File
β”‚Β Β  β”œβ”€β”€ FileCache.pm
β”‚Β Β  β”œβ”€β”€ FileHandle.pm
β”‚Β Β  β”œβ”€β”€ Filter
β”‚Β Β  β”œβ”€β”€ FindBin.pm
β”‚Β Β  β”œβ”€β”€ Getopt
β”‚Β Β  β”œβ”€β”€ HTTP
β”‚Β Β  β”œβ”€β”€ I18N
β”‚Β Β  β”œβ”€β”€ IO
β”‚Β Β  β”œβ”€β”€ IPC
β”‚Β Β  β”œβ”€β”€ JSON
β”‚Β Β  β”œβ”€β”€ Locale
β”‚Β Β  β”œβ”€β”€ Log
β”‚Β Β  β”œβ”€β”€ Math
β”‚Β Β  β”œβ”€β”€ Memoize
β”‚Β Β  β”œβ”€β”€ Memoize.pm
β”‚Β Β  β”œβ”€β”€ Module
β”‚Β Β  β”œβ”€β”€ NEXT.pm
β”‚Β Β  β”œβ”€β”€ Net
β”‚Β Β  β”œβ”€β”€ Object
β”‚Β Β  β”œβ”€β”€ Package
β”‚Β Β  β”œβ”€β”€ Params
β”‚Β Β  β”œβ”€β”€ Parse
β”‚Β Β  β”œβ”€β”€ Perl
β”‚Β Β  β”œβ”€β”€ PerlIO
β”‚Β Β  β”œβ”€β”€ PerlIO.pm
β”‚Β Β  β”œβ”€β”€ Pod
β”‚Β Β  β”œβ”€β”€ Safe.pm
β”‚Β Β  β”œβ”€β”€ Search
β”‚Β Β  β”œβ”€β”€ SelectSaver.pm
β”‚Β Β  β”œβ”€β”€ SelfLoader.pm
β”‚Β Β  β”œβ”€β”€ Symbol.pm
β”‚Β Β  β”œβ”€β”€ TAP
β”‚Β Β  β”œβ”€β”€ Term
β”‚Β Β  β”œβ”€β”€ Test
β”‚Β Β  β”œβ”€β”€ Test.pm
β”‚Β Β  β”œβ”€β”€ Text
β”‚Β Β  β”œβ”€β”€ Thread
β”‚Β Β  β”œβ”€β”€ Thread.pm
β”‚Β Β  β”œβ”€β”€ Tie
β”‚Β Β  β”œβ”€β”€ Time
β”‚Β Β  β”œβ”€β”€ UNIVERSAL.pm
β”‚Β Β  β”œβ”€β”€ Unicode
β”‚Β Β  β”œβ”€β”€ User
β”‚Β Β  β”œβ”€β”€ XSLoader.pm
β”‚Β Β  β”œβ”€β”€ _charnames.pm
β”‚Β Β  β”œβ”€β”€ autodie
β”‚Β Β  β”œβ”€β”€ autodie.pm
β”‚Β Β  β”œβ”€β”€ autouse.pm
β”‚Β Β  β”œβ”€β”€ base.pm
β”‚Β Β  β”œβ”€β”€ bigint.pm
β”‚Β Β  β”œβ”€β”€ bignum.pm
β”‚Β Β  β”œβ”€β”€ bigrat.pm
β”‚Β Β  β”œβ”€β”€ blib.pm
β”‚Β Β  β”œβ”€β”€ bytes.pm
β”‚Β Β  β”œβ”€β”€ bytes_heavy.pl
β”‚Β Β  β”œβ”€β”€ charnames.pm
β”‚Β Β  β”œβ”€β”€ constant.pm
β”‚Β Β  β”œβ”€β”€ darwin-thread-multi-2level
β”‚Β Β  β”œβ”€β”€ deprecate.pm
β”‚Β Β  β”œβ”€β”€ diagnostics.pm
β”‚Β Β  β”œβ”€β”€ dumpvar.pl
β”‚Β Β  β”œβ”€β”€ encoding
β”‚Β Β  β”œβ”€β”€ feature.pm
β”‚Β Β  β”œβ”€β”€ fields.pm
β”‚Β Β  β”œβ”€β”€ filetest.pm
β”‚Β Β  β”œβ”€β”€ if.pm
β”‚Β Β  β”œβ”€β”€ inc
β”‚Β Β  β”œβ”€β”€ integer.pm
β”‚Β Β  β”œβ”€β”€ less.pm
β”‚Β Β  β”œβ”€β”€ locale.pm
β”‚Β Β  β”œβ”€β”€ open.pm
β”‚Β Β  β”œβ”€β”€ overload
β”‚Β Β  β”œβ”€β”€ overload.pm
β”‚Β Β  β”œβ”€β”€ overloading.pm
β”‚Β Β  β”œβ”€β”€ parent.pm
β”‚Β Β  β”œβ”€β”€ perl5db.pl
β”‚Β Β  β”œβ”€β”€ perlfaq.pm
β”‚Β Β  β”œβ”€β”€ pods
β”‚Β Β  β”œβ”€β”€ sigtrap.pm
β”‚Β Β  β”œβ”€β”€ sort.pm
β”‚Β Β  β”œβ”€β”€ strict.pm
β”‚Β Β  β”œβ”€β”€ subs.pm
β”‚Β Β  β”œβ”€β”€ unicore
β”‚Β Β  β”œβ”€β”€ utf8.pm
β”‚Β Β  β”œβ”€β”€ utf8_heavy.pl
β”‚Β Β  β”œβ”€β”€ vars.pm
β”‚Β Β  β”œβ”€β”€ version
β”‚Β Β  β”œβ”€β”€ version.pm
β”‚Β Β  β”œβ”€β”€ version.pod
β”‚Β Β  β”œβ”€β”€ vmsish.pm
β”‚Β Β  β”œβ”€β”€ warnings
β”‚Β Β  └── warnings.pm
└── Extras
    └── 5.18

60 directories, 71 files

# And this returns nothing:
$ tree /System/Library/Perl/ | grep -i EXTERN.h

I'm really not sure what's going on here, but I'm happy to provide any information that might be useful to you ^^.

meeDamian avatar Jul 30 '18 04:07 meeDamian

The headers are in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/ on Mojave but that is not where Perl expects them to be.

twogee avatar Sep 30 '18 06:09 twogee

FWIW I just modified my local recipes to depend on brew's Perl and I think it fixed it?

jasonmp85 avatar Oct 16 '18 18:10 jasonmp85

I see no need to have an extra Perl distribution, so unless 5.20+ is necessary for other reasons, I'd like to have this Mojave oddity addressed upstream in ExtUtils::MakeMaker.

twogee avatar Oct 16 '18 19:10 twogee

Seems like an unstable location, too β€”Β mine are in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/ 😞

sj26 avatar Nov 20 '18 10:11 sj26

I believe that Command Line Tools put them under /Library. The problem is though that Perl has many other modules apart from ExtUtils::MakeMaker that may need to take into account that Mojave oddity. I wish macOS could do union mounts with directories...

twogee avatar Nov 20 '18 12:11 twogee

I just got it working by cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library rm -r Perl ln -s /System/Library/Perl then rerun the Xcode Command Line Tools installer. The headers end up in the correct places.

jsgillen1 avatar Nov 27 '18 19:11 jsgillen1

Thanks for the tip, I prefer

cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library
mv Perl Perl.off
ln -s /Library/Perl # (works as well)
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
rm Perl
mv Perl.off Perl

twogee avatar Jan 03 '19 14:01 twogee

Apple patched ExtUtils::MakeMaker to work with their new header locations: https://opensource.apple.com/source/perl/perl-113.200.7/5.18/fix/perl_inc.diff.auto.html If ExtUtils::MakeMaker gets upgraded in some way, including if it got upgraded prior to upgrading to Mojave I believe, then it won't have this patch and won't be able to build many modules properly. We are looking in to how we want to address this in ExtUtils::MakeMaker and related tools.

In a stock install of Mojave, ExtUtils::MakeMaker and related modules will exist in /System/Library/Perl/5.18. If a newer version is installed, it will be placed in /Library/Perl/5.18 and take precedence over the version in /System.

haarg avatar Jan 04 '19 01:01 haarg

For a general solution, all alternative modules for installing things must be considered, like Module::Build, ExtUtils::HasCompiler, Alien::Build. (I see ExtUtils::CBuilder has been patched.) And all "smart" modules that include their own versions of the above in their distributions or run an equivalent of configure.sh; they all look into Config, though, so the change must be reflected there.

twogee avatar Jan 04 '19 09:01 twogee

Module::Build uses ExtUtils::CBuilder to do its compiles. I'm not sure about Alien::Build, but it wouldn't surprise me if Apple broke various other tools with this patch. They didn't communicate with anyone involved with perl when making the change, but we're reaching out to them to see if there's a better solution that can be used.

haarg avatar Jan 04 '19 12:01 haarg

Twogee,

Could you explain what makes following commands different from just jsgillen1's ?

ln -s /Library/Perl # (works as well) open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

akhst7 avatar Jan 05 '19 00:01 akhst7

The second command starts an installer for headers only rather than the whole CLT. I was thinking about a symlink to /System/Library/Perl where the header files magically end up anyway, so the comment is redundant πŸ˜„.

twogee avatar Jan 05 '19 00:01 twogee

Are there environment vars that might solve this problem? Or maybe use the Homebrew install of perl?

lyda avatar Feb 13 '19 15:02 lyda

Perl is pretty rigid (or minimalistic πŸ˜„) with respect to placement of headers. See my comment in October regarding an extra distribution of Perl.

twogee avatar Feb 13 '19 20:02 twogee

Are there environment vars that might solve this problem? Or maybe use the Homebrew install of perl?

Yeah, why not this…

jasonmp85 avatar Feb 13 '19 21:02 jasonmp85

I finally updated to Mojave to be able to look into this better, but everything builds fine for me. So I don't know what to do.

petere avatar Feb 15 '19 16:02 petere

I had this issue (more specifically, the one in #44, missing perl.h) and fixed it with the solution from this comment https://github.com/petere/homebrew-postgresql/issues/44#issuecomment-451487767

Edit: While setting up a new mac, Xcode was not installed.

pmor avatar Mar 07 '19 16:03 pmor

FWIW I just modified my local recipes to depend on brew's Perl and I think it fixed it?

This worked for me as well.

brew edit postgresql

Then I changed

uses_from_macos "perl" to
depends_on "perl"

buck3000 avatar Apr 21 '20 20:04 buck3000