Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error prevents XML::LibXML installation #61

Open
nickforino opened this issue Nov 19, 2020 · 11 comments
Open

Fatal error prevents XML::LibXML installation #61

nickforino opened this issue Nov 19, 2020 · 11 comments

Comments

@nickforino
Copy link

Hi everyone,

My attempts to install XML::LibXML with cpanm and also manually fail, and return the following fatal error:

cc -c  -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os   -DVERSION=\"2.0206\" -DXS_VERSION=\"2.0206\"  -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE"  -DHAVE_UTF8 Av_CharPtrPtr.c
cc -c  -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os   -DVERSION=\"2.0206\" -DXS_VERSION=\"2.0206\"  -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE"  -DHAVE_UTF8 Devel.c
Devel.xs:28:10: fatal error: 'libxml/xmlmemory.h' file not found
#include <libxml/xmlmemory.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Devel.o] Error 1

After reading some similar issues I've ensured the dependent modules are properly installed (XML::SAX , XML:: NamespaceSupport) and that I've got a current version of libxml2 and Alien.

Any help would be greatly appreciated, please let me know any additional information you need to diagnose the issue and I'll respond promptly. Thanks!

@plicease
Copy link
Contributor

plicease commented Nov 19, 2020

Can you tell me what version of Alien::LibXML and Alien::Build you have installed, and if you can provide the log for its install?

@plicease
Copy link
Contributor

Also make sure that you are running the tests when installing Alien::LibXML because it should fail if it detects the wrong flags.

@nickforino
Copy link
Author

@plicease Thanks for your reply. Apparently I just had Alien, and not Alien::LibXML. Although I attempted to install Alien::LibXML via cpanm and this failed. I've attached the log, notably it throws the same error line when it fails:

 t/tree1.c:13:10: fatal error: 'libxml/parser.h' file not found
#include <libxml/parser.h>
         ^~~~~~~~~~~~~~~~~

build.log

@plicease
Copy link
Contributor

@nickforino I apologize but the actual dependency is Alien::Libxml2 lol Can you try that one instead.

@nickforino
Copy link
Author

nickforino commented Nov 20, 2020

@plicease no worries! My Alien::Libxml2 version is 0.17 and Alien::Build version is 2.37.

@nickforino
Copy link
Author

nickforino commented Nov 20, 2020

@plicease I just tried to force reinstall Alien::Libxml2 and Alien::Build, I've attached the logs for both. The test and installation for Alien::Libxml2 failed, while Build installed without a hitch, I've attached the log for Libxml2.
build.log

@nickforino
Copy link
Author

It appears that when attempting make, my system is having a hard time finding my libxml2 installation (hence the fatal errors). I tried setting the following environmental path variables, but this also failed.

export PATH = /usr/local/opt/libxml2/bin
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

@plicease
Copy link
Contributor

Looks like Alien::Libxml2 is looking in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include (from xml2-config) for the header files, can you check if the appropriate files in there?

One work around, if you don't mind Alien::Libxml2 building the library for you is to force a share install:

env ALIEN_INSTALL_TYPE=share cpanm -v Alien::Libxml2

@nickforino
Copy link
Author

Hi @plicease, apologies for the very late reply.

Regarding your last question: I believe the path Alien::Libxml2 is looking for headers in/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include is incorrect. The header files (namely, I found parser.h) several directories deeper in /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/libxml2/libxml/parser.h.

@plicease
Copy link
Contributor

Regarding your last question: I believe the path Alien::Libxml2 is looking for headers in/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include is incorrect. The header files (namely, I found parser.h) several directories deeper in /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/libxml2/libxml/parser.h.

The include path would have come from either xml2-config --cflags or pkg-config --cflags libxml-2.0 can you see if either of those has the wrong path specified?

@nickforino
Copy link
Author

Indeed, looks like the wrong paths are specified!

xml2-config --cflags returns -I/usr/local/Cellar/libxml2/2.9.10_2/include/libxml2 I believe the Cellar directory is from Homebrew, but I can't quite remember what I tried to install, as I was likely trying things out of desperation...regardless, this path does not directly lead to the headers, which are again several directories further in /usr/local/Cellar/libxml2/2.9.10_2/include/libxml2/libxml.

Similarly, pkg-config --cflags libxml-2.0 returns the same path: -I/usr/local/Cellar/libxml2/2.9.10_2/include/libxml2

Is the solution to uninstall Homebrew?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants