From: Lloyd Zusman Date: 2003-06-01T00:40:13+09:00 Subject: Patch for mod_ruby-1.1.1 (was: Ruby 1.8, mod_ruby-1.1.1, and Apache 2) This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages. --=_hippo.asfast.net-57028-1054395610-0001-2 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Lloyd Zusman writes: > Ted Rolle writes: > >> [ ... ] > > I don't know if this is a config file issue or something else. The > problem is that I can't get mod_ruby-1.1.1 to compile, and I'm wondering > what changes I need to make to either the source code, the configure.rb > script, the Makefile, or whatever. > > I configured like this: > > ./configure.rb --with-apxs=/usr/local/apache2/bin/apxs > > But then when I did the make, I immediately got this (I'm manually > wrapping the long lines): > > gcc -I/usr/local/include -fPIC -Wall -I/usr/local/include > -I. -I/usr/local/lib/ruby/1.8/i386-freebsd4.0 > -I/usr/local/apache2/include -c mod_ruby.c > mod_ruby.c:93: syntax error before `*' > [ ... etc. ... ] I found the error. Inside of a few mod_ruby-1.1.1 files there's the following preprocessor directive: #ifdef APR_HAS_THREADS But in the default build of Apache 2, this variable is set as follows: #define APR_HAS_THREADS 0 Therefore, I had to change that #ifdef to an #if ... #if APR_HAS_THREADS Now, mod_ruby-1.1.1 builds just fine. This fix might have to be more sophisticated, because there might be builds of Apache 2 where APR_HAS_THREADS doesn't get defined at all. If so, then there needs to be a combination of #ifdef and #if. But in any case, attached is the patch that changes this #ifdef to an #if in all the appropriate places, and which works for me. Thanks again. -- Lloyd Zusman ljz@asfast.com --=_hippo.asfast.net-57028-1054395610-0001-2 Content-Type: application/octet-stream Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=mod_ruby-1.1.1-patch Content-Description: mod_ruby-1.1.1-patch *** mod_ruby.c.orig Sat May 31 11:24:34 2003 --- mod_ruby.c Sat May 31 11:27:58 2003 *************** *** 86,92 **** static int ruby_is_running = 0; array_header *ruby_required_libraries = NULL; ! #ifdef APR_HAS_THREADS #include "apr_thread_cond.h" static apr_thread_t *ruby_thread; --- 86,92 ---- static int ruby_is_running = 0; array_header *ruby_required_libraries = NULL; ! #if APR_HAS_THREADS #include "apr_thread_cond.h" static apr_thread_t *ruby_thread; *************** *** 662,668 **** } } ! #ifdef APR_HAS_THREADS static void *ruby_thread_start(apr_thread_t *t, void *data) { server_rec *s = (server_rec *) data; --- 662,668 ---- } } ! #if APR_HAS_THREADS static void *ruby_thread_start(apr_thread_t *t, void *data) { server_rec *s = (server_rec *) data; *************** *** 731,737 **** static APR_CLEANUP_RETURN_TYPE ruby_child_cleanup(void *data) { ! #ifdef APR_HAS_THREADS pool *p; apr_status_t status; --- 731,737 ---- static APR_CLEANUP_RETURN_TYPE ruby_child_cleanup(void *data) { ! #if APR_HAS_THREADS pool *p; apr_status_t status; *************** *** 754,760 **** #endif { if (!ruby_running()) { ! #ifdef APR_HAS_THREADS apr_status_t status; status = apr_thread_mutex_create(&ruby_request_queue_mutex, APR_THREAD_MUTEX_DEFAULT, p); --- 754,760 ---- #endif { if (!ruby_running()) { ! #if APR_HAS_THREADS apr_status_t status; status = apr_thread_mutex_create(&ruby_request_queue_mutex, APR_THREAD_MUTEX_DEFAULT, p); *************** *** 1097,1103 **** arg->run_all = run_all; arg->flush = flush; arg->retval = 0; ! #ifdef APR_HAS_THREADS { apr_status_t status; char buf[256]; --- 1097,1103 ---- arg->run_all = run_all; arg->flush = flush; arg->retval = 0; ! #if APR_HAS_THREADS { apr_status_t status; char buf[256]; *** mod_ruby.h.orig Sat May 31 11:26:15 2003 --- mod_ruby.h Sat May 31 11:26:50 2003 *************** *** 148,154 **** ((ruby_dir_config *) ap_get_module_config(r->per_dir_config, \ &ruby_module)) ! #ifdef APR_HAS_THREADS typedef void *(*ruby_interp_func_t)(void*); apr_status_t ruby_call_interpreter(pool *p, ruby_interp_func_t func, --- 148,154 ---- ((ruby_dir_config *) ap_get_module_config(r->per_dir_config, \ &ruby_module)) ! #if APR_HAS_THREADS typedef void *(*ruby_interp_func_t)(void*); apr_status_t ruby_call_interpreter(pool *p, ruby_interp_func_t func, *** ruby_config.c.orig Sat May 31 11:26:38 2003 --- ruby_config.c Sat May 31 11:27:06 2003 *************** *** 229,235 **** arg->server = server; arg->sconf = sconf; arg->dconf = dconf; ! #ifdef APR_HAS_THREADS { apr_status_t status; char buf[256]; --- 229,235 ---- arg->server = server; arg->sconf = sconf; arg->dconf = dconf; ! #if APR_HAS_THREADS { apr_status_t status; char buf[256]; --=_hippo.asfast.net-57028-1054395610-0001-2--