archlinux / alpm.rs

Rust bindings for libalpm
GNU General Public License v3.0
112 stars 21 forks source link

Compilation error on aarch64 #44

Open gyscos opened 5 months ago

gyscos commented 5 months ago

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 commented 5 months ago

And indeed, alpm-sys defines:

https://github.com/archlinux/alpm.rs/blob/adad9983f70f49654a5226f5fc6f9e2158e24ea6/alpm-sys/src/ffi.rs#L3322-L3329

Regardless of architecture, while

https://github.com/archlinux/alpm.rs/blob/adad9983f70f49654a5226f5fc6f9e2158e24ea6/alpm/src/cb.rs#L13-L16

defines it differently on arm and aarch64.

mipimipi commented 5 months ago

Same error here

peterneutron commented 5 months ago

Duplicate. See https://github.com/archlinux/alpm.rs/issues/35