I have set up RVM system-wide with Ruby 1.9.2 and as far as I can tell, it works fine.
But when I try to compile Passenger apache2 module via
passenger-install-apache2-module
It compiles it for system’s 1.8.7 (the ext/ruby folder contains ruby-1.8.7-x86_64-linux) and when I start apache, the Passenger complains:
*** Phusion Passenger: no passenger_native_support.so found for the current Ruby interpreter. Compiling one...
# mkdir -p /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/ext/ruby/ruby-1.9.2-x86_64-linux
But the problem is that Apache runs on read-only filesystem, thus Passenger fails to compile the module at runtime. What do I need to do to get it to compile it beforehand for Ruby 1.9.2?
I’ve even removed original /usr/bin/ruby18 binary and then it ends in error:
Compiling and installing Apache 2 module...
cd /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7
/usr/local/rvm/wrappers/ruby-1.9.2-p180/rake apache2:clean apache2 RELEASE=yes
# /usr/local/rvm/wrappers/ruby-1.9.2-p180/rake apache2:clean apache2 RELEASE=yes
/usr/bin/env: ruby18: No such file or directory
PS. I have read few similar questions here, but none seem to apply directly. The file /usr/local/rvm/gems/ruby-1.9.2-p180/bin/passenger-install-apache2-module has correct she-bang row for ...1.9.2-p180/bin/ruby.
EDIT: Added more info
Apache Passenger conf is:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7
PassengerRuby /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
PassengerLogLevel 3
PassengerDebugLogFile /tmp/passenger.log
And just in case it is helpful I post rvm info output.
ruby-1.9.2-p180:
system:
uname: "Linux aevastaja 2.6.31-gentoo-r6 #2 SMP Wed Jan 6 19:40:30 EET 2010 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.9(2)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.6.18 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p180"
date: "2011-02-18"
platform: "x86_64-linux"
patchlevel: "2011-02-18 revision 30909"
full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.2-p180"
ruby: "/usr/local/rvm/rubies/ruby-1.9.2-p180"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/gem"
rake: "/usr/local/rvm/gems/ruby-1.9.2-p180/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-1.9.2-p180/bin:/usr/local/rvm/gems/ruby-1.9.2-p180@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p180/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.5"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.2-p180"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.2-p180:/usr/local/rvm/gems/ruby-1.9.2-p180@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.2-p180"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.2-p180/.irbrc"
RUBYOPT: ""
gemset: ""
Turns out that apparently while installing newer Rake gem, I had had the environment wrong and though the gem ended up in RVM under 1.9.2, it actually referenced system 1.8.7 binary and that Passenger install script ran this rake, which in turn built the module against wrong ruby.
Helped to uninstall and reinstall Rake gem.