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

cgocall doesn't work #2396

Open
dtbartle opened this issue Mar 6, 2020 · 2 comments
Open

cgocall doesn't work #2396

dtbartle opened this issue Mar 6, 2020 · 2 comments

Comments

@dtbartle
Copy link

dtbartle commented Mar 6, 2020

What version of rules_go are you using?

0.22.1

What version of gazelle are you using?

0.19.0

What version of Bazel are you using?

2.2.0

Does this issue reproduce with the latest releases of all the above?

Yes.

What operating system and processor architecture are you using?

Mac/Darwin

Any other potentially useful information about your toolchain?

What did you do?

Enabled cgocall analyzer via nogo.

What did you expect to see?

No errors.

What did you see instead?

I received an error that the original go file can't be opened. This is possibly because of #2271.

I'm curious if this is something specific to my setup, or if anyone has gotten this to work. If not, it might make sense to remove cgocall from the "tools_nogo" rule until this is fixed?

@jayconrod
Copy link
Contributor

This is a bug, not specific to your setup. I don't think it's related to #2271. The GoCompilePkg action is responsible for running nogo, and it has access to both the raw cgo files and the generated go files (it's also responsible for running cgo). However, it only passes the generated go files to nogo.

I'm not exactly sure how the raw files need to be plumbed in, and unfortunately I don't have bandwidth to look into it right now. I'll remove cgocall from tools_nogo until it can be fixed.

@sluongng
Copy link
Contributor

@emmaxy I wonder if you could take a look at this issue after #3770

My original hope in #3770 (comment) was to turn on cgocall after your PR is merged. But it seems that cgocall could still fail in some cases.

Here is an example failure in buildbuddy code base with cgocall turned on

compilepkg: nogo: errors found by nogo during build-time code analysis:
analyzer "cgocall" failed: can't parse raw cgo file: open /tmp/rules_go_work-128458798/cgo/github.com/buildbuddy-io/buildbuddy/enterprise/server/remote_execution/copy_on_write/cow_cgo_testutil/75e0fdb9-ef74-46fa-ab50-4c0915bdc144/enterprise/server/remote_execution/copy_on_write/cow_cgo_testutil/cow_cgo_testutil.go: no such file or directory

for this file https://github.com/buildbuddy-io/buildbuddy/blob/ed17796cadb4347401f7b3cfbb7223a973fb32bf/enterprise/server/remote_execution/copy_on_write/cow_cgo_testutil/cow_cgo_testutil.go#L1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants