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 arm build of malloc_stats_print #407

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Dec 17, 2024

What is changed and how it works?

Issue Number: Close #xxx

What's Changed:


There is a error on arm build

error[E0308]: mismatched types
   --> proxy_components/proxy_ffi/src/jemalloc_utils.rs:186:26
    |
186 |                     Some(write_to_string),
    |                     ---- ^^^^^^^^^^^^^^^ expected fn pointer, found fn item
    |                     |
    |                     arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, *const i8)`
                  found fn item `extern "C" fn(_, *const u8) {write_to_string}`
help: the type constructed contains `extern "C" fn(*mut c_void, *const u8) {write_to_string}` due to the type of the argument passed
   --> proxy_components/proxy_ffi/src/jemalloc_utils.rs:186:21
    |
186 |                     Some(write_to_string),
    |                     ^^^^^---------------^
    |                          |
    |                          this argument influences the type of `Some`
note: tuple variant defined here
   --> /root/.rustup/toolchains/nightly-2023-12-28-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:578:5
    |
578 |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^^^

error[E0308]: mismatched types
   --> proxy_components/proxy_ffi/src/jemalloc_utils.rs:188:21
    |
185 |                 malloc_stats_print(
    |                 ------------------ arguments to this function are incorrect
...
188 |                     ops_str,
    |                     ^^^^^^^ expected `*const i8`, found `*const u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`
note: function defined here
   --> proxy_components/proxy_ffi/src/jemalloc_utils.rs:23:12
    |
23  |     pub fn malloc_stats_print(
    |            ^^^^^^^^^^^^^^^^^^

The fix is to use c_char instead of u8 or i8.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note


a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
@ti-chi-bot ti-chi-bot bot added the size/XS label Dec 17, 2024
a
Signed-off-by: Calvin Neo <calvinneo1995@gmail.com>
Copy link

ti-chi-bot bot commented Dec 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Dec 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-17 08:44:10.292197442 +0000 UTC m=+946440.380999981: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit afe805f into pingcap:raftstore-proxy Dec 17, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants