Closed PhilipSharman closed 5 years ago
Can you provide the output of:
pkg-config libxml-2.0 --libs
pkg-config libxml-2.0 --cflags
thanks.
pkg-config libxml-2.0 --libs
-lxml2
pkg-config libxml-2.0 --cflags
-I/usr/include/libxml2
Thanks.
So it looks like Apple ships a broken version of libxml2 cool. I'll rework the alienfile to prefer xml2-config over pkg-config. That seems to make more sense anyhow.
@PhilipSharman can you try https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-Libxml2-0.10_01.tar.gz
Thanks, that seems to work!
P.S. Just to clarify what I have on my machine ...
1) What is installed by default on OS X:
- Using this location for `xml-2config`: \
`/usr/bin/xml2-config`
`xml2 config -version` reports:\
`2.9.4`
`xml2 config -libs` reports:\
`-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm`
`xml2 config -cflags` reports:\
`-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2`
- (There doesn't seem to be a `pkg-config` installed by default.)
2) What is installed by Homebrew:
- Using this location for `xml-2config`: \
`/usr/local/Cellar/libxml2/2.9.9_2/bin/xml2-config`
`xml2 config -version` reports:\
`2.9.9`
`xml2 config -libs` reports:\
`-L/usr/local/Cellar/libxml2/2.9.9_2/lib -lxml2 -lz -lpthread -liconv -lm`
`xml2 config -cflags` reports:\
`-I/usr/local/Cellar/libxml2/2.9.9_2/include/libxml2`
- Using this location for `pkg-config`: \
`/usr/local/bin/pkg-config` \
... which is a symbolic link to ... \
`../Cellar/pkg-config/0.29.2/bin/pkg-config`
`pkg-config libxml-2.0 --libs` reports: \
`-lxml2`
`pkg-config libxml-2.0 --cflags` reports: \
`-I/usr/include/libxml2`
But there is no `/usr/include` directory.
P.S.
Yeah apple doesn't provide pkg-config
or /usr/include
in recent versions of their OS (not sure if they ever provided pkg-config
). They do provide the .dylib
files for run-time compatibility of existing software, but they also apparently provide the .pc
files that no longer work without the headers in /usr/include
, which are picked up by pkg-config
homebrew. IMO apple should not ship the broken .pc
files that would pretty much fix everything. There are probably workarounds that homebrew could make (since it is providing its own pkg-config
), like not using the broken .pc
files or putting its .pc
file for libxml2 et. al before the broken system .pc
files.
Released the fix as 0.11. Sorry for the long delay on making a production release, I lost track of things.
Any advice on how I can get this working on MacOS Catalina v10.15.7
I have tried the steps detailed by Philip but still hit the same issue:
# #include <libxml/parser.h>
# ^~~~~~~~~~~~~~~~~
# 1 error generated.\`
▶ which xml2-config
/usr/local/opt/libxml2/bin/xml2-config
▶ xml2-config --version
2.9.10
▶ xml2-config --libs
-L/usr/local/Cellar/libxml2/2.9.10_1/lib -lxml2 -lz -lpthread -liconv -lm
▶ xml2-config --cflags
-I/usr/local/Cellar/libxml2/2.9.10_1/include/libxml2
▶ pkg-config libxml-2.0 --libs
-lxml2
▶ pkg-config libxml-2.0 --cflags
<No Output>
▶ xml2-config --libs
-L/usr/local/Cellar/libxml2/2.9.10_1/lib -lxml2 -lz -lpthread -liconv -lm
▶ xml2-config --cflags
-I/usr/local/Cellar/libxml2/2.9.10_1/include/libxml2
▶ which pkg-config
/usr/local/bin/pkg-config
▶ ls -l /usr/local/bin/pkg-config
lrwxr-xr-x 1 mg admin 44 29 Jun 13:24 /usr/local/bin/pkg-config -> ../Cellar/pkg-config/0.29.2_3/bin/pkg-config
@MichaelGrundie please provide the full output of the test fail on this issue: https://github.com/PerlAlien/Alien-Libxml2/issues/23
Hello, I'm having problems installing Alien::Libxml2 on OS X.
I tried to use cpan to install Alien::Libxml2, but it failed with this message:
So I used Homebrew to install a more up to date copy of libxml2 and I've put that copy early in the path. Now if I do
xml2-config --version
I get the new version2.9.9
.But when I try again to install Alien::Libxml2 via cpan, I get the same error message. It still finds the old 2.9.4 version.
I then tried to install Alien::Libxml2 manually and specify some paths to the makefile. EG:
But that didn't work either. I still get the
fatal error: 'libxml/parser.h' file not found
error.I've asked on Perl Monks, but haven't found an answer that works for me.
This is using OS X 10.14.5 (Mojave) . I've tried with both Perl 5.28.2 and 5.30.0.
xml2-config --libs
:xml2-config --cflags
:Thanks for any assistance you can give. I'm probably missing something obvious.
Regards, Philip.