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

x/tools/cmd/gorename: cgo pkg-config not supported by loader(?) #13526

Closed
evmar opened this issue Dec 7, 2015 · 9 comments
Closed

x/tools/cmd/gorename: cgo pkg-config not supported by loader(?) #13526

evmar opened this issue Dec 7, 2015 · 9 comments
Assignees
Milestone

Comments

@evmar
Copy link

@evmar evmar commented Dec 7, 2015

(Sorry for the terrible issue description, I don't really understand all the pieces.)

When I use gorename on a project that transitively depends on a cgo library, I get the error:

cgo pkg-config not supported

I get this in go version go1.4.2 linux/amd64 but also on my other box which has a newer version of go.

I hear that @alandonovan knows about this. I find the error in this module:
https://code.google.com/p/go/source/browse/go/loader/cgo.go?repo=tools

@ianlancetaylor ianlancetaylor changed the title cgo pkg-config not supported by loader(?) x/tools/gorename: cgo pkg-config not supported by loader(?) Dec 8, 2015
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Dec 8, 2015
@ianlancetaylor ianlancetaylor changed the title x/tools/gorename: cgo pkg-config not supported by loader(?) x/tools/cmd/gorename: cgo pkg-config not supported by loader(?) Dec 8, 2015
@evmar
Copy link
Author

@evmar evmar commented Dec 8, 2015

For what it's worth, I'd be fine with any simple workarounds you have -- the cgo module is not important to the code I'm editing. For example if I could check in the cgo-generated files to fix this, or use a build tag to remove the cgo files when using gorename, etc... (Obviously just fixing it is preferable though if that's easy.)

...which gives me an idea! I might try inlining the results of pkg-config into cflags/ldflags on the relevant source.

@leolara
Copy link

@leolara leolara commented Dec 15, 2015

I have the same problem.

gorename output:



cgo pkg-config not supported
cgo pkg-config not supported
cgo pkg-config not supported
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/xml/attribute.go:13:3: undeclared name: XmlNode
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/xml/cdata.go:11:3: undeclared name: XmlNode
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/xml/comment.go:4:3: undeclared name: XmlNode
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/xml/element.go:4:3: undeclared name: XmlNode
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/xml/pi.go:4:3: undeclared name: XmlNode
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/gokogiri.go:21:38: undeclared name: html
/Users/leo/src/mygo/src/github.com/moovweb/gokogiri/gokogiri.go:33:37: XmlDocument not declared by package xml
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:12:11: Node not declared by package xml
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:80:41: undeclared name: xpath
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:18:19: undeclared name: xpath
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:18:38: undeclared name: xpath
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:31:22: Node not declared by package xml
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:67:32: undeclared name: xpath
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:67:55: Node not declared by package xml
/Users/leo/src/mygo/src/github.com/DSrcl/Microdata-Parser/parser.go:129:24: Node not declared by package xml

@oryband
Copy link

@oryband oryband commented Dec 16, 2015

same for me with https://github.com/abh/geoip

While scanning Go workspace:
// some text
GeoIP not declared by package geoip
Open not declared by package geoip

even though these functions are declared by this package.

@alandonovan
Copy link
Contributor

@alandonovan alandonovan commented Jan 5, 2016

This is a bug in golang.org/x/tools/go/loader. The fix requires adding logic to the runCgo function so that it executes pkg-config, following the logic in the go build command (see $GOROOT/src/cmd/go/build.go).

@flowchartsman
Copy link

@flowchartsman flowchartsman commented Jan 20, 2016

Is there an issue for this bug, or is this the issue? Is there a patch somewhere that I might be able to apply locally while waiting for this to make it into the release?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 20, 2016

@alaska This is the issue. I don't think there is an existing patch. Alan outlined above what needs to happen.

@yonderblue
Copy link

@yonderblue yonderblue commented Mar 19, 2016

Any luck here, its been open a while and doesn't seem to be scheduled. I am seeing while trying to use tools like errcheck or unused.

AkihiroSuda added a commit to AkihiroSuda/golang-tools that referenced this issue Mar 25, 2016
@AkihiroSuda
Copy link

@AkihiroSuda AkihiroSuda commented Mar 25, 2016

Patch: https://go-review.googlesource.com/#/c/21121/

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 25, 2016

CL https://golang.org/cl/21121 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.