Issue #8130 has been reported by agarie (Carlos Agarie).

----------------------------------------
Backport #8130: ArgumentError being thrown when using find_library
https://bugs.ruby-lang.org/issues/8130

Author: agarie (Carlos Agarie)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Hi,

I'm a contributor to SciRuby and I'm currently working on NMatrix, a numerical linear algebra library that uses LAPACK and ATLAS. I was compiling it with Ruby 2.0.0p0 installed through RVM and had a problem I didn't have when using 1.9.3:

/Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:893:in `%': too many arguments for format string (ArgumentError)
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:893:in `block in checking_for'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels) in postpone'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:307:in `open'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpone'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:307:in `open'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
	from /Users/carlosagarie/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:969:in `find_library'
	from ../../../../ext/nmatrix/extconf.rb:124:in `<main>'

The complete output can be found in this gist: https://gist.github.com/agarie/5202139#file-gistfile1-sh. And extconf.rb:124 contains the following:

find_library("lapack", "clapack_dgetrf", "/usr/local/lib", "/usr/local/atlas/lib")

I couldn't find a note on the 2.0 changelog about something that could have "broken" it.

I can get it working by commenting lines 893 and 896 of mkmf.rb, which are explicitly shown in this gist: https://gist.github.com/agarie/5202139#file-gistfile2-rb.

And this is the mkmf.log: https://gist.github.com/agarie/5202139#file-mkmf-log

Regarding ruby version:

$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin11.4.2]

I also couldn't find a similar bug on the issue tracker or on Google.  And to reproduce the error:

$ git clone git://github.com/SciRuby/nmatrix.git
$ cd nmatrix
$ bundle install
$ bundle exec rake compile

It might give other problems because of the libraries necessary for installation. I'm trying to come up with a simpler script that reproduces this error -- I'll update this ticket as soon as I'm successful.

Another thing is that when using 1.9.3-p392 and doing the same set of steps, it works correctly.

Thanks for your time.


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