Thin/eventmachine non-root installation problem

2019-06-14 16:26发布

问题:

Trying to run ruby on rails framework under nginx+thin, currently working under WEBrick.

I don't have root access, cause it is hosted at web hosting service.

Till this moment all problems with gems solved w/o root access.

thin requires eventmachine, so:

$ gem install eventmachine

Building native extensions.  This could take a while...
ERROR:  Error installing eventmachine:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby18 extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... yes
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile

make
<cutted non-informative output>

make install
/usr/bin/install -c -o root -g wheel -m 0755 rubyeventmachine.so /www/<hostname>/.gems/gems/eventmachine-0.12.10/lib
install: /www/<hostname>/.gems/gems/eventmachine-0.12.10/lib/rubyeventmachine.so: chown/chgrp: Operation not permitted
*** Error code 71

Stop in /www/<hostname>/.gems/gems/eventmachine-0.12.10/ext.


Gem files will remain installed in /www/<hostname>/.gems/gems/eventmachine-0.12.10 for inspection.
Results logged to /www/<hostname>/.gems/gems/eventmachine-0.12.10/ext/gem_make.out

Versions of ruby and installed gems:

$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-freebsd8]

$ gem list
activesupport (3.0.9)
backports (2.2.1)
bin (0.6.3)
bson (1.3.1)
i18n (0.4.2)
mongo (1.0.9)
rack (1.1.1)
rake (0.8.7)
rake-compiler (0.7.9)
ruby-augeas (0.3.0)
rubygems-update (1.8.5)
sources (0.0.2)
specific_install (0.2.3)
yard (0.7.2)

I didn't really figured out, is the problem in ERROR: Failed to build gem native extension. or in make install ***Error code 71.

Same thing happens trying $ gem install thin

回答1:

The error is ERROR: Failed to build gem native extension.. Usually it means something is missing in your system. Ruby development libraries or a dependency of the gem. In this particular case i think libevent (its a dependency of eventmachine) is not in your system.

You will find a complete description of what went wrong at: /www/<hostname>/.gems/gems/eventmachine-0.12.10/ext/gem_make.out



回答2:

Thanks for advice, Pablo!

Unfortunately, gem_make.out contained only information I provided, nothing else...

Due to rubyforge bugtracker aboud freebsd, I realised that adding this line to .bashrc solves the problem

export RB_USER_INSTALL="$USER"

After source .bashrc I successfully installed both eventmachine and thin.