Closed dimitriadamou closed 8 years ago
Forgot to close, sorry.
Sorry for the late reply, but maybe you have a .pc
(pkg-config file) somewhere in the discoverable path that points to /usr/include
of /usr/local/include
? Or, maybe you don't have a .pc
file that points to /usr/local/include
?
cgo isn't terrible smart about finding paths and what not, and mostly relies on stuff like pkg-config to find those things
All good, I didn't have much luck with pkg-config it was pointing to some where else, how ever the current setup is working so I'll leave as is for now
Had this same problem on MacOS with libxml2 installed via brew.
PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig go get github.com/lestrrat-go/libxml2
worked for me.
How did you finally solve this problem
@xiaxichen read my edit it has how I solved it
Hey there,
I am running MacOS, Go 1.7, running "go get github.com/lestrrat/go-libxml2" I get
'libxml/HTMLparser.h' file not found
include <libxml/HTMLparser.h>
I have done sudo brew install libxml2 and etc
I have made an alias to "libxml" inside my /usr/local/include/
I can't seem to figure out how to check where the default include path is when using go get, I can compile fine under GCC (not the Go library though)
I have worked with libxml in C before and it has worked, but I can't figure it out using Go; any help would be appreciated.
HOMEBREW_VERSION: 0.9.9 ORIGIN: https://github.com/Homebrew/brew HEAD: 7c7e2d00af9d8a05f4736c368804713fba61a422 Last commit: 9 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 12f6a5e8a13f05bb045638deb0032882012af514 Core tap last commit: 10 hours ago HOMEBREW_PREFIX: /usr/local HOMEBREW_REPOSITORY: /usr/local HOMEBREW_CELLAR: /usr/local/Cellar HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com CPU: octa-core 64-bit haswell Homebrew Ruby: 2.0.0-p648 Clang: 7.3 build 703 Git: 2.6.4 => /Applications/Xcode.app/Contents/Developer/usr/bin/git Perl: /usr/bin/perl Python: /usr/bin/python Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby Java: 1.8.0_45, 1.7.0_79 OS X: 10.11.5-x86_64 Xcode: 7.3 CLT: N/A X11: 2.7.7 => /opt/X11
Edit:
It seems like Go expects my include path to be /usr/include/ - GCC was fine.
It wouldn't accept it as an alias so I had to copy the whole of /usr/local/include/ into /usr/include/
PS before copying my include folder into /usr/include - I tried go get -gccgoflags -I/usr/local/include,-I/usr/local/include/libxml2 ... and had the same issue.
Do you happen to know if I can reconfigure go to look in /usr/local/include instead ? Apart from that - library works great now 👯