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

Open
josharian opened this issue Jan 9, 2020 · 2 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

What I did:

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

Result:

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 The path to resolution is known, but the work has not been done. label Jan 9, 2020
@jayconrod jayconrod added this to the Go1.15 milestone Jan 9, 2020
@jayconrod
Copy link
Contributor

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
@ianlancetaylor
Copy link
Contributor

Moving to backlog milestone.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.15, Backlog Jun 16, 2020
@ianlancetaylor ianlancetaylor added the GoCommand cmd/go label Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants