Comments (17)
from heroku-buildpack-rust.
@schneems Do you have any idea why rustc
might not be able to find -lruby
while the Ruby buildpack is running, and we're trying to compile a gem using Rust? It's using the system linker as far as I can tell from the logs.
I'm happy to provide you with commit access to this repository, by the way, to help with Ruby/Rust buildpack integration issues. I'd really love to get all these bugs sorted out so that we can write some Ruby+Rust tutorials!
from heroku-buildpack-rust.
@elifoster how are you setting up the app? What is the output of $ heroku buildpacks
? Do you have any config on the app? Is the gem built in rust string-utility
?
from heroku-buildpack-rust.
What is the output of
$ heroku buildpacks
?
=== rustrubytest Buildpack URLs
1. https://github.com/emk/heroku-buildpack-rust
2. heroku/ruby
Do you have any config on the app?
What do you mean?
Is the gem built in rust
string-utility
?
Yes, string-utility
is built in part with Rust, and that is the gem I am testing this with.
from heroku-buildpack-rust.
I tried installing that gem locally and can't. I've got cargo installed and on the path, is there anything else I need?
$ cargo -V
cargo 0.13.0-nightly (109cb7c 2016-08-19)
2.3.1 ~/documents/projects/tmp/heroku-ruby-rust-hello (master)
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using rack 1.6.4
Using tilt 2.0.4
Using bundler 1.13.1
Using rack-protection 1.5.3
Using sinatra 1.4.7
Installing string-utility 2.7.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext
/Users/richardschneeman/.rubies/ruby-2.3.1/bin/ruby -r ./siteconf20161003-88028-xqeqig.rb extconf.rb
cargo 0.13.0-nightly (109cb7c 2016-08-19)
rustc 1.12.0 (3191fbae9 2016-09-23)
current directory: /Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext
make "DESTDIR=" clean
rm -rf target
current directory: /Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext
make "DESTDIR="
cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling ruby-sys v0.2.13
Compiling libc v0.2.16
Compiling ruru v0.7.8
Compiling string-utility-rb-native v1.0.0 (file:///Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext)
warning: unused import, #[warn(unused_imports)] on by default
--> src/lib.rs:4:12
|
4 | use ruru::{AnyObject, Class, RString, VM};
| ^^^^^^^^^
warning: unused import, #[warn(unused_imports)] on by default
--> src/lib.rs:4:39
|
4 | use ruru::{AnyObject, Class, RString, VM};
| ^^
warning: unused import, #[warn(unused_imports)] on by default
--> src/lib.rs:5:19
|
5 | use ruru::types::{Argc, Value};
| ^^^^
warning: unused import, #[warn(unused_imports)] on by default
--> src/lib.rs:5:25
|
5 | use ruru::types::{Argc, Value};
| ^^^^^
warning: unused import, #[warn(unused_imports)] on by default
--> src/lib.rs:6:5
|
6 | use ruru::traits::Object;
| ^^^^^^^^^^^^^^^^^^^^
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/Users/richardschneeman/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib"
"/Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext/target/release/deps/stringutility.0.o" "-o"
"/Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext/target/release/deps/libstringutility.dylib"
"/Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext/target/release/deps/stringutility.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L"
"/Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3/ext/target/release/deps" "-L" "/Users/richardschneeman/.rubies/ruby-2.3.1/lib" "-L"
"/Users/richardschneeman/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libruru-35c12ee1cec9de02.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libruby_sys-a3c0096998cfe6fb.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/liblibc-1417726cb94dbc83.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libstd-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libpanic_unwind-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libunwind-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/librand-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libcollections-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/librustc_unicode-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/liballoc-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/liballoc_system-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/liblibc-40393716.rlib"
"-Wl,-force_load,/var/folders/ss/lf77xfjd1g7ftznjmk3jzw1w0000gn/T/rustc.Pjd6qcs77GZk/libcore-40393716.rlib" "-l" "ruby" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib"
"-Wl,-dylib" "-l" "compiler-rt"
= note: Undefined symbols for architecture x86_64:
"_rb_sym2id", referenced from:
ruru::class::symbol::Symbol::to_string::h9c3f5761208977c6 in libruru-35c12ee1cec9de02.rlib(ruru-35c12ee1cec9de02.0.o)
"_rb_id2sym", referenced from:
ruru::class::symbol::Symbol::new::h605e3540c8e2c62d in libruru-35c12ee1cec9de02.rlib(ruru-35c12ee1cec9de02.0.o)
"_rb_funcallv", referenced from:
ruru::binding::util::call_method::h8a74c812b5d32a7e in libruru-35c12ee1cec9de02.rlib(ruru-35c12ee1cec9de02.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 `string-utility-rb-native`.
To learn more, run the command again with --verbose.
make: *** [all] Error 101
make failed, exit code 2
Gem files will remain installed in /Users/richardschneeman/.gem/ruby/2.3.1/gems/string-utility-2.7.3 for inspection.
Results logged to /Users/richardschneeman/.gem/ruby/2.3.1/extensions/x86_64-darwin-14/2.3.0-static/string-utility-2.7.3/gem_make.out
An error occurred while installing string-utility (2.7.3), and Bundler cannot continue.
Make sure that `gem install string-utility -v '2.7.3'` succeeds before bundling
from heroku-buildpack-rust.
No all you should need is rust/cargo and ruby. What OS are you on/is Heroku using?
from heroku-buildpack-rust.
I'm on a mac. Heroku is on ubuntu 14.04
$ heroku run bash
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
from heroku-buildpack-rust.
Strange. I just uninstalled and reinstalled string-utility and it was fine. Also on OS X. It looks like that's an issue with ruru itself and not string-utility. Hrm.
from heroku-buildpack-rust.
Anything else I should be trying? Any other commands you want me to run to make sure my rust install is valid?
from heroku-buildpack-rust.
Honestly I'm not sure. I just updated Cargo and Rust (I was a stable version behind, now on the same versions as you) and it still works fine for me. Are you/is Heroku using rbenv? This looks similar to d-unsed/ruru#1 and d-unsed/ruru#11
@d-unseductable perhaps you might have some thoughts regarding this?
from heroku-buildpack-rust.
It seems that the MRI which is used in ruby buildpack does not have a shared library. The library is linked to the gem after compilation (-lruby
).
Shared library can be built while installing MRI using --enable-shared
flag, for example:
- rvm:
rvm install 2.3.0 -C --enable-shared
- rbenv:
CONFIGURE_OPTS=--enable-shared rbenv install 2.3.0
- manual build:
./configure --enable-shared
If I understand correctly from the buildpack source code, ruby is downloaded from an S3 bucket. In this case, I see two options:
- rebuild the MRI packages with
--enable-shared
option - do not touch existing packages and create new ones with shared libraries (if it's possible to pass additional parameters to buildpack, for example
SHARED_LIBRARY=1
)
from heroku-buildpack-rust.
We are looking into maybe recompiling them all, no guarantees though.
On the other hand, do you know why it's needed in this case? Hundreds (or thousands?) of c-extensions on Rubygems are able to compile against Heroku's ruby versions without this requirement.
from heroku-buildpack-rust.
from heroku-buildpack-rust.
Want to add @hone onto this conversation.
from heroku-buildpack-rust.
@emk @schneems unfortunately, I could not manage to make it work with static library due to cargo
limitations. It does not allow to pass all the required arguments to linker.
I will spend more time on it next week.
from heroku-buildpack-rust.
Did anybody ever find a solution to building Ruby extensions written in Rust? I'm happy to devote some more time to this, but the underlying technologies have all changed significantly since this issue was opened, and I'm not sure where to start.
from heroku-buildpack-rust.
This is old and nobody seems to working on it recently, so I'm going to close the issue. Thank you to everybody!
from heroku-buildpack-rust.
Related Issues (20)
- VERSION=1.X not supported anymore HOT 1
- Build is failing, need help to figure this out HOT 6
- Build failing on Heroku HOT 3
- Register in buildpack registry HOT 1
- Not able to build nightly HOT 12
- Cargo missing? HOT 2
- Add support for custom ssh keys HOT 2
- Cannot find diesel during Heroku release step HOT 19
- Cannot find lsqlite3 HOT 5
- Need help! Error R10 - Boot timeout -> failed to bind to $PORT within 60 seconds HOT 4
- How to compile WASM? HOT 1
- Build failing because of openssl
- Cannot get nightly to build HOT 2
- error: reached the type-length limit HOT 4
- Old targets are left behind
- Timeout on Build HOT 3
- Add instructions on how to use sqlx migrations HOT 1
- Option to keep source files of dependencies after compile HOT 2
- Support for `WEB_CONCURRENCY`
- Add support for Trunk
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 heroku-buildpack-rust.