gokogiri
gokogiri copied to clipboard
identifier "_Ctype_struct__xmlDoc" may conflict with identifiers generated by cgo
I'm trying to install gokogiri on a macOS 10.14.4 (Mojave) and Go 1.12.3. I've installed libxml2 using brew. Installing gokogiri with:
LDFLAGS="-L/usr/local/opt/libxml2/lib" CPPFLAGS="-I/usr/local/opt/libxml2/include" PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig" go get github.com/moovweb/gokogiri
Outputs the error:
# github.com/moovweb/gokogiri/xml
../../github.com/moovweb/gokogiri/xml/document.go:330:19: identifier "_Ctype_struct__xmlDoc" may conflict with identifiers generated by cgo
How may I compile gokogiri?
See Pull Request https://github.com/moovweb/gokogiri/pull/97
Hello, I have a same bug form linux:
go version go1.13.1 linux/amd64 ubuntu: 18.04.3
display command: pkg-config --cflags -- libxml-2.0 libxml-2.0 pkg-config --libs -- libxml-2.0 libxml-2.0 CGO_LDFLAGS='"-g" "-O2" "-lxml2"' ~/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b001/ -importpath github.com/moovweb/gokogiri/xml -- -I/usr/include/libxml2 -I $WORK/b001/ -g -O2 ./document.go ./fragment.go ./node.go ./nodeset.go ./text.go
github.com/moovweb/gokogiri/xml
./document.go:330:19: identifier "_Ctype_struct__xmlDoc" may conflict with identifiers generated by cgo
temprcorrected temporary correction:
diff --git a/xml/document.go b/xml/document.go
index 5645239..d0986b0 100644
--- a/xml/document.go
+++ b/xml/document.go
@@ -327,7 +327,7 @@ func (document *XmlDocument) CreateTextNode(data string) (text *TextNode) {
dataPtr := unsafe.Pointer(&dataBytes[0])
nodePtr := C.xmlNewText((*C.xmlChar)(dataPtr))
if nodePtr != nil {
- nodePtr.doc = (*_Ctype_struct__xmlDoc)(document.DocPtr())
+ nodePtr.doc = (*C.xmlDoc)(document.DocPtr())
text = NewNode(unsafe.Pointer(nodePtr), document).(*TextNode)
}
return
I have the same problem when compile it