https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-09-04T08:25:23ZRuby Issue Tracking SystemRuby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=874492020-09-04T08:25:23Zcfis (Charlie Savage)
<ul></ul><p>Ping?</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=882752020-10-29T06:34:23Zcfis (Charlie Savage)
<ul></ul><p>This is still and issue with Ruby 2.7.2.</p>
<p>The offending line of code is now at line 1908 in mkmf.rb.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=882762020-10-29T09:48:30Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>It would replace "C:/MSYS64/..." as "/C/MSYS64/...".<br>
Where did a slash go?</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=902812021-02-06T08:27:01Zcfis (Charlie Savage)
<ul></ul><p>Sorry, missed your comment. The problem is /C/ is <em>wrong</em>.</p>
<p>This is still an issue with Ruby 3.0.0 and causes building extensions to fail.</p>
<p>Install msys2, install mingw64. Then try to build any extension. You'll get this error message:</p>
<pre><code class="bash syntaxhl" data-language="bash"><span class="k">*</span> No rule to make target <span class="s1">'/C/msys64/usr/local/ruby-3.0.0/include/ruby-3.0.0/ruby.h'</span>, needed by <span class="s1">'breakpoint.o'</span><span class="nb">.</span> Stop.
</code></pre>
<p>If you comment out this line:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1')</span>
</code></pre>
<p>Then the paths becomes:</p>
<p>C:/msys64/usr/local/ruby-3.0.0/include/ruby-3.0.0/ruby.h</p>
<p>And the problem is fixed. That is the correct path we want.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=904032021-02-15T21:07:29Zcfis (Charlie Savage)
<ul></ul><p>Any thoughts?</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=905372021-02-21T05:33:02Zxtkoba (Tee KOBAYASHI)
<ul></ul><p>With RubyInstaller's I got the following result in the Command Prompt of Windows 10:</p>
<pre><code>C:\Ruby30-x64\bin>irb
irb(main):001:0> Dir.pwd
=> "C:/Ruby30-x64/bin"
irb(main):002:0> File.exist?("C:/Ruby30-x64")
=> true
irb(main):003:0> File.exist?("C/Ruby30-x64")
=> false
irb(main):004:0> File.exist?("/C:/Ruby30-x64")
=> false
irb(main):005:0> File.exist?("/C/Ruby30-x64")
=> false
irb(main):006:0> File.exist?("c:/Ruby30-x64")
=> true
irb(main):007:0> File.exist?("c/Ruby30-x64")
=> false
irb(main):008:0> File.exist?("/c:/Ruby30-x64")
=> false
irb(main):009:0> File.exist?("/c/Ruby30-x64")
=> false
irb(main):010:0>
</code></pre>
<p>I suppose MSYS2 might be necessary for the notation like <code>/c/</code> [1]. I might be talking nonsense because I don't know about MSYS2 in detail.</p>
<p>[1] <a href="https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/" class="external">https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/</a></p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=912492021-04-02T08:45:41Zcfis (Charlie Savage)
<ul></ul><p>When running msys2 (ie, in an open console) the /c/ notation does work.</p>
<p>But it does not work in makefiles processed by mingw64. If you look at the makefiles that extconf.rb generates, they use paths like c:/abc/def <em>except</em> for this one case. And this one case breaks building extensions if you are using mingw make. Thus this should be changed (note that msys supports the c:/ format also).</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=912522021-04-02T10:55:03Zxtkoba (Tee KOBAYASHI)
<ul></ul><p>This issue is related to commit <a class="changeset" title="* lib/mkmf.rb (mkintpath): new function which converts native path to format acceptable in Make..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/389157d8cfab7b6e84cdcdb2863421bd2c93bd7f">389157d8cfab7b6e84cdcdb2863421bd2c93bd7f</a>, which merged the patch posted as <a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/21448" class="external"><a href="https://blade.ruby-lang.org/ruby-core/21448">[ruby-core:21448]</a></a>. The description of the patch reads that the character <code>:</code> in the path confuses <code>make</code> from MSYS because it is interpreted as a path separator. If this is still true, then we cannot simply leave <code>:</code> unremoved with a drive letter.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=913792021-04-08T06:28:55Zcfis (Charlie Savage)
<ul></ul><p>Thanks for the background, that was very helpful. The difference is that I am using mingw64 make, not msys make. So:</p>
<ul>
<li>
<p>msys make supports <code>/C/msys64/usr/local/ruby-2.7.2/include/ruby-2.7.0</code> and <code>C:/msys64/usr/local/ruby-2.7.2/include/ruby-2.7.0</code></p>
</li>
<li>
<p>mingw make only supports <code>c:/msys64/usr/local/ruby-2.7.2/include/ruby-2.7.0</code></p>
</li>
</ul>
<p>If you look at the generated makefiles (this is from <code>gem install --platform ruby pg</code>):</p>
<pre><code>topdir = /C/msys64/usr/local/ruby-2.7.2/include/ruby-2.7.0
hdrdir = $(topdir)
arch_hdrdir = C:/msys64/usr/local/ruby-2.7.2/include/ruby-2.7.0/x64-mingw32
</code></pre>
<p>Notice the makefiles use both forms of the path.</p>
<p>Bottom line - the patch from 12 years ago is no longer useful. It is not needed for msys make and it breaks mingw-make. So can it be removed?</p>
<p>Thanks - Charlie</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=913802021-04-08T06:44:11Zcfis (Charlie Savage)
<ul><li><strong>Subject</strong> changed from <i>Extensions Do Not Compile on Mingw64</i> to <i>Extensions Do Not Compile on Mingw64 with mingw64-make</i></li></ul> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914052021-04-08T20:31:50Zxtkoba (Tee KOBAYASHI)
<ul></ul><p>I suppose <code>arch_hdrdir</code> also should have been canonicalized by <code>mkintpath</code>, because otherwise it would cause trouble with <code>VPATH</code> in <code>Makefile</code> which is defined as:</p>
<pre><code class="make syntaxhl" data-language="make"><span class="nv">VPATH</span> <span class="o">=</span> <span class="p">$(</span>srcdir<span class="p">)</span>:<span class="p">$(</span>arch_hdrdir<span class="p">)</span>/ruby:<span class="p">$(</span>hdrdir<span class="p">)</span>/ruby
</code></pre>
<p>And I believe that the notation of <code>VPATH</code> as above does not work well with <code>mingw32-make</code>, because <a href="http://mingw.5.n7.nabble.com/mingw32-make-VPATH-doesn-t-work-td6550.html" class="external">it allows only one path</a>.</p>
<p>It seems clear that <code>mingw32-make</code> is not supported in the current build system of Ruby. I doubt if the maintainers have tried to support it ever.</p>
<p>One way of supporting both <code>make</code> from MSYS and <code>mingw32-make</code> would be to stop using <code>VPATH</code>, although I have no idea whether this is possible. FYI, <code>VPATH</code> seems to cause another trouble (Bug <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: Build failure due to VPATH expansion (Open)" href="https://bugs.ruby-lang.org/issues/12179">#12179</a>), and it would be desirable if we could throw it away.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914272021-04-09T07:35:38Zcfis (Charlie Savage)
<ul></ul><p>VPATH works fine with arch_hdrdir in the form <code>c:/msys64/etc</code> - Ruby has been doing that on Windows for many years.</p>
<p>With my proposed fix both msys make and mingw64 make work correctly.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914312021-04-09T10:05:03Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>cfis (Charlie Savage) wrote in <a href="#note-12">#note-12</a>:</p>
<blockquote>
<p>VPATH works fine with arch_hdrdir in the form <code>c:/msys64/etc</code> - Ruby has been doing that on Windows for many years.</p>
</blockquote>
<p>Does it work with different drives too?</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914332021-04-09T10:06:59Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/91433/diff?detail_id=59738">diff</a>)</li></ul> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914502021-04-09T22:18:05Zxtkoba (Tee KOBAYASHI)
<ul></ul><p>I suppose it is by luck that <code>arch_hdrdir</code> of the form <code>C:/foo/bar</code> is not causing problems with <code>make</code> from MSYS. In fact, in my environment (not Windows) <code>gem install rails && rails new foo</code> succeeds when <code>VPATH</code> is modified such that it does not contain <code>$(arch_hdrdir)/ruby</code>, or not even <code>$(hdrdir)/ruby</code>. I wonder if any extension in the world requires these paths contained in <code>VPATH</code>.</p>
<p>The proposed modification might be OK for <code>make</code> from MSYS if the definition of <code>VPATH</code> can be modified so that it never contains any drive letters. Note that some extensions (e.g. <a href="https://github.com/sass/sassc-ruby" class="external">sassc</a>) add additional paths to <code>VPATH</code>. And assuming that the modification is applied, I doubt if <code>mingw32-make</code> will successfully build an extension which really depends on <code>VPATH</code> containing multiple paths.</p>
<p><a class="user active" href="https://bugs.ruby-lang.org/users/91">cfis (Charlie Savage)</a> Could you please try to <code>gem install sassc</code> with <code>mingw32-make</code>? If it really does not work with multiple paths in <code>VPATH</code>, then it should fail to build that extension. Unfortunately I do not have access to Windows machines connected to the Internet.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914562021-04-10T06:18:09Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Building io-console with 2.7.2 from RubyInstaller:</p>
<pre><code class="console syntaxhl" data-language="console"><span class="gp">$</span><span class="w"> </span>ruby <span class="nt">-v</span> ../src/ext/io/console/extconf.rb
<span class="go">ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]
checking for HAVE_RUBY_FIBER_SCHEDULER_H... no
checking for rb_scheduler_timeout()... no
creating Makefile
</span><span class="gp">$</span><span class="w"> </span><span class="nb">grep</span> <span class="nt">-e</span> ^topdir <span class="nt">-e</span> ^arch_hdrdir Makefile
<span class="go">topdir = /C/Ruby27-x64/include/ruby-2.7.0
arch_hdrdir = C:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32
</span><span class="gp">$</span><span class="w"> </span>make
<span class="go">compiling ../src/ext/io/console/console.c
linking shared-object io/console.so
</span></code></pre>
<p>It succeeds with no problem.</p>
<p><code>/C/</code> is not wrong in msys make, I'm not sure why the first description had the wrong path without the leading slash.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914802021-04-11T13:02:21Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Subject</strong> changed from <i>Extensions Do Not Compile on Mingw64 with mingw64-make</i> to <i>Extensions Do Not Compile on Mingw64 with mingw32-make</i></li><li><strong>Backport</strong> changed from <i>2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN</i> to <i>2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED</i></li></ul><p>MinGW on MSys build is cross compilation.<br>
No reason to use <code>mingw32-make</code>, which isn't for the build OS.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=914812021-04-11T13:02:49Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="mkmf.rb: convert also arch_hdrdir [Bug #16651]" href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/799ea1d1540aca03542ee31647052343507a4b41">git|799ea1d1540aca03542ee31647052343507a4b41</a>.</p>
<hr>
<p>mkmf.rb: convert also arch_hdrdir [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Extensions Do Not Compile on Mingw64 with mingw32-make (Closed)" href="https://bugs.ruby-lang.org/issues/16651">#16651</a>]</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=916702021-04-23T04:23:21Zcfis (Charlie Savage)
<ul></ul><p>To answer the questions above:</p>
<ul>
<li>gem install sassc works fine</li>
<li>using different drives, d:/ works fine</li>
</ul>
<p>I don't understand the reason for this change - it just makes building on mingw64 with mingw-64 on windows more broken. If the format c:/ didn't work, then every native gem would have failed to compile because arch_hdrdir used that style. So clearly it does work.</p>
<p>Thus arch_hdrdir should not be changed, and instead topdir should have changed.</p> Ruby master - Bug #16651: Extensions Do Not Compile on Mingw64 with mingw32-makehttps://bugs.ruby-lang.org/issues/16651?journal_id=921022021-05-22T07:28:01Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED</i> to <i>2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE</i></li></ul><p>ruby_3_0 5e21726cda22e3cb34127751aec7e9babb4308b3 merged revision(s) 799ea1d1540aca03542ee31647052343507a4b41.</p>