Bug #7860

Passing --libdir to ./configure causes Gem.ruby to point to an incorrect ruby interpreter path

Added by Chris White over 2 years ago. Updated about 2 years ago.

[ruby-core:52296]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
ruby -v:ruby 2.0.0dev (2013-02-16 trunk 39262) [x86_64-linux] Backport:

Description

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


Related issues

Related to Ruby trunk - Bug #7871: exec_prefix regression breaks mingw Closed 02/17/2013

Associated revisions

Revision 39267
Added by Nobuyoshi Nakada over 2 years ago

configure.in: unexpand exec_prefix etc

  • configure.in: unexpand arch sitearch and exec_prefix values, so directly specified bindir, libdir, rubyprefix, etc can be properly substituted. [Bug #7860]

Revision 39267
Added by Nobuyoshi Nakada over 2 years ago

configure.in: unexpand exec_prefix etc

  • configure.in: unexpand arch sitearch and exec_prefix values, so directly specified bindir, libdir, rubyprefix, etc can be properly substituted. [Bug #7860]

Revision 39273
Added by Nobuyoshi Nakada over 2 years ago

configure.in: don't substitute exec_prefix itself

  • configure.in (shvar_to_cpp): do not substitute exec_prefix itself with RUBY_EXEC_PREFIX, which cause recursive definition. [Bug #7860]

Revision 39273
Added by Nobuyoshi Nakada over 2 years ago

configure.in: don't substitute exec_prefix itself

  • configure.in (shvar_to_cpp): do not substitute exec_prefix itself with RUBY_EXEC_PREFIX, which cause recursive definition. [Bug #7860]

History

#1 Updated by Nobuyoshi Nakada over 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

This issue was solved with changeset r39267.
Chris, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


configure.in: unexpand exec_prefix etc

  • configure.in: unexpand arch sitearch and exec_prefix values, so directly specified bindir, libdir, rubyprefix, etc can be properly substituted. [Bug #7860]

#2 Updated by Nobuyoshi Nakada over 2 years ago

  • Assignee set to Yusuke Endoh
  • Category set to build
  • Target version set to 2.0.0
  • Status changed from Closed to Assigned

I think this will be necessary for 2.0.0.
revisions are r39267,39273,39294,39298,39313.

#4 Updated by Nobuyoshi Nakada over 2 years ago

Sorry, patches for tool/mkconfig.rb are not necessary as long as libdir is under exec_prefix.

And the case libdir is outside exec_prefix is not supported in trunk.
TMP_RUBY_PREFIX would be needed to fix it.

#5 Updated by Yusuke Endoh over 2 years ago

  • Assignee changed from Yusuke Endoh to Nobuyoshi Nakada

Too many! Are they all essential?
Could you please show me one minimum and clean patch?

Yusuke Endoh mame@tsg.ne.jp

#6 Updated by Nobuyoshi Nakada over 2 years ago

The former 4 commits are needed, and the last is fix of commit miss in Changelog.

And, I've backported them for [Bug #7871].
Please revert it if wrong.

#7 Updated by Yusuke Endoh over 2 years ago

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

#8 Updated by Eric Hodel over 2 years ago

I don't know enough about autoconf to understand the fix.

I don't believe it will cause any problems with RubyGems though.

#9 Updated by Jon Forums about 2 years ago

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

mame-san...ruby_2_0_0@39344 solves these recent issues on my x86_64-linux (ubuntu server 12.10) machine. I will build i686-linux later tonight and report back if any errors.

  • exec_prefix regression
  • gem {install,update} --user-install errors

#10 Updated by Yusuke Endoh about 2 years ago

Oops, this caused #7915...
I'm now keen to revert the bunch of patches. What do you think?

Yusuke Endoh mame@tsg.ne.jp

#11 Updated by Yusuke Endoh about 2 years ago

  • Status changed from Assigned to Closed

I talked with nobu, and he said he could not reproduce #7915.
I decided to leave the backport as is. Sorry if my decision is wrong...

I'm closing this ticket.

Yusuke Endoh mame@tsg.ne.jp

Also available in: Atom PDF