Bug 203429 - Could rbenv / rvm conflict with ruby gem building?
Summary: Could rbenv / rvm conflict with ruby gem building?
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-29 00:49 UTC by Tony Narlock
Modified: 2015-09-29 10:34 UTC (History)
2 users (show)

See Also:


Attachments
ruby-build output (tree) (927.35 KB, text/plain)
2015-09-29 00:49 UTC, Tony Narlock
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Narlock 2015-09-29 00:49:18 UTC
Created attachment 161510 [details]
ruby-build output (tree)

(In reply to Michael Moll from bug #202999, comment #4)

Could rbenv or rvm's shell sourcing scripts interact with building gems?

I would assume that bsd.ruby.mk would workaround that. I haven't tracked down a prior dialog on this.

This problem could be difficult to diagnose unless the bug submitter detailed they were using this tool.

bsd.ruby.mk seems to look for ruby (as a last resort) in /usr/local/bin/ruby.

In the case of the parent topic, ruby-build (a tool used in unison with rbenv) does two things:

1. Can build ruby by itself, `ruby-build 2.2.2 /usr/local` could overwrite ruby. It would be like building ruby from outside the port and installing it there.

For kicks, I attached what a `ruby-build 2.2.2 ~/ruby` would output. See attachment for output tree.

From this, it looks like it would trash the ruby installed from the system. `pkg-check(8)` would probably go off.

2. It is used by rbenv (giving the rbenv install command) and installs the ruby to ~/.rbenv.

As for environmental variables from rbenv/rvm mangling into port building - I would assume no unless we see issues otherwise.  If ruby gems are getting odd build errors that defy explanation - asking them if they use rbenv/rvm may be pertinent.

To give it a shot, I gave devel/rubygem-ffi a try in rbenv:

tony at z600 in ~ 
$ cd /usr/ports/devel/rubygem-ffi

tony at z600 in /usr/ports/devel/rubygem-ffi 
$ ls
Makefile  distinfo  pkg-descr

tony at z600 in /usr/ports/devel/rubygem-ffi 
$ rbenv which ruby
/usr/home/tony/.rbenv/versions/2.2.2/bin/ruby

tony at z600 in /usr/ports/devel/rubygem-ffi 
$ ruby --version  
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-freebsd11.0]

tony at z600 in /usr/ports/devel/rubygem-ffi 
$ make config
===> No options to configure

$ sudo make

RubyGems installed the following executables:
	/usr/ports/devel/ruby-gems/work/stage/usr/local/bin/gem21

Ruby Interactive (ri) documentation was installed. ri is kind of like man 
pages for ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

====> Compressing man pages (compress-man)
===>  Installing for ruby21-gems-2.4.8
===>  Checking if ruby21-gems already installed
===>   Registering installation for ruby21-gems-2.4.8 as automatic
Installing ruby21-gems-2.4.8...
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/gem21 - found
===>   Returning to build of rubygem-ffi-1.9.10
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/ruby21 - found
Unpacked gem: '/usr/ports/devel/rubygem-ffi/work/ffi-1.9.10'
===>  Patching for rubygem-ffi-1.9.10
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/ruby21 - found
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/gem21 - found
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/ruby21 - found
===>   rubygem-ffi-1.9.10 depends on shared library: libffi.so - found (/usr/local/lib/libffi.so)
===>  Configuring for rubygem-ffi-1.9.10
===>   FreeBSD 10 autotools fix applied to /usr/ports/devel/rubygem-ffi/work/ffi-1.9.10/ext/ffi_c/libffi/m4/libtool.m4
===>   FreeBSD 10 autotools fix applied to /usr/ports/devel/rubygem-ffi/work/ffi-1.9.10/ext/ffi_c/libffi/configure
===>  Building for rubygem-ffi-1.9.10
  Successfully built RubyGem
  Name: ffi
  Version: 1.9.10
  File: ffi-1.9.10.gem
===>  Staging for rubygem-ffi-1.9.10
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/gem21 - found
===>   rubygem-ffi-1.9.10 depends on file: /usr/local/bin/ruby21 - found
===>   Generating temporary packing list
(cd /usr/ports/devel/rubygem-ffi/work/ffi-1.9.10; /usr/bin/env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 RB_USER_INSTALL=yes /usr/local/bin/gem21 install -l --no-update-sources --install-dir /usr/ports/devel/rubygem-ffi/work/stage/usr/local/lib/ruby/gems/2.1 --ignore-dependencies --bindir=/usr/ports/devel/rubygem-ffi/work/stage/usr/local/bin --rdoc --ri ffi-1.9.10.gem -- --build-args )
Building native extensions with: '--build-args'
This could take a while...
Successfully installed ffi-1.9.10
Parsing documentation for ffi-1.9.10
Installing ri documentation for ffi-1.9.10
Installing darkfish documentation for ffi-1.9.10
Done installing documentation for ffi after 2 seconds
1 gem installed
/bin/rm -f -r /usr/ports/devel/rubygem-ffi/work/stage/usr/local/lib/ruby/gems/2.1/build_info/
/bin/rmdir /usr/ports/devel/rubygem-ffi/work/stage/usr/local/lib/ruby/gems/2.1/extensions 2> /dev/null || true
====> Compressing man pages (compress-man)
Comment 1 Michael Moll freebsd_committer freebsd_triage 2015-09-29 10:34:37 UTC
see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202999#c6 - if it works for you that's fine, it's just not tested in any way.