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

cmd/go: include source dir in cache key when ${SRCDIR} is present in cgo header #36471

josharian opened this issue Jan 9, 2020 · 2 comments
GoCommand NeedsFix


Copy link

@josharian josharian commented Jan 9, 2020

What I did:

  • have a project including cgo headers using ${SRCDIR}
  • move that project to a new directory
  • build


ld: warning: directory not found for option '-L/Users/josh/...redacted...

The redacted directory is the previous directory pointed to by the ${SRCDIR} directive in the cgo sources.

After a go clean -cache, the error disappeared.

I suspect that cmd/go's caching may be too effective here. It probably doesn't take into account the absolute path containing the project, but it may need to when the ${SRCDIR} cgo directive is present.

cc @bcmills @jayconrod

@jayconrod jayconrod added the NeedsFix label Jan 9, 2020
@jayconrod jayconrod added this to the Go1.15 milestone Jan 9, 2020
Copy link

@jayconrod jayconrod commented Jan 9, 2020

When this is fixed, we should also test with -trimpath. When -trimpath is passed, most paths are not included in the cache key, but I think ${SRCDIR} needs to be there in any case.

@bcmills bcmills changed the title cmd/go: include source dir in cache key when ${SRCDIR} present in cgo header? cmd/go: include source dir in cache key when ${SRCDIR} is present in cgo header Jan 10, 2020
Copy link

@ianlancetaylor ianlancetaylor commented Jun 16, 2020

Moving to backlog milestone.

@ianlancetaylor ianlancetaylor removed this from the Go1.15 milestone Jun 16, 2020
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Jun 16, 2020
@ianlancetaylor ianlancetaylor added the GoCommand label Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
GoCommand NeedsFix
None yet

No branches or pull requests

3 participants