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 FFI compatibility issue when building on macOS #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

val-ms
Copy link
Contributor

@val-ms val-ms commented Jun 14, 2024

When building on an Apple-silicon (ARM) Mac device, the following error occurs:

error[E0308]: mismatched types
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/clamav-async-0.2.0/src/engine.rs:56:36 |
|                     CStr::from_ptr(c_virname).to_string_lossy().to_string(),
|                     -------------- ^^^^^^^^^ expected `*const u8`, found `*const i8`
|                     |
|                     arguments to this function are incorrect
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: associated function defined here
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ffi/c_str.rs:274:25

The issue is using 'i8' directly rather than the FFI type which is c_char.

When building on an Apple-silicon (ARM) Mac device, the following error
occurs:

error[E0308]: mismatched types
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/clamav-async-0.2.0/src/engine.rs:56:36
|
|                     CStr::from_ptr(c_virname).to_string_lossy().to_string(),
|                     -------------- ^^^^^^^^^ expected `*const u8`, found `*const i8`
|                     |
|                     arguments to this function are incorrect
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: associated function defined here
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ffi/c_str.rs:274:25

The issue is using 'i8' directly rather than the FFI type which is
c_char.
@val-ms val-ms requested a review from rsundriyal June 14, 2024 20:37
@val-ms val-ms force-pushed the fix-mac-arm-i8-build-issue branch from 7fa2f10 to a7d519a Compare June 14, 2024 20:43
@rntrp
Copy link

rntrp commented Feb 15, 2025

Hi there! Is there any chance to get this PR merged? I'm having the exact same issue for Debian on arm64. Using c_char instead of i8 seems to remain the most common workaround, cf. 113735.

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.

2 participants