Rubygems user install of extensions

Hello,

My problem is that I am trying to run a gems installation as a non-root
user, and this doesn’t work out-of-the-box for any gems that include the
building of extensions with mkmf. For each gem (example: mongrel), I
need
to add the following lines to extconf.rb:

require ‘etc’
user = ENV[‘USER’]
group = Etc.getpwnam(user).gid

module Config
MAKEFILE_CONFIG[“INSTALL”] = “/usr/bin/install -c -o #{user} -g
#{group}”
end

and regenerate the gem.

I was wondering if anyone else ran into a similar problem when
installing a
gem that included extensions? Do you have other solutions? Is there
any
way of specifying MAKEFILE_CONFIG[“INSTALL”] in .gemrc, for example?

This happens with both 0.8.11 and svn trunk of rubygems (I applied
Tilman
Sauerbeck’s patch from
http://rubyforge.org/pipermail/rubygems-developers/2006-July/002056.html,
to
solve an unrelated problem).

(This is obviously on UNIX, FreeBSD in my case; I don’t know if
something
similar would have to be done for Windows.)

Thanks for taking the time.

  • Dimitri

Hi,

At Mon, 25 Sep 2006 23:44:20 +0900,
Dimitri A. wrote in [ruby-talk:216293]:

MAKEFILE_CONFIG[“INSTALL”] = “/usr/bin/install -c -o #{user} -g #{group}”
end

INSTALL should not have -o and -g options by default. Why do
you need those options? Does your /usr/bin/install want to
change owner and group even if run by a non-root user?

Hi,

On 10/1/06, Nobuyoshi N. [email protected] wrote:

INSTALL should not have -o and -g options by default. Why do
you need those options? Does your /usr/bin/install want to
change owner and group even if run by a non-root user?

This is from the standard ports install on FreeBSD. I’ve also posted to
rubygems-developers and was able to narrow it down to ports’ way of
setting
this variable, i.e. it doesn’t do this on Linux. So, seeing this as a
ports
problem, I created a PR
(103801 – lang/ruby18: unprivileged rubygems install of gems with extensions fails),
and hope for a resolution soon. In the meantime, does anyone know of a
standard rubygems way to override this or any other variable in the
.gemrc
file?

  • Dimitri

Hi,

At Mon, 2 Oct 2006 16:37:08 +0900,
Dimitri A. wrote in [ruby-talk:217631]:

This is from the standard ports install on FreeBSD. I’ve also posted to
rubygems-developers and was able to narrow it down to ports’ way of setting
this variable, i.e. it doesn’t do this on Linux. So, seeing this as a ports
problem, I created a PR (103801 – lang/ruby18: unprivileged rubygems install of gems with extensions fails),
and hope for a resolution soon. In the meantime, does anyone know of a
standard rubygems way to override this or any other variable in the .gemrc
file?

You could override the definition in Makefile by make
INSTALL=‘/usr/bin/install -c’.

BTW, do ports have to be built by root? For instance, RPM used
to be built by an ordinary user and ownerships are described in
spec files.

Hi,

On 10/3/06, [email protected] [email protected] wrote:

You could override the definition in Makefile by make
INSTALL=‘/usr/bin/install -c’

Thanks for the tip! I ran across this problem when installing gems that
compiled extensions, though. I know of no way to override this in the
gem
environment. So, my workaround is to edit rbconfig.rb and correct the
CONFIG[“INSTALL”] line.

BTW, do ports have to be built by root? For instance, RPM used
to be built by an ordinary user and ownerships are described in
spec files.

AFAIK, they do not have to be built by root, but do need to be
installed
by root. My practise is to do a ‘make install’ in the appropriate ports
directory, as this will also take in all dependencies and install them.
I
haven’t tried it using ‘sudo’, though.

  • Dimitri