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.