ruru
ruru copied to clipboard
Build native extensions as static libraries
RbConfig::CONFIG
provides all the required information for linking with static libraries. But Cargo does not allow to use all the flags, for example -framework CoreFoundation
on Mac OS X.
Investigate thermite + RbConfig::CONFIG
+ gcc as a final (optional) step while building an extension.
This allows to use MRI without --enable-shared
option (emk/heroku-buildpack-rust#15)
Ruru is such an awesome project. Getting rid of the need for --enable-shared
would get much ❤️ ❤️ ❤️ from me. 😄
Here's some info that may prove useful. My build complains when I run the bundle exec
test suite from VIM about libruby.so.2.4
missing, but if I copy that file into my target/debug/deps
folder then everything works. Cargo builds work outside of VIM for me without the lib copied as the RVM environment variables seem to be enough.
Here are the relevant RbConfig variables:
- RbConfig::CONFIG["libdir"]
- RbConfig::CONFIG["LIBRUBY_ALIASES"].split(" ").first
require "fileutils"
FileUtils.cp(
File.join(
RbConfig::CONFIG["libdir"],
RbConfig::CONFIG["LIBRUBY_ALIASES"].split(" ").first
),
File.join(FileUtils.pwd, "target/debug/deps")
)
If the build is failing for people otherwise you can do the same copy as above but change it to target release dependencies target/release/deps
.
For those who want to use the command line to get the path for the libruby file you can use the following.
ruby -e 'puts File.join(RbConfig::CONFIG["libdir"], RbConfig::CONFIG["LIBRUBY_ALIASES"].split(" ").first)'
@seven1m checkout https://github.com/malept/thermite/pull/41
Still doesn't work on Windows. I'd need help with that.