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

[Go] Cross Build Failures with version 12.0.1 #36052

Closed
ShourieG opened this issue Jun 13, 2023 · 3 comments · Fixed by #36066
Closed

[Go] Cross Build Failures with version 12.0.1 #36052

ShourieG opened this issue Jun 13, 2023 · 3 comments · Fixed by #36066
Assignees
Milestone

Comments

@ShourieG
Copy link

ShourieG commented Jun 13, 2023

Describe the bug, including details regarding any error messages, version, and platform.

We are trying to use the arrow go library to create a custom parquet reader but encountering cross build errors in CI even after upgrading to version 12.0.1 .

errors:

>> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=oa64-clang, CXX=oa64-clang++, GOARCH=arm64, GOARM=, GOOS=darwin, PLATFORM_ID=darwin-arm64]

 # github.com/apache/arrow/go/v12/parquet/internal/utils
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:230:18: undefined: unpack32
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:274:3: undefined: BytesToBools
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:318:18: undefined: unpack32
 note: module requires Go 1.20

The stack is using go 1.19 currently. Is there any way to fix these issues without upgrading to Go 1.20 ?

Component(s)

Go

@zeroshade
Copy link
Member

So I'm confused by this failure, we have CI builds which build on darwin arm64 successfully with go1.18.

I'm not familiar with the mage cross build utility. Can you link to any documentation or get the raw go command used for building?

@zeroshade
Copy link
Member

In the meantime, can you try building with the noasm tag?

@ShourieG
Copy link
Author

ShourieG commented Jun 14, 2023

@zeroshade I revisited the build process in our CI and the failures seem to occur with x86 platforms linux/386 and windows/386

github.com/apache/arrow/go/v12/parquet/internal/utils
/go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:230:18: undefined: unpack32
/go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:274:3: undefined: BytesToBools
/go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:318:18: undefined: unpack32
note: module requires Go 1.20
Error: running "go build -o build/golang-crossbuild/filebeat-linux-386 -buildmode pie -trimpath -tags=withjournald -ldflags -s -X github.com/elastic/beats/v7/libbeat/version.buildTime=2023-06-14T10:33:13Z -X github.com/elastic/beats/v7/libbeat/version.commit=4b458e0fa9888c53f02193fac70661e5c7c0d30a" failed with exit code 2
Error: failed building for linux/386: exit status 2
failed building for linux/386: exit status 2

github.com/apache/arrow/go/v12/parquet/internal/utils
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:230:18: undefined: unpack32
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:274:3: undefined: BytesToBools
 /go/pkg/mod/github.com/apache/arrow/go/v12@v12.0.1-0.20230605094802-c153c6d36ccf/parquet/internal/utils/bit_reader.go:318:18: undefined: unpack32
 note: module requires Go 1.20
 Error: running "go build -o build/golang-crossbuild/filebeat-windows-386.exe -buildmode pie -trimpath -ldflags -s -extldflags=-Wl,--nxcompat -X github.com/elastic/beats/v7/libbeat/version.buildTime=2023-06-13T20:51:44Z -X github.com/elastic/beats/v7/libbeat/version.commit=c92bf31abdfba69df79cf64aea36cfc425b305f0" failed with exit code 2
 Error: failed building for windows/386: exit status 2
 failed building for windows/386: exit status 2

So my initial assumption of the build failing on linux/amd64 platforms was wrong. Even after upgrading to v13 of the library did not seem to resolve this build failure. Seems like some issue on 32 bit systems.

zeroshade added a commit to zeroshade/arrow that referenced this issue Jun 14, 2023
zeroshade added a commit that referenced this issue Jun 14, 2023
### Rationale for this change
It looks like #35133 only addressed 32-bit build failures in the Arrow library but didn't address the Parquet library failing to build on 32-bit systems. So this fixes building the Go Parquet library for GOARCH=386

### What changes are included in this PR?
Simplify and clean up build tags and specialized asm in Go Parquet library so that we don't need to keep adding new files explicitly for architectures that we didn't generate optimized assembly for. So we set up the appropriate defaults so that those architectures will default to the pure go implementation properly.

Also fixes the usage of `math.Uint32` so that it isn't seen as an untyped int constant which would overflow on 32-bit architectures.

### Are these changes tested?
Yes, added a small workflow that builds the Go arrow and parquet libraries with `GOARCH=386`.

* Closes: #36052

Authored-by: Matt Topol <zotthewizard@gmail.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
@zeroshade zeroshade added this to the 13.0.0 milestone Jun 14, 2023
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.

2 participants