November 15, 2008

mod_rails (Passenger) setup issues with Apache2 on OS X

mod_rails not finding Apache2 APR



When installing mod_rails with a custom Apache2 setup, you may get the following while running sudo passenger-install-apache2-module:


Compiling and installing Apache 2 module...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
rake clean apache2
(in /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3)
rake aborted!
Could not find Apache Portable Runtime (APR).
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/rakefile:37
(See full trace by running task with --trace)



The main reason for this is that mod_rails cannot find apr-1-config which should have been installed within (as per my system) /usr/local/apache2/bin. In order to solve the problem, you just need to add the Apache2 custom install bin directory to your user path (as per my system):


export PATH=":/usr/local/apache2/bin:$PATH"


That should do it.

mod_rails and "MACOSX_DEPLOYMENT_TARGET environment variable"


The error you are most likely to get would be close to the following:


g++ -flat_namespace -bundle -undefined dynamic_lookup Utils.o Bucket.o Logging.o System.o Configuration.o Hooks.o mod_passenger.o -fPIC -o mod_passenger.so -lstdc++ -lpthread ../boost/src/libboost_thread.a -L/usr/local/apache2/lib -lapr-1
/usr/bin/ld: flag: -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [g++ -flat_namespace -bundle -undefined dyn...]
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/rakefile:142
(See full trace by running task with --trace)


In this case, you will have to add the following to your environment variables


export MACOSX_DEPLOYMENT_TARGET=10.4

No comments:

Post a Comment