Giter Site home page Giter Site logo

Can't compile rustler about rustler HOT 7 CLOSED

rusterlium avatar rusterlium commented on April 27, 2024 2
Can't compile rustler

from rustler.

Comments (7)

evanmcc avatar evanmcc commented on April 27, 2024

same. Tried backing off a version or two and going to nightly, but no luck.

from rustler.

scrogson avatar scrogson commented on April 27, 2024

Same here.

from rustler.

hansihe avatar hansihe commented on April 27, 2024

The error is fixed in git.

Because the fix removed a few features, I have been reluctant about making a new release before reimplementing them properly. I guess having a working release is more important than preventing regressions, and I should probably make a new release.

from rustler.

scrogson avatar scrogson commented on April 27, 2024

I just fixed a few issues with compilation in #30 (which has been merged).

You'll need to use master for all dependencies until the next release.

# mix.exs
defp deps do
  [{:rustler, github: "hansihe/rustler", sparse: "rustler_mix"}]
end

NOTE: the :sparse option above is only available in Elixir >= 1.3.3.

# Cargo.toml
[build-dependencies]
rustler_codegen = { git = "https://github.com/hansihe/Rustler" }

[dependencies]
rustler = { git = "https://github.com/hansihe/Rustler" }
rustler_codegen = { git = "https://github.com/hansihe/Rustler" }

Finally, you'll need to use the following in your Elixir module:

...

require Rustler # to get access to the `load_nif/2` macro

def load_nif do
  # args:
  # * your OTP application name
  # * your rust crate name
  :ok = Rustler.load_nif(:my_app, "my_app")
end

...
λ rustc -V
rustc 1.15.0-nightly (43006fcea 2016-11-15)

Hope that helps!

from rustler.

mrluc avatar mrluc commented on April 27, 2024

It's working! Thank you so much.

I tripped twice on this: :ok = Ruster.load_nif(:my_app, "my_app"). First for the typo, then because my Rust lib wasn't named the same as my app.

:ok = Rustler.load_nif(:my_app, "my_rust_lib"), and it's working with these deps and latest nightly.

from rustler.

scrogson avatar scrogson commented on April 27, 2024

@mrluc awesome!

I've edited the type you pointed out. Thanks for letting me know!

from rustler.

jschneider1207 avatar jschneider1207 commented on April 27, 2024

@scrogson Thanks so much, works perfect after following your instructions!

from rustler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.