Rust-Rustler: rustler — safe Rust bridge for creating Erlang NIF functions

Rustler

Documentation | Getting Started | Example

Build Status

Rustler is a library for writing Erlang NIFs in safe Rust code. That means there should be no ways to crash the BEAM (Erlang VM). The library provides facilities for generating the boilerplate for interacting with the BEAM, handles encoding and decoding of Erlang terms, and catches rust panics before they unwind into C.

The library provides functionality for both Erlang and Elixir, however Elixir is favored as of now.

Features:

  • Safety - The code you write in a Rust NIF should never be able to crash the BEAM.
  • Interop - Decoding and encoding rust values into Erlang terms is as easy as a function call.
  • Type composition - Making a Rust struct encodable and decodable to Erlang or Elixir can be done with a single attribute.
  • Resource objects - Enables you to safely pass a reference to a Rust struct into Erlang code. The struct will be automatically dropped when it's no longer referenced.

Getting started

The easiest way of getting started is the rustler elixir library.

  • Add the rustler elixir library as a dependency of your project.
  • Run mix rustler.new to generate a new NIF in your project. Follow the instructions.
  • If you're already using serde, consider using serde_rustler to easily encode and decode your data types into and from Elixir terms.

NOTE: If you have previously used Rustler, you need to run mix archive.uninstall rustler_installer.ez to remove it before generating the NIF.

What it looks like

This is the code for a minimal NIF that adds two numbers and returns the result.

#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
    a + b
}

rustler::init!("Elixir.Math", [add]);

Supported nif_version

Rustler uses erlang:system_info(nif_version) to detect the supported NIF version of the Erlang/OTP system for which the NIF is to be compiled. It is possible to restrict the NIF version to an older version if the NIF is to be compiled for an older version of Erlang. For example, if the target NIF version should be 2.7 (Erlang/OTP 17.3), this can be defined using an environment variable:

RUSTLER_NIF_VERSION=2.7 mix compile

Community

You can find us in #rustler on freenode or the elixir-lang slack.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments

  • New rustler::init! errors
    New rustler::init! errors

    May 5, 2020

    Please i get this error trying to translate the following to new rustler syntax:

    previous:

    rustler_export_nifs!(
        "Elixir.Xtdlib.Native",
        [
            ("new", 0, new),
            ("send", 2, send),
            ("execute", 2, execute),
            ("recv", 2, receive, SchedulerFlags::DirtyIo),
        ],
        Some(on_load)
    );
    
    error: proc macro panicked
      --> src/lib.rs:91:1
       |
    91 | / rustler::init!(
    92 | |     "Elixir.Xtdlib.Native",
    93 | |     [new, send, execue, recv],
    94 | |     Some(load)
    95 | | );
       | |__^
       |
       = help: message: expected assignment expression (i.e. `load = load`)
    

    I'm not sure how to proceed.

    needs docs 
    Reply
  • Add AsRef for Binary
    Add AsRef for Binary

    May 11, 2020

    This is mostly just for convenience.

    Reply
  • Decoding Maps of arbitrary length
    Decoding Maps of arbitrary length

    Jun 2, 2020

    Rustler Version: 0.22.0-rc.0

    This is perhaps more a question of something I am doing wrong but it doesn't seem like NifMap supports maps of length N > 1. For example trying to decode the following map:

    %{
        1 => %SomeStruct{},
        2 => %SomeStruct{}
       }
    

    Where %SomeStruct{} is appropriately set up in the Nif as NifStruct and can be decoded singularly and the map key is just a u32.

    What's the correct type for a map of arbitrary length? The documentation also only supplies examples for a map with 1 KV pair.

    To be clear I realise I can use MapIterator when it's passed in as part of a NIF function but I am talking about maps that are part of structs, for example:

    #[derive(Clone, Debug, Eq, Hash, NifMap, PartialEq)]
    pub struct Counts {
        id: String,
        count: u32,
    }
    
    #[derive(Clone, Debug, Eq, Hash, NifStruct, PartialEq)]
    #[module = "SomeModule.SomeStruct"]
    pub struct SomeStruct {
        pub r#type: i32,
        pub remaining: u32,
    
        /// An elixir map `%{Counts.id() => pos_integer()}`
        pub counts: Counts,
    }
    
    %SomeStruct{type: 1, remaining: 0, counts: %{"hello" => 12, "world" => 25}}
    

    If I try to make pub counts of type MapIterator I have to put lifetimes everywhere, I assume because it shares the lifetime of the Env

    Reply
  • Implement Encode/Decode for HashMap
    Implement Encode/Decode for HashMap

    Jun 8, 2020

    See #312 .

                                                                                                                                                                                                           
    Reply
  • Binary lost its Copy and Clone impls in 0.21.1 and 0.22
    Binary lost its Copy and Clone impls in 0.21.1 and 0.22

    Jun 9, 2020

    I think by mistake, as putting #[derive(Copy, Clone)] back on it compiles and passes the tests without error on both.

    Reply
  • Readd Copy and Clone on Binary
    Readd Copy and Clone on Binary

    Jun 9, 2020

    Got removed in PR #239, reported in #315.

    I'll port this back to 0.21 if it gets merged.

    I'm not sure why I removed those derives, maybe it was a merge error.

    Reply
  • Support enif_make_map_from_arrays
    Support enif_make_map_from_arrays

    Jan 17, 2019

    This PR adds support for enif_make_map_from_arrays. This requires OTP 21.

    Fix #157.

    Reply
  • Running `mix test` does not work on the first run (needs to compile twice)
    Running `mix test` does not work on the first run (needs to compile twice)

    Jan 19, 2018

    [Modify the `mix.exs` file]
    
    $ mix test
    Compiling NIF crate :rustler_test (native/rustler_test)...
        Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
    Compiling 221 files (.ex)
    
    13:15:37.820 [warn]  The on_load function for module Elixir.RustlerTest returned:
    {:error, {:upgrade, 'Upgrade not supported by this NIF library.'}}
    
    [Tests fail]
    
    [Then, running again works]
    
    $ mix test
    
    [Tests succeed]
    

    To make it work in travis CI I had to compile before running the tests:

     - MIX_ENV=test mix compile
     - mix test || travis_terminate 1
    

    Same issue happens when trying to open the console with: iex -S mix

    Rustler compiler is in the recommended order: compilers: [:rustler, :phoenix, :gettext] ++ Mix.compilers,

    Reply
  • GitHub Actions
    GitHub Actions

    Oct 16, 2019

    An attempt to improve CI. Closes #121 and #160

    Reply
  • Taking a look at html5ever parsing
    Taking a look at html5ever parsing

    Dec 29, 2016

    I did a google and your name came up! Did you ever have a quick stab at this? I have a feeling it would be very useful and much better than :mochiweb. With Rustler it should also be quite safe too.

    The structure that Floki uses for parsed html looks about what we want out of html5ever and fairly simple...

    question 
    Reply
  • Fix build issues on Mac
    Fix build issues on Mac

    Apr 17, 2016

    Not sure if this is a OS X-specific issue:

    Cargo.toml

    [package]
    name = "rustler_test"
    version = "0.1.0"
    authors = []
    
    [lib]
    name = "rustler_test"
    path = "src/nif.rs"
    crate_type = ["dylib"]
    
    [dependencies]
    rustler = "0.8.1"
    rustler_codegen = "0.8.1"
    

    src/nif.rs

    #![feature(plugin)]
    #![plugin(rustler_codegen)]
    
    #[macro_use]
    extern crate rustler;
    use rustler::{ NifEnv, NifTerm, NifResult, NifEncoder };
    
    rustler_export_nifs!(
        "Elixir.RustlerTest",
        [("add", 2, add)],
        None
    );
    
    fn add<'a>(env: &'a NifEnv, args: &Vec<NifTerm>) -> NifResult<NifTerm<'a>> {
        let num1: i64 = try!(args[0].decode());
        let num2: i64 = try!(args[1].decode());
        Ok((num1 + num2).encode(env))
    }
    
    $ multirust run nightly-2016-04-05 mix rustler.check
    Rustler environment verified
    $ multirust run nightly-2016-04-05 cargo build
       Compiling lazy_static v0.1.16
       Compiling easy-plugin v0.3.0
       Compiling aster v0.14.0
       Compiling libc v0.2.10
       Compiling ruster_unsafe v0.4.0
       Compiling rustler v0.8.1
       Compiling rustler_codegen v0.8.1
       Compiling rustler_test v0.1.0 (file:///Users/brendan/code/dev-day/elixir_rustler_test)
    error: linking with `cc` failed: exit code: 1
    note: "cc" "-m64" "-L" "/Users/brendan/.multirust/toolchains/nightly-2016-04-05/lib/rustlib/x86_64-apple-darwin/lib" "/Users/brendan/code/dev-day/elixir_rustler_test/target/debug/rustler_test.0.o" "-o" "/Users/brendan/code/dev-day/elixir_rustler_test/target/debug/librustler_test.dylib" "/Users/brendan/code/dev-day/elixir_rustler_test/target/debug/rustler_test.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/brendan/code/dev-day/elixir_rustler_test/target/debug" "-L" "/Users/brendan/code/dev-day/elixir_rustler_test/target/debug/deps" "-L" "/Users/brendan/.multirust/toolchains/nightly-2016-04-05/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/librustler-12f16f7939d96e54.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/libruster_unsafe-badf32d60ecc0604.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/liblibc-30c6b6751f89189b.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/liblazy_static-5e6d9f365bf63baa.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/libstd-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/libcollections-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/librustc_unicode-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/librand-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/liballoc-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/liballoc_system-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/liblibc-18402db3.rlib" "-Wl,-force_load,/var/folders/z3/g4m3xbnj11q6m76kzg8w683c0000gn/T/rustc.QBlM3AicSUqg/libcore-18402db3.rlib" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib" "-l" "compiler-rt"
    note: Undefined symbols for architecture x86_64:
      "_enif_make_double", referenced from:
          rustler::wrapper::nif_interface::enif_make_double::hd19548d32bb32295 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$f64$u20$as$u20$types..NifEncoder$GT$::encode::h706149e7449ffee2 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$f32$u20$as$u20$types..NifEncoder$GT$::encode::h144f24ce0170a8e0 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_ulong", referenced from:
          ruster_unsafe::enif_get_uint64::h64c3175e0dbcd390 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          ruster_unsafe::enif_get_uint64::h64c3175e0dbcd390 in libruster_unsafe-badf32d60ecc0604.rlib(ruster_unsafe-badf32d60ecc0604.0.o)
      "_enif_make_ulong", referenced from:
          ruster_unsafe::enif_make_uint64::h4fba0e724d8e25b6 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          ruster_unsafe::enif_make_uint64::h4fba0e724d8e25b6 in libruster_unsafe-badf32d60ecc0604.rlib(ruster_unsafe-badf32d60ecc0604.0.o)
      "_enif_make_long", referenced from:
          ruster_unsafe::enif_make_int64::hbc1979f2890ffe9c in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          ruster_unsafe::enif_make_int64::hbc1979f2890ffe9c in libruster_unsafe-badf32d60ecc0604.rlib(ruster_unsafe-badf32d60ecc0604.0.o)
      "_enif_get_uint", referenced from:
          rustler::wrapper::nif_interface::enif_get_uint::h5c5a16f0a01fde37 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u32$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::haf5c58d5060cb07f in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u8$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h3e7e1bef75d03b42 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u16$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h1e7efa45cf0cba98 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_int", referenced from:
          rustler::wrapper::nif_interface::enif_get_int::hc379e848b0f1fa91 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i32$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h1c37e7be14e575ae in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i8$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::ha035f42162eb16a1 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i16$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h5a81998157625a57 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_int", referenced from:
          rustler::wrapper::nif_interface::enif_make_int::h60d93b2ae4a8c8d3 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i32$u20$as$u20$types..NifEncoder$GT$::encode::h7ddd4380fe5dda18 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i8$u20$as$u20$types..NifEncoder$GT$::encode::hdc7675ac9b527c9f in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$i16$u20$as$u20$types..NifEncoder$GT$::encode::hb0da2bfd44111ec8 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_keep_resource", referenced from:
          rustler::wrapper::nif_interface::enif_keep_resource::hcf8953a093156f6c in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_release_resource", referenced from:
          rustler::wrapper::nif_interface::enif_release_resource::hcddf0787bf6dbeeb in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_atom_len", referenced from:
          rustler::wrapper::nif_interface::enif_make_atom_len::he20a8a9702701fff in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_resource", referenced from:
          rustler::wrapper::nif_interface::enif_get_resource::h47d539fa331c39f3 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_resource", referenced from:
          rustler::wrapper::nif_interface::enif_make_resource::hb81c16919c920cad in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_alloc_resource", referenced from:
          rustler::wrapper::nif_interface::enif_alloc_resource::h68237ee990d1cf46 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_uint", referenced from:
          rustler::wrapper::nif_interface::enif_make_uint::hfe8668de47444792 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u32$u20$as$u20$types..NifEncoder$GT$::encode::h868c09d12496aeec in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u8$u20$as$u20$types..NifEncoder$GT$::encode::h11ad232d66e87a7d in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$u16$u20$as$u20$types..NifEncoder$GT$::encode::h201a5388c8670d75 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_map_update", referenced from:
          rustler::wrapper::nif_interface::enif_make_map_update::hf5941f5f4b1d847b in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_map_value", referenced from:
          rustler::wrapper::nif_interface::enif_get_map_value::hc296d9a0bd30c233 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_map_put", referenced from:
          rustler::wrapper::nif_interface::enif_make_map_put::ha859d99862427ecd in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_open_resource_type", referenced from:
          rustler::wrapper::nif_interface::enif_open_resource_type::h12583a80f65f5745 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_new_map", referenced from:
          rustler::wrapper::nif_interface::enif_make_new_map::h907851f26b8541d0 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_badarg", referenced from:
          rustler::wrapper::nif_interface::enif_make_badarg::h4841a4ca720a65e5 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_tuple", referenced from:
          rustler::wrapper::nif_interface::enif_get_tuple::h7fd11d0d72fa7d45 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_long", referenced from:
          ruster_unsafe::enif_get_int64::hebc458f802f3215b in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          ruster_unsafe::enif_get_int64::hebc458f802f3215b in libruster_unsafe-badf32d60ecc0604.rlib(ruster_unsafe-badf32d60ecc0604.0.o)
      "_enif_get_map_size", referenced from:
          rustler::wrapper::nif_interface::enif_get_map_size::h3f9747fdd9d0f47c in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_tuple_from_array", referenced from:
          rustler::wrapper::nif_interface::enif_make_tuple_from_array::h7befd54d882d7531 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_map_remove", referenced from:
          rustler::wrapper::nif_interface::enif_make_map_remove::h961aa87e2152ef7f in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_is_atom", referenced from:
          rustler::wrapper::nif_interface::enif_is_atom::h334838d6a8353d15 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_copy", referenced from:
          rustler::wrapper::nif_interface::enif_make_copy::h810279a726029774 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_inspect_binary", referenced from:
          rustler::wrapper::nif_interface::enif_inspect_binary::h060c7c6692faf746 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          rustler::binary::NifBinary::from_term::h00da1e274a0cd422 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_alloc_env", referenced from:
          rustler::wrapper::nif_interface::enif_alloc_env::h3fd2c1de3d6068bc in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_make_binary", referenced from:
          rustler::wrapper::nif_interface::enif_make_binary::hdd6097cc32618309 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          rustler::binary::NifBinary::from_owned::h538759bc101b2b41 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_alloc_binary", referenced from:
          rustler::wrapper::nif_interface::enif_alloc_binary::h08bb424d3fa65f76 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          rustler::binary::OwnedNifBinary::alloc::hf56f1176ed8c3872 in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_release_binary", referenced from:
          rustler::wrapper::nif_interface::enif_release_binary::hcd3611ded3fa4e8e in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$binary..OwnedNifBinary$u20$as$u20$std..ops..Drop$GT$::drop::hce6f374d6af3cdab in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_get_double", referenced from:
          rustler::wrapper::nif_interface::enif_get_double::h0954e2466735bdec in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$f64$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h3c4a4cbd31f2a5df in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
          _$LT$f32$u20$as$u20$types..NifDecoder$LT$$u27$a$GT$$GT$::decode::h7abf1a0ce08162cb in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
      "_enif_raise_exception", referenced from:
          rustler::wrapper::nif_interface::enif_raise_exception::hfb9038fb735943ae in librustler-12f16f7939d96e54.rlib(rustler-12f16f7939d96e54.0.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    error: aborting due to previous error
    error: Could not compile `rustler_test`.
    
    To learn more, run the command again with --verbose.
    
    Reply
  • Unable to cargo build rustler
    Unable to cargo build rustler

    Oct 15, 2016

    Hi, Rustler seems to be very promising but unfortunately I am not able to compile it.

    OS: Mac OS X siera Rust Version: 1.12.0.

    The error I am getting is:

    $ cargo build
        Updating registry `https://github.com/rust-lang/crates.io-index`
       Compiling easy-plugin-plugins v0.9.1
    error: no method named `pat_enum` found for type `&mut syntax::ext::base::ExtCtxt<'_>` in the current scope
       --> /Users/tomaskorcak/dev/microcrawler/gauc-elixir/native/gauc/target/debug/build/easy-plugin-plugins-64578d19b8e93d12/out/lib.rs:624:23
        |
    624 |     let pat = context.pat_enum(span, path, pats);
        |                       ^^^^^^^^
    /Users/tomaskorcak/.cargo/registry/src/github.com-1ecc6299db9ec823/easy-plugin-plugins-0.9.1/src/lib.rs:36:1: 36:47 note: in this expansion of include!
    
    error: aborting due to previous error
    
    error: Could not compile `easy-plugin-plugins`.
    
    To learn more, run the command again with --verbose.
    
    Reply