Issue #7036 has been updated by luislavena (Luis Lavena).

File disable-libpathflag-mingw.diff added

usa (Usaku NAKAMURA) wrote:
> Building something with the path containing spaces is not recommended, IMO.
> (see the end of win32/README.win32)
> 

And I completely agree.

However, while README, RubyInstaller and Wiki instructions RubyInstaller project clearly state this issue, users still install things into Program Files and rant when it fails to compile gems.

This results in a not so great first experience that technically could be solved by simply quoting paths that contain spaces in them.

Attached patch to configure.in solves extension linking issue by always using -L"%s", even on non-spaced path still works properly.

But my suggestion about quote $ruby in mkmf.rb do not work because extmk sets it as using MINIRUBY and that gets improperly quoted, breaking extension compilation during make exts.

Nobu, it will be great if we can have your opinion and help on this.

Thank you Usa for your feedback.

----------------------------------------
Bug #7036: Compiling extensions with Ruby in a path with spaces
https://bugs.ruby-lang.org/issues/7036#change-29498

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: misc
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-16 trunk 36983) [i386-mingw32]


=begin
Hello,

This has been reported several times to RubyInstaller: inability to install gems when Ruby has been installed in a path with spaces (e.g. (({C:\Program Files})))

Since this is presented to the user as (({gem install})) error, a deeper investigation revealed:

Generated Makefile contains a reference to (({RUBY})) that is not quoted, resulting in errors like this:

 V:\User Name\ruby-2.0.0dev-i386-mingw32\lib\ruby\gems\2.0.0\gems\json-1.7.5\ext\json\ext\generator>make
 generating generator-i386-mingw32.def
 /bin/sh: V:/User: No such file or directory
 make: *** [generator-i386-mingw32.def] Error 127

This can be easily solved by doing:

 ruby = #{$ruby.quote}

The second issue is more complicated, as is caused by (({$LIBPATH})) and (({libdir})):

 linking shared-object json/ext/generator.so
 gcc.exe: error: Name/ruby-2.0.0dev-i386-mingw32/lib: No such file or directory
 make: *** [generator.so] Error 1

While (({LIBPATH})) is being built using (({libpathflag})) method, this method fails to detect path with spaces since it uses (({LIBPATHFLAG})) from rbconfig

Since mkmf finds the above mentioned key in (({RbConfig::CONFIG})), it never attempts to use -L"%s" alternative:

  LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'

Now, (({libpathflag})) do not detect a path with spaces because the array of options given are (({[".", "$(libdir)"]})).

In the case of Windows, LIBPATHFLAG shouldn't be hardcoded, or at least should always quote strings, considering Ruby can be relocated.

Nobu, Usa, Hiroshi, what are your thoughts about this?

I'm looking for some feedback before I start some modifications.

Thank you in advance for your time.
=end


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