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

Assembly files not classified correctly, based on cgo mode #2006

Closed
jayconrod opened this issue Mar 26, 2019 · 2 comments · Fixed by #3652
Closed

Assembly files not classified correctly, based on cgo mode #2006

jayconrod opened this issue Mar 26, 2019 · 2 comments · Fixed by #3652

Comments

@jayconrod
Copy link
Contributor

What version of rules_go are you using?

0.18.1

What version of Bazel are you using?

0.23.2

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

Yes

What did you do?

//tests/legacy/build_constraints:go_default_test is incorrect. It includes Go assembly files in a package with cgo.

What did you expect to see?

Go assembly sources should be rejected with a message like package using cgo has Go assembly file asm_linux.s. Both .s and .S files should be included in the build and should be assembled with the C compiler. This should only happen for packages with cgo = True when cgo is enabled.

What did you see instead?

Go assembly sources are assembled with the Go assembler. .S files should not be included in the build unless cgo = True and cgo is enabled.

@jsharpe
Copy link
Member

jsharpe commented Jun 8, 2023

This happens for datadog/zstd - I hit this when using gazelle to generate deps for ethereum-go : this is the workaround in that case: https://github.com/aspect-build/rules_sol/pull/8/files#diff-1f2c31b701f066691b4a4024644f86e092ab731eb81cc5d6282017fe485082ae

@fmeum
Copy link
Member

fmeum commented Jul 24, 2023

If we can't fix the issue in Gazelle, we could add the affected Go repos to the BCR with the fixing patches applied, as we did for circl.

fmeum pushed a commit that referenced this issue Aug 12, 2023
…3652)

The native "go build" tool compiles assembly in a Cgo package with
the C compiler, and compiles assembly in a pure Go package with the
Go assembler. The build_constraints test previously mixed Go
assembler files with Cgo files. This caused the native go test to
fail with:

package using cgo has Go assembly file asm_linux_amd64.s

Splitting this into two separate packages fixes this.

This problem was reported in:
#2006

This will fix failing tests in my attempt to fix that issue:
#3648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants