Skip to content

Fix build issues on Mac #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brendanzab opened this issue Apr 18, 2016 · 23 comments
Closed

Fix build issues on Mac #12

brendanzab opened this issue Apr 18, 2016 · 23 comments

Comments

@brendanzab
Copy link

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.
@brendanzab
Copy link
Author

Executing multirust override nightly-2016-04-05 then calling cargo build also does not work :(

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

Thank you for the report.

Could this be a variant of rusterlium/erlang_nif-sys#3?

I am not at a computer at the moment, so I can't give an exact command to run, but could you try the command listed in the issue to see if compilation works?

@brendanzab
Copy link
Author

brendanzab commented Apr 18, 2016

Adding this to my nif.rs made it compile:

#![feature(link_args)]

#[link_args = "-flat_namespace -undefined suppress"]
extern {}

Now I'm getting:

$ elixir demo.exs
** (MatchError) no match of right hand side value: {:error, :on_load_failure}
    demo.exs:1: (file)
    (elixir) lib/code.ex:363: Code.require_file/2


16:01:08.865 [error] Process #PID<0.53.0> raised an exception
** (MatchError) no match of right hand side value: {:error, {:load_failed, 'Failed to load NIF library: \'dlopen(target/debug/librustler_test.so, 2): image not found\''}}
    demo.exs:8: RustlerTest.init/0
    (kernel) code_server.erl:1674: anonymous fn/1 in :code_server.handle_on_load/4

16:01:08.870 [warn]  The on_load function for module Elixir.RustlerTest returned {{:badmatch,
  {:error,
   {:load_failed,
    'Failed to load NIF library: \'dlopen(target/debug/librustler_test.so, 2): image not found\''}}},
 [{RustlerTest, :init, 0, [file: 'demo.exs', line: 8]},
  {:code_server, :"-handle_on_load/4-fun-0-", 1,
   [file: 'code_server.erl', line: 1674]}]}

Seems like it's looking for target/debug/librustler_test.so not target/debug/librustler_test.dylib in the call to :erlang.load_nif(path, 0).

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

That's strange, demo.exs uses a wildcard to find the file. Is there a .so in the target/debug/ directory by any chance?

@brendanzab
Copy link
Author

OSX uses the .dylib extension for dynamic libs. Looks like :erlang.load_nif only looks for .dll or .so. :(

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

I am fairly certain :erlang.load_nif supports loading .dylibs as well. Could you try changing these three lines in your demo.exs to this?

path = "target/debug/librustler_test"

Edit: yeah, this won't do anything.

@brendanzab
Copy link
Author

Trying to do some googling to see how to link to dylibs with erlang, but not coming up with anything... rust-lang/cargo#1970 looks related...

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

For reference, here is a library that loads a NIF. It seems to be supported on Mac.

https://github.com/elixircnx/comeonin/blob/a158b18e52fac1adc715d9b0f7cd6efe6336b73b/lib/comeonin/bcrypt.ex#L55

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

Ah, if that issue is related, the comeonin guys might be changing the extension?

@brendanzab
Copy link
Author

By the way, here is my target/debug folder:

$ ls target/debug
build                      examples                   librustler_test.dylib.dSYM
deps                       librustler_test.dylib      native

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

You could try copying librustler_test.dylib to librustler_test.so to confirm the issue

@brendanzab
Copy link
Author

Wooo!

$ cp target/debug/librustler_test.dylib target/debug/librustler_test.so
$ elixir demo.exs
9290

@brendanzab
Copy link
Author

brendanzab commented Apr 18, 2016

I wonder if we could create a build script to do that...

@hansihe
Copy link
Member

hansihe commented Apr 18, 2016

In the longer term, it would be nice to make :erlang.load_nif support loading .dylibs on macs

This file seems to handle library loading on unix systems. It seems to just append .so to the library name.

hansihe added a commit that referenced this issue Apr 18, 2016
@hansihe hansihe changed the title 'Undefined symbols for architecture x86_64' when running 'cargo build' on OS X Fix build issues on Mac Jul 28, 2016
@turboladen
Copy link

FWIW, I've been trying for a few hours now to get Rustler working with Rust 1.12 and have been running into the same issue (ld: symbol(s) not found for architecture x86_64). I also tried dropping Rustler and just using erlang_nif-sys, but ended up with similar build errors. I gave up, then came back after a couple hours away from the computer to try to get it to work again, ran into the same problem again, then found this ticket.

The fix seems to be to use the link_args feature, but then that implies that Rustler doesn't work unless you're using nightlies. Is that correct?

@hansihe
Copy link
Member

hansihe commented Oct 17, 2016

You should be able to build it on stable using the following command:

cargo rustc -- --codegen link-args='-flat_namespace -undefined suppress'

Could you try it out and see if it works?

@hansihe
Copy link
Member

hansihe commented Oct 17, 2016

I implemented a fix for rustler_codegen in 64351d4.

Because I do not have a Mac available, the fix is untested. If anyone with a mac could test it by running mix test in the /test/ directory, it would be greatly appreciated.

@turboladen
Copy link

I think that did the trick, @hansihe! Where does the --codegen flag come from? Thanks!

@hansihe
Copy link
Member

hansihe commented Oct 17, 2016

@turboladen --codegen is a rustc flag which is documented here.

Did I understand the question correctly?

@turboladen
Copy link

Did I understand the question correctly?

I think so, as that seems to have fixed my compile problem. I asked about the flag just because I hadn't come across it before and wanted to learn about it.

@turboladen
Copy link

If anyone with a mac could test it

I cloned the repo (I'm at git ref 12577b96222032738594fa3623313f6c90645abe). I'm getting a failure; here's the whole output:

test git:master ❯ mix test                                                                                                                                                                                                                                                                                                                                     [ruby-2.2.5]
==> rustler
Compiling 1 file (.yrl)
Compiling 1 file (.xrl)
Compiling 2 files (.erl)
Compiling 6 files (.ex)
warning: variable values is unused
  lib/rustler/toml_parser.ex:70

warning: variable app is unused
  lib/task_compile.ex:26

warning: variable argv is unused
  lib/task_new.ex:32

warning: variable opts is unused
  lib/task_new.ex:43

Generated rustler app
==> rustler_test
Compiling NIF crate :test_nif (/)...
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling rustc-serialize v0.3.19
   Compiling unicode-xid v0.0.3
   Compiling winapi v0.2.8
   Compiling quote v0.3.3
   Compiling libc v0.2.17
   Compiling log v0.3.6
   Compiling lazy_static v0.1.16
   Compiling erlang_nif-sys v0.5.3
   Compiling winapi-build v0.1.1
   Compiling bitflags v0.7.0
   Compiling kernel32-sys v0.2.2
   Compiling term v0.4.4
   Compiling syn v0.9.0
   Compiling rustler v0.12.0 (file:///Users/sloveless/Development/not_my_projects/Rustler)
   Compiling syntex_pos v0.45.0
   Compiling syntex_errors v0.45.0
   Compiling syntex_syntax v0.45.0
   Compiling syntex v0.45.0
   Compiling rustler_codegen v0.12.0 (file:///Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen)
warning: unused import, #[warn(unused_imports)] on by default
 --> /Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen/src/lib.rs:5:5
  |
5 | use syn::aster;
  |     ^^^^^^^^^^

warning: function is never used: `get_meta_item_value`, #[warn(dead_code)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen/src/util.rs:4:1
   |
4  | pub fn get_meta_item_value(meta_item: &MetaItem, name: &str) -> Option<String> {
   | ^

warning: unused import, #[warn(unused_imports)] on by default
 --> /Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen/src/tuple.rs:1:19
  |
1 | use ::syn::{self, aster, Field, VariantData, Ident};
  |                   ^^^^^

warning: unused import, #[warn(unused_imports)] on by default
 --> /Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen/src/map.rs:1:19
  |
1 | use ::syn::{self, aster, Field, VariantData, Ident};
  |                   ^^^^^

warning: unused variable: `field_defs`, #[warn(unused_variables)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/rustler_codegen/src/map.rs:64:9
   |
64 |     let field_defs: Vec<Tokens> = fields.iter().map(|field| {
   |         ^^^^^^^^^^

   Compiling test v0.1.0 (file:///Users/sloveless/Development/not_my_projects/Rustler/test)
warning: unused import, #[warn(unused_imports)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:10:36
   |
10 |     use rustler::{NifEnv, NifTerm, NifError, NifEncoder, NifResult};
   |                                    ^^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: function is never used: `echo_u8`, #[warn(dead_code)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:47:5
   |
47 |     pub fn echo_u8<'a>(env: &'a NifEnv, args: &Vec<NifTerm>)
   |     ^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused import, #[warn(unused_imports)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:55:9
   |
55 |     use rustler;
   |         ^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused variable: `args`, #[warn(unused_variables)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:69:43
   |
69 |     pub fn make_list<'a>(env: &'a NifEnv, args: &Vec<NifTerm>)
   |                                           ^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused import, #[warn(unused_imports)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:77:9
   |
77 |     use rustler;
   |         ^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused variable: `args`, #[warn(unused_variables)] on by default
  --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:88:47
   |
88 |     pub fn resource_make<'a>(env: &'a NifEnv, args: &Vec<NifTerm>)
   |                                               ^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused import, #[warn(unused_imports)] on by default
   --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:116:9
    |
116 |     use rustler;
    |         ^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused import, #[warn(unused_imports)] on by default
   --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:117:36
    |
117 |     use rustler::{NifEnv, NifTerm, NifError, NifEncoder, NifResult};
    |                                    ^^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

warning: unused variable: `load_info`, #[warn(unused_variables)] on by default
   --> /Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/build/test-ababd198b4dd8a4f/out/lib.rs:139:26
    |
139 | fn on_load(env: &NifEnv, load_info: NifTerm) -> bool {
    |                          ^^^^^^^^^
src/lib.rs:12:1: 12:47 note: in this expansion of include!

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/Users/sloveless/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/deps/test.0.o" "-o" "/Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/deps/libtest.dylib" "/Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/deps/test.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/sloveless/Development/not_my_projects/Rustler/test/_build/test/rustler/release/deps" "-L" "/Users/sloveless/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-force_load,/var/folders/yk/5ycshs415xx5j0w61z_nfjgc0000gn/T/rustc.SMMpFzttg7Gj/librustler.rlib" "-Wl,-force_load,/var/folders/yk/5ycshs415xx5j0w61z_nfjgc0000gn/T/rustc.SMMpFzttg7Gj/liblazy_static-3a04918be71c80ee.rlib" "-Wl,-force_load,/var/folders/yk/5ycshs415xx5j0w61z_nfjgc0000gn/T/rustcerror: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

thread 'rustc' panicked at 'failed to emit error: Resource temporarily unavailable (os error 35)', ../src/librustc_errors/emitter.rs:629
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `test`.

To learn more, run the command again with --verbose.
** (RuntimeError) Rust NIF compile error (rustc exit code 101)
    lib/task_compile.ex:56: Mix.Tasks.Compile.Rustler.compile_crate_config/2
    (elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/tasks/compile.all.ex:19: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
    (mix) lib/mix/tasks/compile.all.ex:37: Mix.Tasks.Compile.All.with_logger_app/1
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.ex:85: Mix.Tasks.Compile.run/1

Let me know if there's anything else I can do to rerun it for you, @hansihe.

@korczis
Copy link

korczis commented Oct 18, 2016

See #24

@scrogson
Copy link
Member

Please see #27 for the latest on building master.

monkeygroover added a commit to monkeygroover/rebar3_rust that referenced this issue Apr 24, 2018
filmor pushed a commit to filmor/rustler that referenced this issue Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants