From: "mame (Yusuke Endoh)" <mame@...>
Date: 2013-02-20T15:15:57+09:00
Subject: [ruby-core:52561] [ruby-trunk - Bug #7860] Passing --libdir to ./configure causes Gem.ruby to point to an incorrect ruby interpreter path


Issue #7860 has been updated by mame (Yusuke Endoh).


> Please revert it if wrong.

Please don't try to get retrospective approval ;-(

r39320 seems very subtle (actually it caused cascading fixes on trunk).
I'm afraid if it affects other platforms.

Eric Hodel,
Do you understand the fix?  It is related to rubygems (according to this ticket).

Chris White, Jon Forums,
Can you check the current ruby_2_0_0 branch and make sure that your issue(s) is really fixed?

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7860: Passing --libdir to ./configure causes Gem.ruby to point to an incorrect ruby interpreter path
https://bugs.ruby-lang.org/issues/7860#change-36649

Author: cwgem (Chris White)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2013-02-16 trunk 39262) [x86_64-linux]


How I reproduce:

------------------------------------
# git clone git://github.com/ruby/ruby.git
# autoreconf
# ./configure --libdir=/usr/local/lib64
# make clean && make && make install
# /usr/local/bin/ruby -e 'puts Gem.ruby'
/bin/ruby
------------------------------------

The problem is how topdir is set with `tool/mkconfig.rb`. This is a diff between `./configure` and `./configure --libdir=/usr/local/lib64`:

------------------------------------------------------------------------------------------
--- /root/rbconfig.rb   2013-02-15 15:20:15.016942074 -0800
+++ /usr/local/lib64/ruby/2.0.0/x86_64-linux/rbconfig.rb        2013-02-15 15:14:20.500932606 -0800
@@ -6,7 +6,7 @@
   RUBY_VERSION == "2.0.0" or
     raise "ruby lib version (2.0.0) doesn't match executable version (#{RUBY_VERSION})"
 
-  TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/2.0.0/x86_64-linux")
+  TOPDIR = File.dirname(__FILE__).chomp!("/usr/local/lib64/ruby/2.0.0/x86_64-linux")
   DESTDIR = '' unless defined? DESTDIR
   CONFIG = {}
   CONFIG["DESTDIR"] = DESTDIR
@@ -35,7 +35,7 @@
   CONFIG["rubyhdrdir"] = "$(includedir)/$(RUBY_VERSION_NAME)"
   CONFIG["UNIVERSAL_INTS"] = ""
   CONFIG["UNIVERSAL_ARCHNAMES"] = ""
-  CONFIG["configure_args"] = ""
+  CONFIG["configure_args"] = " '--libdir=/usr/local/lib64'"
   CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
   CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
   CONFIG["vendordir"] = "$(rubylibprefix)/vendor_ruby"
@@ -199,7 +199,7 @@
   CONFIG["DEFS"] = ""
   CONFIG["mandir"] = "$(datarootdir)/man"
   CONFIG["localedir"] = "$(datarootdir)/locale"
-  CONFIG["libdir"] = "$(exec_prefix)/lib"
+  CONFIG["libdir"] = "$(DESTDIR)/usr/local/lib64"
   CONFIG["psdir"] = "$(docdir)"
   CONFIG["pdfdir"] = "$(docdir)"
   CONFIG["dvidir"] = "$(docdir)"
------------------------------------------------------------------------------------------

Notice how topdir changes. I think this might have been caused by the `tool/mkconfig.rb` changes here:

https://github.com/ruby/ruby/commit/29c214e4a058fc4017ab0c0bf5c36b5bad203b5b


-- 
http://bugs.ruby-lang.org/