Git Product home page Git Product logo

modruby's People

Contributors

calh avatar mikeowens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

modruby's Issues

jemalloc compile error on CentOS 7

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!

Makefile error

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.

PATH_INFO / SCRIPT_NAME with mod_ruby

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!

A few tips for those who encounter package installation problems

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":

  1. First download and unpack the mod_ruby package in a local directory.
  2. Change to the highest directory in the package subtree
    (the name is probably identical with the name of the package; later on, I'll call it package directory).
  3. /usr/lib/pbuilder/pbuilder-satisfydepends
    I did not have pbuilder on my system, so I had to install it: sudo apt-get install pbuilder
    If you run the satisfydepends command, you'll probably get a few notifications about missing packages.
    Install these as well. Then run the command again. It should exit without errors.
  4. fakeroot debian/rules (from the package directory)
    This one checks on all sorts of prerequisites. It'll probably terminate with an error regarding a missing variable: RUBY_INCLUDE_DIR.
    This happens if Ruby is not installed where expected. My Ruby version is in /usr/local/src. That location is different from the one assumed in the preset variables.
    Having run the fakeroot command once, you can edit the environment variables in a file called MakefileCache.txt. It's in package directory.

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.

  1. dpkg-buildpackage
    Run this command from the package directory.
    I guess it does various kinds of building, but will exit with the same error as under 4:
    RUBY_INCLUDE_DIR not found. This is because the command creates its own version of MakefileCache.txt, and thus
    overwrites the one you've adapted to run the fakeroot command under 4 with a fresh copy that contains the default values again.
    fakeroot debian/rules seems to be executed once more as part of the dpkg-buildpackage command. Since the command will always overwrite your variable settings in MakefileCache.txt, it's no use to continue with this command. If you follow the console output, you'll see that the program fails while executing cmake .
    So this is how you should continue.
  2. Rename the backup copy of MakefileCache.txt, which you saved under a different name in step 4., back to MakefileCache.txt.
    Then run cmake .
  3. make
    This one should run without errors.
  4. sudo make install
    (sudo is required here because the execution requires and sets a number of permissions.).
    It should also finish without errors.

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

APR Sources path and encoding.h

OS: CentOS 6.5 minimal
Apache 2.2.15

  • I run #cmake .
  • Then i try to #make, but it can't find APR sources.
    Question is: how can i set path to it for cmake?
    Package apr-devel installed and mod_ruby for apache1 makes fine.
    As i noticed, ./include/apr.h try to include apr-1.0/*.h, but on CentOS it has name apr-1/*.h
    So, i correct it and #make again and...
    face with mod_ruby/src/ruby.cpp:2:27: error: ruby/encoding.h: No such file or directory
    So:
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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.