erszcz / erlang-rust-nif

An example Erlang NIF implemented in Rust
80 stars 4 forks source link

Rust 1.0.0, erl 17.4, MacOS #4

Open maxlapshin opened 9 years ago

maxlapshin commented 9 years ago
maxbook:erlang-rust-nif max$ ERLANG_SRC_DIR=/Users/max/Sites/otp make
cd rust_src && cargo build && cd target && ln -s liber-*.dylib liberrust.dylib
   Compiling er v0.0.1 (file:///Users/max/Sites/erlang-rust-nif/rust_src)
src/c.rs:44:31: 44:35 error: illegal suffix `us` for numeric literal
src/c.rs:44     pub _bindgen_data_: [u64; 16us],
                                          ^~~~
src/c.rs:44:31: 44:35 help: the suffix must be one of the integral types (`u32`, `isize`, etc)
src/c.rs:47:66: 47:71 error: illegal suffix `us` for numeric literal
src/c.rs:47     pub unsafe fn __mbstate8(&mut self) -> *mut [::libc::c_char; 128us] {
                                                                             ^~~~~
....

Seems that 128us is not what this version of rust likes.

Also there is no build_macos.sh script

erszcz commented 9 years ago

The example was a bit outdated. Please try current master. With Erlang 17.1 and Rust 1.0.0 it should just work.

You might run into a few glitches with version numbers here and there if you use some slightly different versions. (I wouldn't count on the example working with major version differences.) Specifically in these lines of the Makefile:

# Please override these to match your environment!
ERLANG_SRC_DIR ?= ${HOME}/.kerl/builds/17.1/otp_src_17.1
ERLANG_EI_LIB_DIR ?= ${HOME}/apps/erlang/17.1/lib/erl_interface-3.7.17/lib
RUST_DIR ?= ${HOME}/apps/rust/1.0.0
...
    ${RUST_DIR}/lib/rustlib/${RUST_PLATFORM}/lib/liballoc-4e7c5e5c.rlib \