devkit path issue (maybe related to #55)
I have seen there was alreday a ticket about devkit on windows and you explained in detail how it works. However I have some issues when trying to install some native gems, and it seems definitively to be related with uru or the environment / PATH.
I have properly installed devkit via dk.rb and for some native gem it works, but for some other it doesn't. Looks like some native gems somehow start multiple "subshells" or processes for compilation and do not get the proper path to devkit.
D:\Programming\ruby>gem install debase
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing debase:
ERROR: Failed to build gem native extension.
current directory: c:/ruby/ruby225-p319/lib/ruby/gems/2.2.0/gems/debase-0.2.1/ext
c:/ruby/ruby225-p319/bin/ruby.exe -r ./siteconf20170331-12100-pt36fh.rb extconf.rb
checking for vm_core.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
I have currently the following rubies installed:
uru ls
193p545 : ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
200p598 : ruby 2.0.0p598 (2014-11-13) [i386-mingw32]
223p173 : ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-mingw32]
=> 225p319 : ruby 2.2.5p319 (2016-04-26 revision 54774) [i386-mingw32]
See also the github issue I opened first for debase: https://github.com/denofevil/debase/issues/38
After adding both following devkit folders to the path, the gem installation works seamless:
C:\ruby\DevKit-32-4.7.2-1151\bin
C:\ruby\DevKit-32-4.7.2-1151\mingw\bin
D:\Programming\ruby>gem install debase
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed debase-0.2.1
Parsing documentation for debase-0.2.1
Installing ri documentation for debase-0.2.1
Done installing documentation for debase after 1 seconds
1 gem installed
Comments (6)
-
repo owner -
reporter Hi Jon, many thanks for your time and detailed explanation. I think I found the reason why it doesn't work on my environment.
I used the "autocommand" registry value to automatically load a default ruby with uru:
reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun ^ /t REG_EXPAND_SZ /d "%"USERPROFILE"%\init.cmd > NUL 2>&1" /f
where the contents of my init.cmd are the following
@echo OFF uru 225
this seems to reset the environment during native gem installs, as soon as i comment (with rem) the two statements, the installation of native gems starts to work.
Example with init.cmd:
D:\programming\ruby\telcocloud\BnsE2ETests>gem install debase Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing debase: ERROR: Failed to build gem native extension. current directory: D:/Anwendungen/ruby/ruby225-p319/lib/ruby/gems/2.2.0/gems/debase-0.2.1/ext D:/Anwendungen/ruby/ruby225-p319/bin/ruby.exe -r ./siteconf20170404-1972-1ese3z2.rb extconf.rb ---> Now using ruby 2.2.5-p319 tagged as `225p319` <<<<<<<<<<<<< here uru is loaded again by autocommand init.cmd this probably removes again the devkit path which was added before checking for vm_core.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
example with uru commented out in init.cmd
D:\programming\ruby\telcocloud\BnsE2ETests>gem install debase Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed debase-0.2.1 1 gem installed
is there some other way than autocommand on windows to set a "default" ruby, which doesn't conflict with devkit or the native gem installation ?
-
repo owner Good to know, thanks for the info.
While not the same as cmd's AutoRun feature, you might find uru's .ruby-version support interesting.
Another option is to check whether tweaking your
init.cmd
script to check for the presence of the uru-specific envarURU_INVOKER
before automatically activating a default ruby will work for your scenario. -
reporter Cool, thanks you just brought me to the solution.. Checking
URU_INVOKER
didn't help because it is always defined asURU_INVOKER=batch
on my system regardless if a ruby was alread loaded or not. But now I just check if ruby is already in the path, and if so, uru is not executed, if not uru will load a default ruby.I.e. my
init.cmd
looks as follows now and it seems to work fine, also for native gem install:@echo OFF set Path | findstr /I ruby if ERRORLEVEL 1 uru <taggedruby>
Instead of checking for a ruby in the path (e.g. if there's always some ruby keyword in the path) we could also check
uru ls
if there is a hashrocket.@echo OFF uru ls | findstr "=>" if ERRORLEVEL 1 uru <taggedruby>
Maybe you want to document those possibilites to setup a "default" ruby on windows in the wiki. On linux I guess the same could be done with
.bashrc
or.profile
-
repo owner Your first option looks more robust.
uru ls
could show no active ruby (i.e. - no=>
) and a ruby could still be onPATH
if one configured their system to use a not recommended "system" ruby, i.e. - they've put a ruby onPATH
outside of uru. -
repo owner - changed status to resolved
- Log in to comment
I'm not able to repro your issue on my Win8.1 x64 system.
My environment is different that yours (e.g. - ruby234 vs 225, gcc 6.3.0 vs 4.7.2), but it appears that something else is going on in your system.
uru
is essentially a glorifiedPATH
updater. Once a particular ruby is activated, it's onPATH
similar to how it would be if not usinguru
.A couple ideas to try...
PATH
, and see if you can install debase. I suspect you'll get the same failure, indicating thaturu
isn't the cause.C:\ruby\ruby225-319\lib\ruby\site_ruby\devkit.rb
file correctly references your devkit. For example, mine looks like the following (ignore the difference of the MSYS2 exes in...\\usr\\bin
as I'm using a newer, custom devkit.)