From: xtkoba+ruby@... Date: 2021-04-09T22:18:06+00:00 Subject: [ruby-core:103359] [Ruby master Bug#16651] Extensions Do Not Compile on Mingw64 with mingw64-make Issue #16651 has been updated by xtkoba (Tee KOBAYASHI). I suppose it is by luck that `arch_hdrdir` of the form `C:/foo/bar` is not causing problems with `make` from MSYS. In fact, in my environment (not Windows) `gem install rails && rails new foo` succeeds when `VPATH` is modified such that it does not contain `$(arch_hdrdir)/ruby`, or not even `$(hdrdir)/ruby`. I wonder if any extension in the world requires these paths contained in `VPATH`. The proposed modification might be OK for `make` from MSYS if the definition of `VPATH` can be modified so that it never contains any drive letters. Note that some extensions (e.g. [sassc](https://github.com/sass/sassc-ruby)) add additional paths to `VPATH`. And assuming that the modification is applied, I doubt if `mingw32-make` will successfully build an extension which really depends on `VPATH` containing multiple paths. user:cfis Could you please try to `gem install sassc` with `mingw32-make`? If it really does not work with multiple paths in `VPATH`, then it should fail to build that extension. Unfortunately I do not have access to Windows machines connected to the Internet. ---------------------------------------- Bug #16651: Extensions Do Not Compile on Mingw64 with mingw64-make https://bugs.ruby-lang.org/issues/16651#change-91450 * Author: cfis (Charlie Savage) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- When mkmf.rb creates a Makefile for an extension, it will generate something that looks like this: ```makefile srcdir = . topdir = C/MSYS64/USR/LOCAL/ruby-2.7.0/include/ruby-2.7.0 hdrdir = $(topdir) arch_hdrdir = C:/MSYS64/USR/LOCAL/ruby-2.7.0/include/ruby-2.7.0/x64-mingw32 ``` Notice the topdir path is c/ without the ":" Its only the topdir that does this, all other paths in the makefile use the "c:/" style. mkmf.rb intentionally does that, see line 1098: ```ruby def mkintpath(path) # mingw uses make from msys and it needs special care # converts from C:\some\path to /C/some/path path = path.dup path.tr!('\\', '/') path.sub!(/\A([A-Za-z]):(?=\/)/, '/\1') <-------- This line path end ``` But this is wrong, and causes errors like this (this is compiling the debase gem but it doesn't matter what c extension you use): ``` make: *** No rule to make target 'C/MSYS64/USR/LOCAL/ruby-2.7.0/include/ruby-2.7.0/ruby.h', needed by 'breakpoint.o'. Stop. ``` The fix is simple, just delete that line. The makefile should look like this: ```makefile srcdir = . topdir = C:/MSYS64/USR/LOCAL/ruby-2.7.0/include/ruby-2.7.0 hdrdir = $(topdir) arch_hdrdir = C:/MSYS64/USR/LOCAL/ruby-2.7.0/include/ruby-2.7.0/x64-mingw32 ``` Note I'm not the first person to see this, but I've just been manually fixing it over the years. Would be good to really fix it. https://github.com/oneclick/rubyinstaller2/issues/105 https://github.com/oneclick/rubyinstaller2/issues/47 https://github.com/tmm1/http_parser.rb/issues/55 Note some of those tickets put the blame on using mingw-make versus msys make. But on my system, neither work with the "c/" style path but both work with the "c:/" style path. -- https://bugs.ruby-lang.org/ Unsubscribe: