5

While trying to install ImageMagick on Windows through msys.bat by running

ruby setup.rb install

I'm getting this error:

setup.rb:787: use rbconfig instead of obsolete and deprecated config.
no such file or directory -.config
setup.rb config first
Try ruby setup.rb --help for detailed usage

2 Answers 2

2

RbConfig is a Module which gives access to mostly compile time properties of the current Ruby implementation. To use RbConfig one has to require 'rbconfig'. In earlier versions of Ruby this class was just called Config and was loaded through require 'config'. When trying to use Config nowadays, Ruby will give out a deprecation warning.

Go into your setup.rb into line 787. There you will probably find a require 'config'. Change that into a require 'rbconfig'. If that doesn't make the script run or there are still warnings, search and replace usages of the Config module with RbConfig. Then Ruby will shut up.

The problem probably only appears the software you are trying to compile is not up to date. I guess an even better way to make it work would be to find a more current version of it, which may solve additional problems.

4
  • just a little side question: could anyone tell me why on windows I do not need to require 'rbconfig' to use say: puts RbConfig::CONFIG['host_os'] (which correctly outputs: mingw32)? ruby -v #=> ruby 1.9.3p28 Thanks.
    – red-o-alf
    Mar 8, 2013 at 18:29
  • 2
    where is the setup.rb on linux?
    – jpganz18
    May 2, 2013 at 22:23
  • @jpganz18 setup.rb should be provided by the software package to be compiled in is usually in the base directory of the distributed archive.
    – aef
    Sep 7, 2013 at 14:40
  • 1
    @jj_ There are a lot of different binary distributions of Ruby for Windows which ship with various tweaks. Most probably any of these tweaks is automatically executed before your actual code is executed. This tweak may already have executed the line require 'rbconfig'
    – aef
    Sep 7, 2013 at 14:42
1

Had same problem solved it through:

@aef's answer and ther changing the file to look like below:

require 'tempfile'

if i = ARGV.index(/\A--rbconfig=/) then
  file = $'
  ARGV.delete_at(i)
  require file
  require 'rbconfig'
else
  require 'rbconfig'
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.