Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing gem: Couldn't reserve space for cygwin's heap, Win32 error 487

I'm trying to install win32-api gem on my machine and I'm facing some issues when building native extensions:

$ gem install win32-api --no-ri --rdoc
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
C:\Programs\dev_kit\bin\make.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0
ERROR:  Error installing win32-api:
        ERROR: Failed to build gem native extension.

        c:/Programs/ruby/bin/ruby.exe extconf.rb
checking for strncpy_s()... no
creating Makefile

make
      0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x0, BaseAddress 0x60E90000, RegionSize 0x170000, State 0x10000
C:\Programs\dev_kit\bin\make.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0

This problem happens when installing any gem that tries to compile a native extension, like json or win32-api, for instance.

I already tried to change the size of virtual memory of this machine, but it didn't work.

My configuration:

  • Ruby version: 1.8.7p371
  • Gem version: 1.8.24
  • Bash 3.1.0
  • DevKit 4.5.2
  • Windows 7 x64
like image 942
Glauco Vinicius Avatar asked Oct 08 '13 22:10

Glauco Vinicius


1 Answers

I was facing the exact same issue and after making a lot of searches and many different tries, this is what fixed it for me:

  1. Download rebase from http://www.tishler.net/jason/software/rebase/ (download the latest *.exe version) and run it.

  2. Fire up a Prompt ("Run as administrator") and go to your dev-kit folder (for instance, mine was C:\Programs\dev_kit)

  3. While in the dev-kit folder, run devkitvars.bat to add devkit to the path.

  4. Now do a cd bin (it got me to C:\Programs\dev_kit\bin) and from there run:

    rebase -b 0x30000000 msys-1.0.dll
    

Try to install the gems again. Instead of seeing an error message, now you should see Building native extensions. This could take a while... and it will hang for a while there.

Your gem should be successfully installed after a couple of minutes/seconds. No more headaches :)

like image 120
Nicholas Pufal Avatar answered Sep 24 '22 18:09

Nicholas Pufal