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

Compilation error on aarch64 #44

Open
gyscos opened this issue Mar 19, 2024 · 3 comments
Open

Compilation error on aarch64 #44

gyscos opened this issue Mar 19, 2024 · 3 comments

Comments

@gyscos
Copy link

gyscos commented Mar 19, 2024

While trying to compile paru for aarch64, it seems compilation fails here:

error[E0308]: mismatched types
   --> /home/alarm/.cargo/git/checkouts/alpm.rs-a0070a235cf20bfa/306342e/alpm/src/cb.rs:244:60
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ---- ^^ expected fn pointer, found fn item
    |                                                       |
    |                                                       arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, _, _, *mut __va_list_tag)`
                  found fn item `extern "C" fn(_, _, _, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}`
help: the type constructed contains `extern "C" fn(*mut c_void, u32, *const u8, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}` due to the type of the argument passed
   --> /home/alarm/.cargo/git/checkouts/alpm.rs-a0070a235cf20bfa/306342e/alpm/src/cb.rs:244:55
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ^^^^^--^
    |                                                            |
    |                                                            this argument influences the type of `Some`
note: tuple variant defined here
   --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:578:5

This seems to be using the latest commit (306342e).

$ rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)
@gyscos
Copy link
Author

gyscos commented Mar 19, 2024

And indeed, alpm-sys defines:

alpm.rs/alpm-sys/src/ffi.rs

Lines 3322 to 3329 in adad998

pub type alpm_cb_log = ::std::option::Option<
unsafe extern "C" fn(
ctx: *mut ::std::os::raw::c_void,
level: alpm_loglevel_t,
fmt: *const ::std::os::raw::c_char,
args: *mut __va_list_tag,
),
>;

Regardless of architecture, while

alpm.rs/alpm/src/cb.rs

Lines 13 to 16 in adad998

#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
pub type VaList = *mut __va_list_tag;
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub type VaList = va_list;

defines it differently on arm and aarch64.

@mipimipi
Copy link

Same error here

@peterneutron
Copy link

Duplicate. See #35

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

No branches or pull requests

3 participants