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

Invalid .as_ptr() type casts on some arm platforms #1795

Open
maxwnewcomer opened this issue Dec 31, 2024 · 0 comments · May be fixed by #1796
Open

Invalid .as_ptr() type casts on some arm platforms #1795

maxwnewcomer opened this issue Dec 31, 2024 · 0 comments · May be fixed by #1796

Comments

@maxwnewcomer
Copy link

Describe the bug
When compiling mayastor with an arm compatible version of spdk-rs (openebs/spdk-rs#72), mayastor still fails to build due to invalid to_ptr() typecasts, one example shown here:

ftl_conf.name = ftl_dev_name.as_ptr() as *mut i8;

On some platforms, as noted in the CString docs, are actually represented by u8 and not i8 resulting in

error[E0308]: mismatched types
   --> io-engine/src/bdev/ftl.rs:213:25
    |
213 |         ftl_conf.name = ftl_dev_name.as_ptr() as *mut i8;
    |         -------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
    |         |
    |         expected due to the type of this binding
    |
    = note: expected raw pointer `*mut u8`
               found raw pointer `*mut i8`

in multiple places (including libnvme-rs + io-engine compilation)

To Reproduce

  1. Access a linux/aarch64 machine
  2. Pull develop mayastor branch
  3. Re-point spdk-rs submodule to fork at above linked issue
  4. nix-shell
  5. cargo build

Expected behavior

Full compilation!

OS info (please complete the following information):

Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04

Mayastor: 687da6c

@maxwnewcomer maxwnewcomer linked a pull request Dec 31, 2024 that will close this issue
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 a pull request may close this issue.

1 participant