Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong DevKit PATH in operating_system.rb #817

Closed
tknerr opened this issue Mar 16, 2012 · 15 comments
Closed

Wrong DevKit PATH in operating_system.rb #817

tknerr opened this issue Mar 16, 2012 · 15 comments

Comments

@tknerr
Copy link
Contributor

tknerr commented Mar 16, 2012

I'm using Vagrant 1.0.1 installed using the msi Installer on Windows7 x64.

When I tried to vagrant gem install sahara I run into the following error:

D:\Repos\puroz\devkit\vagrant\demo>vagrant gem install sahara
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sahara:
        ERROR: Failed to build gem native extension.

        D:/vagrant/embedded/bin/ruby.exe extconf.rb
checking for ffi.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.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=D:/vagrant/embedded/bin/ruby
        --with-ffi_c-dir
        --without-ffi_c-dir
        --with-ffi_c-include
        --without-ffi_c-include=${ffi_c-dir}/include
        --with-ffi_c-lib
        --without-ffi_c-lib=${ffi_c-dir}/lib
        --with-libffi-config
        --without-libffi-config
        --with-pkg-config
        --without-pkg-config
D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from D:/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
        from extconf.rb:9:in `<main>'


Gem files will remain installed in C:/Users/tkn/.vagrant.d/gems/gems/ffi-1.0.11 for inspection.
Results logged to C:/Users/tkn/.vagrant.d/gems/gems/ffi-1.0.11/ext/ffi_c/gem_make.out

It turned out that the DevKit PATH entries in D:\vagrant\embedded\lib\ruby\site_ruby\1.9.1\rubygems\defaults\operating_system.rb were pointing to C:\\vagrant-temp\\embedded\\... when it was actually installed in D:\\vagrant\\embedded\\...

After correcting the PATHs in operating_system.rb the native extensions were compiled and the sahara gem installed.

However, I didn't get the sahara plugin to work -- it seems that the sandbox subcommands were not properly registered... :-(

@mitchellh
Copy link
Contributor

Thanks. Let me bring in @luislavena real quick. Luis, do you know if there is a way for me to tell DevKit to be relocatable? or do I need to modify this file during the install process?

@tknerr
Copy link
Contributor Author

tknerr commented Mar 17, 2012

In this context there were two other issues with installing the sahara plugin, the second one might be interesting for you:

  1. the plugin didn't get loaded due to a dependency to vagrant 0.9

  2. after fixing that it still would not load when installed using vagrant gem install sahara-0.0.11.gem. What I had to do instead was D:\vagrant\embedded\bin\gem install sahara-0.0.11.gem

@luislavena
Copy link

@mitchellh I suggest you generate a different operating_system.rb before packging the installer that updates the PATH in relation to __FILE__.

Dunno where is DevKit in relation to the Vagrant installation, but something like:

devkit_path = File.expand_path("../../../../../../../devkit", __FILE__).gsub(File::SEPARATOR, File::ALT_SEPARATOR
ENV["PATH"] = "#{devkit_path};#{ENV["PATH"]}"

Just an idea, something like that might work.

The template of operating_system.rb is here:

https://github.com/oneclick/rubyinstaller/blob/master/resources/devkit/dk.rb.erb#L48-63

@mitchellh
Copy link
Contributor

Thanks I'll do that, that is much much easier. Thanks :)

@wizonesolutions
Copy link

I think this still persists in Vagrant 1.0.3. Error output:

vagrant gem install vagrant-vbguest
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing vagrant-vbguest:
ERROR: Failed to build gem native extension.

                C:/vagrant/vagrant/embedded/bin/ruby.exe extconf.rb
            checking for re.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.

            Provided configuration options:
                --with-opt-dir
                --without-opt-dir
                --with-opt-include
                --without-opt-include=${opt-dir}/include
                --with-opt-lib
                --without-opt-lib=${opt-dir}/lib
                --with-make-prog
                --without-make-prog
                --srcdir=.
                --curdir
                --ruby=C:/vagrant/vagrant/embedded/bin/ruby
            C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file.
            (RuntimeError)
            You have to install development tools first.
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:254:in `open'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
                from C:/vagrant/vagrant/embedded/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
                from extconf.rb:14:in `<main>'


            Gem files will remain installed in C:/Users/Kevin/.vagrant.d/gems/gems/json-1.5.4 for inspection.
            Results logged to C:/Users/Kevin/.vagrant.d/gems/gems/json-1.5.4/ext/json/ext/parser/gem_make.out`

@wizonesolutions
Copy link

Google persistently says I just need DevKit set up properly. The installer is supposed to do that, right?

@luislavena
Copy link

@wizonesolutions hello, did you actually read the two responses from me and @mitchellh ?

As you can see from the ticket (which is still open) this hasn't been solved yet.

You can workaround this by invoking devkitvars.bat from inside C:\vagrant\vagrant\embedded\devkit\devkitvars.bat

Please read the responses first and better yet, contribute a patch that fix the issue instead of arguing that Google persistently says I just need DevKit set up properly

Dunno what Google has to do with this... 😒

@wizonesolutions
Copy link

@luislavena Sorry for causing confusion. I did read, but not carefully enough, and so I didn't realize that @mitchellh saying he "would do it" + the issue not being closed = not actually done yet. I should have. I appreciate you taking the time to reply.

I'm not sure if you want me to explain about Google or why I haven't rolled a patch, and I would rather this comment be more of a thanks than me trying to insist I didn't do anything wrong like is so common on the net.

@luislavena
Copy link

@wizonesolutions you can workaround the issue by calling devkitvars.bat at the command prompt prior doing the gem installation.

@wizonesolutions
Copy link

Yes I did that yesterday and it worked. Thanks!
On May 11, 2012 7:23 AM, "Luis Lavena" <
reply@reply.github.com>
wrote:

@wizonesolutions you can workaround the issue by calling devkitvars.bat
at the command prompt prior doing the gem installation.


Reply to this email directly or view it on GitHub:
#817 (comment)

@mitchellh
Copy link
Contributor

@luislavena, looking back at this bug, can I modify the batch file and shell file to just modify the PATH to include the DevKit? Because Vagrant subprocesses gem so they will inherit it, right? That way I don't have to modify any internal DevKit files.

@luislavena
Copy link

That sounds reasonable. Don't have my computer yo verify.

Sorry for top posting. Sent from mobile.
On Jun 14, 2012 1:16 AM, "Mitchell Hashimoto" <
reply@reply.github.com>
wrote:

@luislavena, looking back at this bug, can I modify the batch file and
shell file to just modify the PATH to include the DevKit? Because Vagrant
subprocesses gem so they will inherit it, right? That way I don't have to
modify any internal DevKit files.


Reply to this email directly or view it on GitHub:
#817 (comment)

@mitchellh
Copy link
Contributor

Is this fixed in 1.1? Can someone check.

@nazoking
Copy link

This problem is not fixed in 1.1 and 1.2.

Probably, after installed, Installer execute

SET VAGRANT_HOME="c:\vagrant\vagrant"
"%VAGRANT_HOME%\embedded\bin\ruby" -r yaml -e "puts ['%VAGRANT_HOME%\embedded'].to_yaml" > "%VAGRANT_HOME%\embedded\config.yml"
"%VAGRANT_HOME%\embedded\bin\ruby" "%VAGRANT_HOME%\embedded\dk.rb" --force install

@mitchellh
Copy link
Contributor

This is finally, truly, fixed. Will be part of the 1.2.2 installers. Yay!

@ghost ghost locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants