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

identifier "_Ctype_struct__xmlDoc" may conflict with identifiers generated by cgo #100

Open
joaolsilva opened this issue Apr 10, 2019 · 4 comments

Comments

@joaolsilva
Copy link

joaolsilva commented Apr 10, 2019

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?

@joaolsilva
Copy link
Author

See Pull Request #97

@Archie1978
Copy link

Archie1978 commented Mar 29, 2020

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

@Archie1978
Copy link

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

@uuhnaut69
Copy link

I have the same problem when compile it

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

3 participants