eraserhd / parinfer-rust

A Rust port of parinfer.
ISC License
531 stars 41 forks source link

build for aarch systems #84

Closed andreyorst closed 1 year ago

andreyorst commented 3 years ago

It would be nice if there was an official library build for aarch systems. Kakoune, Emacs, Vim, and NeoVim are all available in Termux, and it would be great if we could use parinfer-rust there without manually building it. There are several projects that are available in Termux, and built with Rust, such as rg, and fd.

XeroOl commented 8 months ago

I was able to get it to build for termux with very minor changes: (removing the NOLOAD and NODELETE constants that appear to be missing when I attempt to compile on my phone)

src/c_wrapper.rs:

     mod default {
-        use libc::{RTLD_LAZY, RTLD_NOLOAD, RTLD_NODELETE, RTLD_GLOBAL};
+        use libc::{RTLD_LAZY, RTLD_GLOBAL};

-        pub fn first_attempt_flags() -> i32 { RTLD_LAZY|RTLD_NOLOAD|RTLD_GLOBAL|RTLD_NODELETE }
-        pub fn second_attempt_flags() -> i32 { RTLD_LAZY|RTLD_GLOBAL|RTLD_NODELETE }
+        pub fn first_attempt_flags() -> i32 { RTLD_LAZY|RTLD_GLOBAL}
+        pub fn second_attempt_flags() -> i32 { RTLD_LAZY|RTLD_GLOBAL}
     }

With these changes, the code builds and appears to work properly on termux.

If this is interesting for anyone, I can try to look into what these flags are actually doing, put these changes behind an architecture check, and then submit a PR.