I have experienced this a few times trying to install different gems using 32 bit ruby, this time I upgraded to Ruby 3.1.2 in hopes it would be resolved
Specifically it appears that either gem maintainers, or the maintainer of MSYS/MINGW dont wrap the Program Files path in quotes, so the space in the folder name seems to be crashing the script.
Would be grateful for any solutions
PS C:\Users\alilland\Documents\dev\scheduler2.0> gem install bson -v 4.12.1
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing bson:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:/Ruby31/bin/ruby.exe -I C:/Ruby31/lib/ruby/site_ruby/3.1.0 extconf.rb
creating Makefile
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:Program Files \(x86\)GnuWin32binmake.exe DESTDIR\= sitearchdir\=./.gem.20221013-364-mygij2 sitelibdir\=./.gem.20221013-364-mygij2 clean
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:Program Files \(x86\)GnuWin32binmake.exe DESTDIR\= sitearchdir\=./.gem.20221013-364-mygij2 sitelibdir\=./.gem.20221013-364-mygij2
make failedNo such file or directory - C:Program
Gem files will remain installed in C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1 for inspection.
Results logged to C:/Ruby31/lib/ruby/gems/3.1.0/extensions/x86-mingw32/3.1.0/bson-4.12.1/gem_make.out
Edit:
after looking to implement the solution mentioned below (moving the GnuWin32binmake.exe
file to a different path) I discovered that its actually an entire folder path thats crammed into a string, its supposed to be a filepath C:\Program Files (x86)\GnuWin32\bin\make.exe
Also mongodb the (the bson gem maintainer) provides no way for the public to report bugs, having disabled bug reporting on github, and their online issue tracker for Jira does not allow the general public access.