fosskers / aura

A multilingual package manager for Arch Linux and the AUR.
https://fosskers.github.io/aura/
GNU General Public License v3.0
1.75k stars 113 forks source link

aura doesn't build on arm #939

Open AlexAegis opened 1 month ago

AlexAegis commented 1 month ago

Running cargo install aura-pm on AARM64 results in the following error.

error[E0308]: mismatched types
   --> /home/alex/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-4.0.1/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/alex/.local/share/cargo/registry/src/index.crates.io-6f17d22bba15001f/alpm-4.0.1/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/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/option.rs:582:5

For more information about this error, try `rustc --explain E0308`.
error: could not compile `alpm` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `aura-pm v4.0.7`, intermediate artifacts can be found at `/tmp/cargo-installKVzieV`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

This is known in alpm.rs and paru too, and I've seen this (https://github.com/archlinux/alpm.rs/issues/35#issuecomment-2008611498) comment recommending enabling a feature, that would introduce some extra crates but at least it would build on arm, I'm not sure what the tradeoffs are if any but I tried it, cloned this repo, added this feature to both crates here and the build was indeed successful on arch.

 [dependencies]
-alpm = "3.0"
+alpm = { version = "3.0", features = [ "generate" ] }
fosskers commented 1 month ago

Thanks for bringing this to my attention.

fosskers commented 2 weeks ago

This apparently creates a new dependency on clang, which is somewhat heavy (200+ mb).

AlexAegis commented 2 weeks ago

And if it's only enabled for that one target? To not impose this on x86 users.

fosskers commented 2 weeks ago

It would complicate the PKGBUILD but I believe it's possible.