Comments (3)
You didn't give an example of the exact situation you're experiencing the warning, but there is a bug somewhere in RubyGems and/or Bundler that causes that message to appear for any native extension gem (Rust or C) that is in the Gemfile as a path dependency, e.g. gem "foo", path: "/path/to/foo"
(the gemspec
line in a Gemfile will also create a path dependency to the current directory), so I'm guessing it's that.
from magnus.
The examples like example/fibonacci.rs
can be run like cargo run --example fibonacci
.
The examples like examples/rust_blank
can be run like:
cd examples/rust_blank
rake test
For an example of a complete gem, see https://github.com/matsadler/halton-rb
The tests can be run with rake test
.
That can be built into a .gem
file with gem build halton.gemspec
and then installed with gem install halton-0.3.0.gem
(or whatever version was built). Once installed you could use it like:
> irb
irb(main):001:0> require "halton"
=> true
irb(main):002:0> Halton.number(2, 1)
=> 0.5
That will build a gem that contains the Rust source, and then compiles the Rust code when it is installed. To instead compile the Rust code when the gem is built run rake native gem
, and you will find the .gem
file is named something like halton-0.3.0-arm64-darwin-22.gem
. In this example the gem would only work on ARM (Apple Silicon, i.e. M1, M2, etc) Macs, because that's where I compiled it.
It's possible to cross-compile a gem to contain pre-compiled code for multiple operating systems / CPU architectures, but that's time consuming to get working (or in my case remember how it works), I'd recommend using the oxidize-rb/actions/cross-gem GitHub action in that case.
from magnus.
Hi,
thanks for the examples.
I followed your advise and cloned the halton-repository, executed bundle install
and bundle exec rake compile
. Everything worked well.
Except an annoying warning.
Every time I start a console and require 'halton' this is displayed
Ignoring halton-0.3.0 because its extensions are not build.
The rust extension is loaded correctly. Whats the reason and how to get rid of that message?
from magnus.
Related Issues (20)
- Add Support for Passing an Array to Proc.Call HOT 1
- Discussion: Pin Ruby values to the stack HOT 5
- Feature Request: Add default type parameters to scan_args
- Sidekiq not handling signals? HOT 7
- `Vec<Vec<(String, usize)>>` panics with unsatisfied trait bounds HOT 3
- `AsRef`
- Deadlock when first creating rust-ext objects on threads HOT 5
- Integration with Rust futures?
- Question: Best approach to implementing a timestamp with nanosecond precision and timezone awareness HOT 3
- Question about a performance issue HOT 6
- Confused about how to pass a Ruby array to a Rust function HOT 1
- How well does the embed feature work? HOT 1
- Build is broken when trying to use Bytes feature HOT 2
- a possible solution for unlocking the GVL
- MSRV Change HOT 1
- RHash.lookup for bool value HOT 5
- Automatic `frozen?` check HOT 2
- Exposing mutable wrapped class methods HOT 1
- Magnus overhead compared to rb-sys HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magnus.