Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phusion-passenger compiles extension for wrong ruby when using RVM

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 ([email protected]) [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:       ""
like image 471
Laas Avatar asked Dec 10 '25 10:12

Laas


2 Answers

If you use different ruby-version for different ites, you may only need the native-support and can just run passenger-config build-native-support after switching to the right ruby-version.

Use passenger-config build-native-support --help to see for which ruby-version the command will build the native support.

like image 110
TheConstructor Avatar answered Dec 12 '25 03:12

TheConstructor


For others with this issue, please note that Passenger may be taking cues from a config file (e.g., /etc/httpd/conf.d/passenger.conf) other than your primary Apache config file.

like image 22
austinjalexander Avatar answered Dec 12 '25 03:12

austinjalexander