Closed stuart-little closed 5 years ago
Can you provide the full install log of Alien::Libxml2
, also the output of these commands, if available would be useful in debugging:
pkg-config --libs libxml-2.0
pkg-config --cflags libxml-2.0
xml2-config --cflags
xml2-config --libs
Also curious if you ran the tests for Alien::Libxml2
if there was a probe error that should have caught it.
The requested info follows
$ pkg-config --libs libxml-2.0
-L/data/data/com.termux/files/usr/lib -lxml2
$ pkg-config --cflags libxml-2.0
-I/data/data/com.termux/files/usr/include/libxml2
$ xml2-config --cflags
-I/data/data/com.termux/files/usr/include/libxml2
There's no xml2-libs
command. Did you by any chance mean xml2-config --libs
? If so:
$ xml2-config --libs
-L/data/data/com.termux/files/usr/lib -lxml2 -L/data/data/com.termux/files/usr/lib -lz -L/data/data/com.termux/files/usr/lib -llzma -liconv -lm
About the Alien::Libxml2
installation: it was through CPAN, and initially I did not install it directly. It must have been pulled when I tried to install XML::LibXML
with notest
. So no, initially I did not run the tests.
What I see now, after uninstalling it with cpanm
and trying again: with notest
it installs fine. Without it, i.e. when I do run the tests, the installation fails. You can see output from both commands:
$ cpan Alien::Libxml2
$ cpan -Ti Alien::Libxml2
Yes I typo'd the command should have been:
xml2-config --libs
This output doesn't explain what you reported earlier. The diagnostic shows the correct include directory for ->cflags
and -lxml2
for ->libs
.
As for the test failure, it seems as though the configuration provided by libxml2 is wrong. Neither pkg-config
nor xml2-config
are providing the appropriate -I
flags to find inconv.h
, and the pkg-config probably isn't providing the correct -L
flag for libiconv
(although it doesn't get to the link step thanks to the compile error, so depending on the library search order that may be fine). These problems should be reported to the vendor.
As for the test failure, it seems as though the configuration provided by libxml2 is wrong. Neither
pkg-config
norxml2-config
are providing the appropriate-I
flags to findinconv.h
, and the pkg-config probably isn't providing the correct-L
flag forlibiconv
(although it doesn't get to the link step thanks to the compile error, so depending on the library search order that may be fine). These problems should be reported to the vendor.
I suppose the vendors in question would be the folks over at termux. Let me try to understand what the problem to report is:
First off, I when I made the previous post I did not have the libiconv-dev package installed and there was no iconv.h
file anywhere on the system to begin with. There is now, but which pkg-config
command should I run to test whether pkg-config sees iconv properly?
I have checked that there are no *iconv*
files in $PREFIX/lib/pkgconfig
. Is that the issue I should be reporting?
Ah, you know what? After installing libiconv-dev
the Alien::Libxml2
install went through fine with tests: the new output of
$ cpan Alien::Libxml2
is here.
iconv
may not provide a .pc
file (many packages do not), but if libxml2 uses it then it is its responsibility that it pass on the appropriate flags for its use via its .pc
file. Since you only needed to install libiconv-dev
that tells me that the iconv.h and libiconv are already in the appropriate system level paths. libiconv-dev
probably should be a dependency of (I'm guessing the package name) libxml2-dev
, though I am not familiar with the package system used by termux. Curious if XML::LibXML2
installs cleanly now?
iconv
may not provide a.pc
file (many packages do not), but if libxml2 uses it then it is its responsibility that it pass on the appropriate flags for its use via its.pc
file. Since you only needed to installlibiconv-dev
that tells me that the iconv.h and libiconv are already in the appropriate system level paths.libiconv-dev
probably should be a dependency of (I'm guessing the package name)libxml2-dev
, though I am not familiar with the package system used by termux.
I see; thank you for clarifying. Yes, that package is indeed libxml2-dev
.
Curious if
XML::LibXML2
installs cleanly now?
It did! I uninstalled it with cpanm
and then issued
cpan XML::LibXML
It went through fine, tests and all. I think I'll report this back in the original XML::LibXML
thread too.
Thank you for all the help.
Great thanks for reporting this, I think there is probably a useful FAQ for this, although I haven't formulated it quite yet.
In initially posted this on the XML::LibXML issue page to document the problem and was directed here. I figured it might be good to mention, in case anyone else encounters the issue.
I was trying to build XML::LibXML on Android 9 (aarch64) with the termux terminal emulator and perl v5.28.2. The problem was twofold:
(1) the line
in the XML::LibXML
Makefile.PL
only provides the include directoryand not the one-level deeper directory
where the desired header file
libxml/xmlmemory.h
is located. This seems to be due to the fact that theAlien::Libxml2->cflags
portion of that line is actually empty.(2) the line
in the same Makefile.PL fails to pass
-lxml2
to theMakefile
, which then ends up having noEXTRALIBS
.To address both issues I modified the XML::LibXML
Makefile.PL
as followsThis all works fine now, with everything building and running as expected after implementing said modification, but it might be of use to record the problem here.