Skip to content

Conversation

magneticflux-
Copy link
Contributor

Fixes a compilation error when testing on aarch64-linux platforms. See commit and issue for details. Let's finish off this distro packaging annoyance for good 😆

Closes #5495

Checklist

Dear Author 👋, the following checks should be completed (or explicitly dismissed) before merging.

  • ✏️ Write a PR description, regardless of triviality, to include the value of this PR
  • 🔗 Reference related issues
  • 🏃 Test cases are included to exercise the new code
  • 🧪 If new packages are being introduced to stdlib, link to Working Group discussion notes and ensure it lands under experimental/
  • 📖 If language features are changing, ensure docs/Spec.md has been updated

Dear Reviewer(s) 👋, you are responsible (among others) for ensuring the completeness and quality of the above before approval.

@mhilton
Copy link
Contributor

mhilton commented Jun 11, 2025

The code change looks fine. Could you please run make generate to rebuild buildinfo.gen.go and keep CI happy.

This test uses the `c_char` type and tried to negate it. This works on
`x86_64` because `c_char` is signed, but this signedness is explicitly
_implementation-defined_ in the standard. In fact, on `aarch64-linux`,
`c_char` is unsigned, and in Rust unsigned values cannot be negated. To
work around this, we must patch over this piece of ancient esoterica by
telling the Rust compiler _exactly_ what we want to do. We specify that
the literal is an `i8`, and then explicitly cast to `c_char`. Rust
safely defines casts between signed and unsigned types to behave like
two's complement, so `aarch64` systems will interpret it as `-61 + 256 =
195`. This does not appear to break the test :).

Closes #5495
@crepererum
Copy link

thanks

@crepererum crepererum merged commit 6fda6d2 into influxdata:master Jun 12, 2025
7 checks passed
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.

Test compile failure on aarch64-linux: std::os::raw::c_char is unsigned
3 participants