mikeowens / modruby Goto Github PK
View Code? Open in Web Editor NEWApache 2.x module for Ruby
License: Apache License 2.0
Apache 2.x module for Ruby
License: Apache License 2.0
Hi @mikeowens,
I'm running into a strange problem with CentOS 7, ruby 2.5.7, jemalloc-3.6.0-1, glibc-headers-2.17-292:
$ make
[ 1%] Building CXX object src/CMakeFiles/rhtml_lib.dir/rhtml.cpp.o
In file included from /opt/ruby25/include/ruby/ruby-2.5.0/ruby/missing.h:25:0,
from /opt/ruby25/include/ruby/ruby-2.5.0/ruby/defines.h:154,
from /opt/ruby25/include/ruby/ruby-2.5.0/ruby/ruby.h:29,
from /opt/ruby25/include/ruby/ruby-2.5.0/ruby.h:33,
from /root/mod_ruby/src/ruby.hpp:5,
from /root/mod_ruby/src/rhtml.cpp:3:
/usr/include/jemalloc/jemalloc.h:137:46: error: declaration of ‘void* malloc(size_t)’ has a different exception specifier
JEMALLOC_EXPORT void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
^
In file included from /opt/ruby25/include/ruby/ruby-2.5.0/ruby/defines.h:120:0,
from /opt/ruby25/include/ruby/ruby-2.5.0/ruby/ruby.h:29,
from /opt/ruby25/include/ruby/ruby-2.5.0/ruby.h:33,
from /root/mod_ruby/src/ruby.hpp:5,
from /root/mod_ruby/src/rhtml.cpp:3:
/usr/include/stdlib.h:465:14: error: from previous declaration ‘void* malloc(size_t) throw ()’
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
^
The ruby package was compiled with jemalloc included, so my /opt/ruby25/include/ruby/ruby-2.5.0/x86_64-linux/ruby/config.h
has:
#define HAVE_LIBJEMALLOC 1
#define RUBY_ALTERNATIVE_MALLOC_HEADER <jemalloc/jemalloc.h>
That trickles down to mod_ruby's #include <ruby.h>
to include the jemalloc.h:
JEMALLOC_EXPORT void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
and then it does an #include <stdlib.h>
which defines malloc as:
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
We had no problems with the ruby install itself. jemalloc seems to be working fine with it. I've also seen some references that jemalloc v3.6 is a little old, and some of these things were fixed in v4 and later. However, it's been difficult to find an actual RPM distro of jemalloc for C7 that's not from the standard EPEL repo. (Compiling from source isn't really an option, as these will be production machines maintained with puppet)
My next approach was to try and find a way to undefine HAVE_LIBJEMALLOC
from the mod_ruby compilation, but overriding the defines in ruby's config.h
is proving to be very difficult.
You have any advice on what to do here?
Thanks!
Hi,
I'm trying to install mod_ruby on a Ubuntu 14.04 system. I could run cmake ., but got an error saying that rhtml.yy.cpp could not be found.
When I try to run the make command, I get "
make[1]: src/CMakeFiles/rhtml_lib.dir/build.make: File or directory not found
make[1]: *** No rule to create »src/CMakeFiles/rhtml_lib.dir/build.make«. End.
Any help welcome.
Thanks,
Francesco.
Hi @mikeowens,
I'm having another really odd problem that's difficult to troubleshoot. While I don't think this issue is specific to mod_ruby, it has something to do with mod_ruby triggering behavior in either Apache or Passenger which sets the environment varaibles PATH_INFO
and SCRIPT_NAME
to the incorrect paths.
I'm not able to recreate it with docker, so I'm going to try my best on describing my setup.
This is running ruby 2.5.8p224, Passenger 6.0.4, Apache 2.4.6-90 (CentOS 7), and the freshest mod_ruby master code.
<VirtualHost *:80>
ServerName internal.myname.com
RailsEnv development
PassengerEnabled off
<Location ~ "/^myapp">
PassengerEnabled on
PassengerAppRoot /home/httpd/myapp/dev
</Location>
</VirtualHost>
Simple sinatra app:
module HTTP_Auth
class Server < Sinatra::Base
get '/get_domain/test' do
ENV.inspect # runs
end
get '/myapp/get_domain/test' do
ENV.inspect # never runs
end
$ curl http://internal.myname.com/myapp/get_domain/test
...
"REQUEST_URI"=>"/myapp/get_domain/test",
"SCRIPT_NAME"=>"/myapp"
"PATH_INFO"=>"/get_domain/test"
When mod_ruby.so is loaded, something triggers the SCRIPT_NAME
and PATH_INFO
paths to be populated, and they're incorrect. Sinatra and Rails seem to short circuit whatever they do and trust the PATH_INFO
variable, which doesn't match any of the routing regex rules. All of our apps are written with the awareness of the full path, and expect /myapp/whatever
to be the scope for all of the routing config.
If I comment out loading mod_ruby.so, none of those variables are present, and the apps (Sinatra and Rails) still correctly determine the paths and work normally.
How can I forcefully disable Apache from attempting to parse and set these variables? I've tried messing with AcceptPathInfo, but nothing worked. I've tried poking through the mod_ruby initialization and Apache source to see what might affect triggering the PATH_INFO
and SCRIPT_NAME
, but haven't found anything useful yet.
Any advice you have here would be appreciated!
Hi,
let me add a few notes for those who do not have Ruby installed in the assumed default location and who are less versed in the ins and outs of Linux.
I am still a beginner, but I have done source compilations/installations before. This one here gave me a hard time.
So I'd like to give some advice to those who want to install this package:
I installed mod_ruby on Ubuntu Linux 14.04 LTE. Apache 2 was already installed. My Ruby version is 2.2.3.
Regarding the instructions listed here under "Building":
RUBY_INCLUDE_DIR must be set to the path in which your ruby.h file is located. This is usually a subdirectory named /include.
There are other variables that must be adapted. One points to the Ruby executable (interpreter program).
Then there are several references to libruby.a. Correct these path entries as well.
Run the command again. Make sure it terminates without errors.
Then copy the MakefileCache.txt under a different name in the same directory. You'll see why in step 5.
I tested mod_ruby by running a small ruby script from my web browser. It worked.
I have written this information on basis of a few handwritten notes.
So feel free to reply if I've missed something. I'am sure, however, that this information
will be helpful if you're in the same situation.
Regards,
FSoprano
OS: CentOS 6.5 minimal
Apache 2.2.15
#cmake
.#make
, but it can't find APR sources../include/apr.h
try to include apr-1.0/*.h
, but on CentOS it has name apr-1/*.h
#make
again and...mod_ruby/src/ruby.cpp:2:27: error: ruby/encoding.h: No such file or directory
root@rabbit-6 mod_ruby]# ls ./src/ruby/
modruby modruby.rb
So, where i can find encoding.h ?
find / -regex '.*encoding.h'
puts nothing...
I see, that last commit was 7 month ago, but i can make Issue, innit?)
PS: Sorry for my english
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.