mischov / meeseeks_html5ever

Meeseeks-specific NIF binding of html5ever using Rustler.
Apache License 2.0
10 stars 15 forks source link

Rustler NIFs don't compile on m1 macbooks #49

Closed PabloG6 closed 2 years ago

PabloG6 commented 2 years ago

I'm attempting to compile a nif on m1 macbook and i seem to be getting the following error:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "arm64" "-L" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.0.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.1.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.10.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.11.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.12.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.13.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.14.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.15.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.2.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.3.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.4.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.5.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.6.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.7.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.8.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.9.rcgu.o" "-o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/libchacha20.dylib" "-Wl,-exported_symbols_list,/var/folders/dt/m_txjf8n4pz6lk172r5mvllc0000gn/T/rustcSDfq7t/list" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.51lttcmo14u0j1wn.rcgu.o" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs" "-L" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps" "-L" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/librustler-c7b8861dbac0aea6.rlib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/liblazy_static-cdae5297f94b2fc0.rlib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/librustler_sys-6ffb53a8f5bb9814.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-a77d2ee571f558e4.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-b9303f5dcd4c8d61.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-ae5454bb02d34cb7.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-074193e7ccb12f2d.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-ba7e4c687a24d092.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-592dc2260cf64a27.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-95abce77d407cda5.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-6d0f3b01c36286cc.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-07ad8f4801703872.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-e33a663a2dcce97d.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-d02e2e94e82428e3.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-9911d63dc36d4937.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-f2cc3399f2e93551.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-e12e04ef43bf5ffa.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-d8b74547953a18ba.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv"
  = note: Undefined symbols for architecture arm64:
            "_enif_schedule_nif", referenced from:
                rustler::codegen_runtime::NifReturned::apply::h66ebfff8d05e2be3 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.9.rcgu.o)
            "_enif_make_copy", referenced from:
                rustler::term::Term::in_env::hf82d192ed878f0fb in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.13.rcgu.o)
            "_enif_free_env", referenced from:
                _$LT$rustler..env..OwnedEnv$u20$as$u20$core..ops..drop..Drop$GT$::drop::h07a9eab9739be7ff in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.2.rcgu.o)
            "_enif_alloc_env", referenced from:
                rustler::env::OwnedEnv::new::h6e3186f16a7913f8 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.2.rcgu.o)
            "_enif_make_badarg", referenced from:
                rustler::wrapper::exception::raise_badarg::h4ed8df67b930db8a in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.7.rcgu.o)
            "_enif_make_tuple_from_array", referenced from:
                rustler::wrapper::tuple::make_tuple::hcf60ca038b5c25bd in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.12.rcgu.o)
            "_enif_make_atom_len", referenced from:
                rustler::wrapper::atom::make_atom::h88ec94fbc80324b6 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.12.rcgu.o)
            "_enif_make_long", referenced from:
                rustler_sys::rustler_sys_api::enif_make_int64::h7a6e5230b7325758 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.15.rcgu.o)
            "_enif_raise_exception", referenced from:
                rustler::wrapper::exception::raise_exception::h0c9e9aa57b5d9089 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.7.rcgu.o)
            "_enif_get_long", referenced from:
                rustler_sys::rustler_sys_api::enif_get_int64::he084276bb6f8fc53 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.15.rcgu.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error; 1 warning emitted

error: could not compile `chacha20`

To learn more, run the command again with --verbose.
pablogrant@Pablos-MacBook-Air src % cargo build
   Compiling chacha20 v0.1.0 (/Users/pablogrant/elixir-projects/paseto/native/chacha20)
warning: function is never used: `main`
 --> src/lib.rs:5:4
  |
5 | fn main() {
  |    ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.35s
pablogrant@Pablos-MacBook-Air src % cargo build
   Compiling chacha20 v0.1.0 (/Users/pablogrant/elixir-projects/paseto/native/chacha20)
warning: function is never used: `main`
 --> src/lib.rs:5:4
  |
5 | fn main() {
  |    ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "arm64" "-L" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.0.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.1.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.10.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.11.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.12.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.13.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.14.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.15.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.2.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.3.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.4.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.5.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.6.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.7.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.8.rcgu.o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.chacha20.6k3uwcp7-cgu.9.rcgu.o" "-o" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/libchacha20.dylib" "-Wl,-exported_symbols_list,/var/folders/dt/m_txjf8n4pz6lk172r5mvllc0000gn/T/rustcpGmofO/list" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/chacha20.51lttcmo14u0j1wn.rcgu.o" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs" "-L" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps" "-L" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/librustler-c7b8861dbac0aea6.rlib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/liblazy_static-cdae5297f94b2fc0.rlib" "/Users/pablogrant/elixir-projects/paseto/native/chacha20/target/debug/deps/librustler_sys-6ffb53a8f5bb9814.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-a77d2ee571f558e4.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-b9303f5dcd4c8d61.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-ae5454bb02d34cb7.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-074193e7ccb12f2d.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-ba7e4c687a24d092.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-592dc2260cf64a27.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-95abce77d407cda5.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-6d0f3b01c36286cc.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-07ad8f4801703872.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-e33a663a2dcce97d.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-d02e2e94e82428e3.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-9911d63dc36d4937.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-f2cc3399f2e93551.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-e12e04ef43bf5ffa.rlib" "/Users/pablogrant/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-d8b74547953a18ba.rlib" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv"
  = note: Undefined symbols for architecture arm64:
            "_enif_schedule_nif", referenced from:
                rustler::codegen_runtime::NifReturned::apply::h66ebfff8d05e2be3 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.9.rcgu.o)
            "_enif_make_copy", referenced from:
                rustler::term::Term::in_env::hf82d192ed878f0fb in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.13.rcgu.o)
            "_enif_free_env", referenced from:
                _$LT$rustler..env..OwnedEnv$u20$as$u20$core..ops..drop..Drop$GT$::drop::h07a9eab9739be7ff in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.2.rcgu.o)
            "_enif_alloc_env", referenced from:
                rustler::env::OwnedEnv::new::h6e3186f16a7913f8 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.2.rcgu.o)
            "_enif_make_badarg", referenced from:
                rustler::wrapper::exception::raise_badarg::h4ed8df67b930db8a in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.7.rcgu.o)
            "_enif_make_tuple_from_array", referenced from:
                rustler::wrapper::tuple::make_tuple::hcf60ca038b5c25bd in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.12.rcgu.o)
            "_enif_make_atom_len", referenced from:
                rustler::wrapper::atom::make_atom::h88ec94fbc80324b6 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.12.rcgu.o)
            "_enif_make_long", referenced from:
                rustler_sys::rustler_sys_api::enif_make_int64::h7a6e5230b7325758 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.15.rcgu.o)
            "_enif_raise_exception", referenced from:
                rustler::wrapper::exception::raise_exception::h0c9e9aa57b5d9089 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.7.rcgu.o)
            "_enif_get_long", referenced from:
                rustler_sys::rustler_sys_api::enif_get_int64::he084276bb6f8fc53 in librustler-c7b8861dbac0aea6.rlib(rustler-c7b8861dbac0aea6.rustler.2a6b77nr-cgu.15.rcgu.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error; 1 warning emitted
mischov commented 2 years ago

Please provide information about versions (for Elixir, Erlang/OTP, Rust, meeseeks, meeseeks_html5ever) when submitting issues like this.

That said, a similar issue was fixed in meeseeks_html5ever version 0.13.1, so I would ensure you're using that.

Edit: I can't tell if you're asking in specific to using meeseeks or if you just need help compiling some other Rustler NIF on M1. If it's the latter the issue linked above contains the solution.