Moving Ruby installation can cause it to be unable to run. How to solve this problem?

I want to compile Ruby from source code, install it, and then move and install it elsewhere.

For example:

ruby-1.9.3-p125$./configure --prefix=/tmp/ruby-1.9.3-p125

The problem is that it seems that the –prefix path is in the Ruby binary Hard-coded. When I moved /tmp/ruby-1.9.3-p125 to /opt/ruby-1.9.3-p125, the hard-coded path appeared in the installed binaries and scripts.

< p>After moving, I received an error:

<internal:gem_prelude>:1:in `require': cannot load such file - rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'

How can I bypass this?

Found that the solution is to use –enable-load-relative

p>

So instead:

./configure

Run:

./ configure --enable-load-relative

I want to compile Ruby from source code, install it, and then move and install it elsewhere.

For example:

ruby-1.9.3-p125$./configure --prefix=/tmp/ruby-1.9.3-p125

Problems Yes, it seems that the –prefix path is hard-coded in the Ruby binary. When I move /tmp/ruby-1.9.3-p125 to /opt/ruby-1.9.3-p125, the hard-coded path appears in the installed In the binary files and scripts.

After moving, I received an error:

<internal:gem_prelude>:1:in `require': cannot load such file - rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'

How can I bypass this?

The solution is to use –enable-load-relative when running configure

So instead:

./configure

Run:

./configure --enable-load-relative

Leave a Comment

Your email address will not be published.