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

Fix 32-bit build #158

Merged
merged 2 commits into from
Dec 19, 2023
Merged

Fix 32-bit build #158

merged 2 commits into from
Dec 19, 2023

Conversation

mem
Copy link
Contributor

@mem mem commented Oct 31, 2023

When trying to build for 32-bit ARM (linux/arm), you get:

pkg/remote/client.go:120:35: cannot use 0xffffffff (untyped int constant 4294967295) as int value in argument to fmt.Errorf (overflows)

Pass the constant as unsigned 64-bit integer, which is what the underlying snappy code is doing (it's casting the argument to an uint64 and comparing against 0xffffffff, which in Go means it's comparing against uint64(0xffffffff)). Since this is just an error message, it shouldn't matter, but let's be consistent.

When trying to build for 32-bit ARM (linux/arm), you get:

```
pkg/remote/client.go:120:35: cannot use 0xffffffff (untyped int constant 4294967295) as int value in argument to fmt.Errorf (overflows)
```

Pass the constant as unsigned 64-bit integer, which is what the
underlying snappy code is doing (it's casting the argument to an uint64
and comparing against 0xffffffff, which in Go means it's comparing
against uint64(0xffffffff)). Since this is just an error message, it
shouldn't matter, but let's be consistent.

Signed-off-by: Marcelo E. Magallon <[email protected]>
@mem mem requested a review from a team as a code owner October 31, 2023 20:01
@mem mem requested review from mstoykov and codebien and removed request for a team October 31, 2023 20:01
@mem
Copy link
Contributor Author

mem commented Oct 31, 2023

Sorry about recreating the PR instead of reopening the old one (#132). My bad.

I reworded the commit message to reflect the fact that this is not specific to ARM.

The reason why I would like to have this is because I would like to run k6 on linux/arm (Raspberry Pi and whatnot).

Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mem,
I think my comment on the previous PR #132 (comment) is still valid, can you take a look into it, please?

@@ -117,7 +117,7 @@ func newWriteRequestBody(series []*prompb.TimeSeries) ([]byte, error) {
}
if snappy.MaxEncodedLen(len(b)) < 0 {
return nil, fmt.Errorf("the protobuf message is too large to be handled by Snappy encoder; "+
"size: %d, limit: %d", len(b), 0xffffffff)
"size: %d, limit: %d", len(b), uint64(0xffffffff))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"size: %d, limit: %d", len(b), uint64(0xffffffff))
"size: %d, limit: %d", len(b), math.MaxUint32)

I think something like that could be better as self-documenting code so we don't have to remember why we did it. @mem Can you try if it works on your 32-bit arch, please?

@codebien codebien merged commit 4737495 into main Dec 19, 2023
10 checks passed
@codebien codebien deleted the mem/fix-32-bit-build branch December 19, 2023 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants