Linux Mint - Install Ruby Via Snap Store

Is anyone experienced with Linux Mint and installing Ruby via the Snap Store?

I can install Ruby(version 3.0.2) and it mostly works but I’m having troubles with bundler and rake.

I can create a gem with “bundle gem someGem” and it will create the someGem directory and folders but I can’t call ‘bundle exec rake -T’ without generating a error.

I can call “rake -T” and it works but if I try and call “bundle exec rake -T” it fails.

The error message is long so I’ll only post the start and end.

/snap/ruby/220/lib/ruby/3.0.0/bundler/vendor/fileutils/lib/fileutils.rb:105: warning: already initialized constant Bundler::FileUtils::VERSION

/home/myHome/.gem/gems/bundler-2.2.27/lib/bundler/vendor/fileutils/lib/fileutils.rb:1692: warning: previous definition of METHODS was here
rake aborted!
ArgumentError: Trying to register Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered
/home/myHome/gitStuff/btree/Rakefile:3:in require' /home/myHome/gitStuff/btree/Rakefile:3:in <top (required)>’
/home/myHome/.gem/gems/rake-13.0.6/exe/rake:27:in `<top (required)>’

Any ideas what’s going on here??

I dumped the Snap Store solution and went with installing RVM on Linux Mint. Everything seems to work now.

Note:
If you are using RVM on Linux Mint and Emacs too, then you have to add this line to your .bashrc file if you want ansi-term to work with your ruby files.

[[ -s “$HOME/.rvm/environments/default” ]] && source “$HOME/.rvm/environments/default”

Either get system ruby with apt install ruby ruby-devel or just go with RVM. To use rvm use 2.5 or something else, you must use source ~/.rvm/scripts/rvm - which is actually slow if you add this to .bashrc.
In other words, on my system, if I put this to .bashrc, opening every single terminal session takes 0.2 seconds more time. So whenever I want to use rvm, I kept a function in .bashrc, calling that sources the file…

Also when you want to compile ruby natively, you can use this option:

CC=gcc HOSTCC=gcc CFLAGS="-O3 -march=native -mtune=native -fno-plt" rvm install ruby-2.2

So there’s no need to unnecessarily complicate stuff with snap (which is hated across the linux community).

1 Like

Thanks for the C compile line… Has anyone tried compiling ruby source to work with jemalloc?

http://jemalloc.net/

To compile Ruby on RVM with jemalloc:

  1. Make sure libjemalloc exists on your system. There are a lot of Linux distributions and I know how to install jemalloc only on these distributions:

A. Arch: pacman -S jemalloc
B. Fedora: yum install jemalloc
C. OpenSUSE: zypper install jemalloc
D. Debian: apt install libjemalloc-dev
E. Gentoo: emerge --ask dev-libs/jemalloc

  1. Once done installing the jemalloc library, you can just use this with RVM:
CC=gcc HOSTCC=gcc CFLAGS="-O3 -march=native -mtune=native -fno-plt" rvm install ruby-2.6 --with-jemalloc
  1. To confirm:
ruby -e "puts RbConfig::CONFIG.then { |x| %(MAINLIBS: #{x['MAINLIBS']}\nSOLIBS: #{x['SOLIBS']}) }"

I get this:

MAINLIBS: -lz -lpthread -lrt -lrt -ljemalloc -lgmp -ldl -lcrypt -lm 
SOLIBS: -lz -lpthread -lrt -lrt -ljemalloc -lgmp -ldl -lcrypt -lm 

That’s it!

Do I get any performance improvements? I have a simple set of benchmarks:

I know this is not a professional tests, but gets the work done! So this says jemalloc is slower than Ruby 2.6 (rvm) and Ruby 3.0 (system):

Some benchmarks:

Ruby Version: 3.0.2 (x86_64-linux)

CC: gcc
CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fPIC

Tests: 6 | Total time: 19.71s | Avg Test Time: 3.29s

Ruby Version: 2.6.6 (x86_64-linux)

CC: gcc
CFLAGS: -O3 -march=native -mtune=native -fno-plt -fPIC

Tests: 6 | Total time: 19.71s | Avg Test Time: 3.29s

Ruby Version: 3.0.3 (x86_64-linux) (official, not rvm) with Jemalloc

CC: gcc
CFLAGS: -O3 -march=native -mtune=native -fno-plt -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable

Tests: 6 | Total time: 22.26s | Avg Test Time: 3.71s

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs