1

I am getting runtime error on generating executable file while rails installation.

gem install rails -- --use-system-libraries

I have checked similar thread here, but in my case there seems no library missing. It says "You have to install development tools first" but does not specifies which tool. Error log can be seen here.
I am on archlinux (4.12.4-1-ARCH).

krishnakant
  • 355
  • 1
  • 4
  • 17
  • I've started with a completely fresh `archlinux/base` Docker image, and I'll document the steps to get all of the Rails dependencies built. Generally speaking in these circumstances the 'development tools' refer to `gcc` and `make`, then you'll get a message for each missing library and you can just install them one by one. Anyway, I have it working now, I'll write up the answer. – struthersneil Aug 12 '17 at 22:06

1 Answers1

1

To discover the minimum set of tools and libraries you'll need, I started with a completely fresh archlinux/base image in Docker as follows:

docker run -it archlinux/base

...and now inside the container...

First of all I changed out the default mirrorlist as the mirror in the image didn't seem to work. If your pacman is working fine you don't need to do this.

rm /etc/pacman.d/mirrorlist
echo "Server = http://mirrors.kernel.org/archlinux/\$repo/os/\$arch" > /etc/pacman.d/mirrorlist
pacman-db-upgrade
pacman -Syyu --noconfirm

Next, I installed ruby and the C++ tools.

pacman -S ruby gcc make --noconfirm

Attempting to run gem install rails -- --use-system-libraries led to the expected complaints about missing libraries for Nokogiri. It depends on libxml2 and libxslt, so...

pacman -S libxml2 libxslt --noconfirm

Finally you can run gem install rails -- --use-system-libraries and it will finish successfully.

If you want to install rails without --use-system-libraries (which is probably what you want, as Nokogiri laments about not being 100% compatible with OS-bundled versions of libxml2) just install git and awk through pacman instead of installing the xml libraries, e.g.

pacman -S ruby gcc make git awk --noconfirm
gem install rails

Enjoy!

struthersneil
  • 2,700
  • 10
  • 11
  • Thanks, I am able to install with git and awk without using system-libraries. Can you help me understand how awk and git helped with the problem ? – krishnakant Aug 14 '17 at 19:40
  • I am still not able to find rails using "rails --version". It installed correctly log https://pastebin.com/Mdqc7YWv – krishnakant Aug 14 '17 at 20:08
  • 1
    Awk and git were used in the Nokogiri build process. I'm not sure exactly what it used them for--awk will probably have been used for simple command line text processing, git will have been used to pull down extra code from somewhere. – struthersneil Aug 14 '17 at 20:15
  • 1
    As for finding your rails command, you'll most likely need to add gems to your path. I'm not sure of the specifics of doing that in Arch Linux though. – struthersneil Aug 14 '17 at 20:33
  • 1
    https://wiki.archlinux.org/index.php/Ruby Look at rubygems setup here, specifically with regards to the path setup. – struthersneil Aug 14 '17 at 20:34