win32-api compile against 1.9?

50 views
Skip to first unread message

Charles Roper

unread,
Aug 11, 2010, 11:07:48 AM8/11/10
to RubyInstaller
Hey guys,

I've just been playing around with the excellent new LiveReload gem
(highly recommended if you're doing web dev/design). It uses a couple
of win32utils gems that depend on the win32-api gem. Unfortunately,
this is only compiled with 1.8 support and so you get the dreaded
"This application has failed to start because msvcrt-ruby18.dll was
not found" error when trying to use LiveReload under 1.9.

I've reported this to the authors, but I'm not sure how quickly (if
ever) they'll get around to updating:

http://rubyforge.org/forum/forum.php?thread_id=48004&forum_id=320

Daniel Berger mentions doing a "rake gem:install" but as I mention in
my response, this doesn't work. Do you guys know how to get it
compiled against 1.9 using the DevKit? I pretty much know nothing
about compiling stuff, so any help would be appreciated. :)

Cheers,
Charles

pete

unread,
Aug 11, 2010, 11:30:49 AM8/11/10
to rubyin...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To post to this group, send email to rubyin...@googlegroups.com.
To unsubscribe from this group, send email to rubyinstalle...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyinstaller?hl=en.


If you have the devkit, do "gem install win32-api --platform=ruby". This will force compilation instead of using the binary gem.

pete

Luis Lavena

unread,
Aug 11, 2010, 11:37:14 AM8/11/10
to rubyin...@googlegroups.com

I've commented Daniel about using fat-binaries, but I couldn't find
the time to hack windows-to-windows fat-binaries into rake-compiler.

So you need to cross compile :-(

In the mean time you can force the installation of source code version
with --platform=ruby during the gem installation process.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Jon

unread,
Aug 11, 2010, 12:01:25 PM8/11/10
to rubyin...@googlegroups.com
> Daniel Berger mentions doing a "rake gem:install" but as I mention in
> my response, this doesn't work. Do you guys know how to get it
> compiled against 1.9 using the DevKit? I pretty much know nothing
> about compiling stuff, so any help would be appreciated. :)

Using our 1.9.1p429 and the DevKit (newer unreleased version although the existing version should also work) I used "gem install livereload --platform=ruby" and it all seems to have gone well.

Of livereload's deps (eventmachine, em-websocket, em-dir-watcher, ruby-json) only eventmachine required the DevKit to build native libraries.

I also did a "gem install win32-changenotify win32-event --platform=ruby" and of their deps (win32-api, windows-api, windows-pr, win32-ipc) only win32-api required the DevKit to build native libraries.

All DevKit built libraries appear to be linked properly and have their deps satisfied.

I successfully installed the Chrome extension but haven't yet tried it all out to see if it works. That said, it looks like all the pieces install correctly when used with the DevKit.

Do you have the DevKit installed and have you tried the above gem install incantations?

Jon

Charles Roper

unread,
Aug 12, 2010, 4:44:46 AM8/12/10
to rubyin...@googlegroups.com
Yes, --platform=ruby did the trick. It's now working under 1.9.1p429
(2010-07-02 revision 28523). Thank you guys - I'll relay this
information back to the LiveReload guys.

Tangentially, is anyone else having problems installing EventMachine
under 1.9.2dev? Here's what I get: http://gist.github.com/520590

I know the answer is "when it's ready", but do you have an estimate of
when the easy-to-install DevKit will be ready for the general public?

Cheers,
Charles

Luis Lavena

unread,
Aug 12, 2010, 11:02:43 AM8/12/10
to rubyin...@googlegroups.com
On Thu, Aug 12, 2010 at 5:44 AM, Charles Roper
<rea...@charlesroper.co.uk> wrote:
> Yes, --platform=ruby did the trick. It's now working under 1.9.1p429
> (2010-07-02 revision 28523). Thank you guys - I'll relay this
> information back to the LiveReload guys.
>
> Tangentially, is anyone else having problems installing EventMachine
> under 1.9.2dev? Here's what I get: http://gist.github.com/520590
>

I believe EventMachine needs some adjustments for 1.9.2, I would
suggest clone EM repo and try building it to see the errors.

> I know the answer is "when it's ready", but do you have an estimate of
> when the easy-to-install DevKit will be ready for the general public?
>

The SFX and 7z packages for 3.4.5 and 4.5.0 are ready, also the dk.rb
which puts the RubyGems hook and devkit require in place.

(All of that on master)

Jon

unread,
Aug 12, 2010, 12:42:16 PM8/12/10
to rubyin...@googlegroups.com
On Thu, Aug 12, 2010 at 4:44 AM, Charles Roper <rea...@charlesroper.co.uk> wrote:
Yes, --platform=ruby did the trick. It's now working under 1.9.1p429
(2010-07-02 revision 28523). Thank you guys - I'll relay this
information back to the LiveReload guys.


Great...and thanks for pointing out the LiveReload project.
 
Tangentially, is anyone else having problems installing EventMachine
under 1.9.2dev? Here's what I get: http://gist.github.com/520590


I'm also playing with EM's master branch after Pete helped push for some Win32 enhancements.  Building my own with the new DevKit after:


# edit the .gemspec to give prerelease style version: s.version = "0.12.11.jm1"

gem build eventmachine.gemspec

gem install eventmachine-0.12.11.jm1.gem --platform=ruby


I know the answer is "when it's ready", but do you have an estimate of
when the easy-to-install DevKit will be ready for the general public?


Yeh, that's right ;)  I'm almost ready to release as the only real concerns are (a) the initial JRuby support I put in the dk.rb install helper script, and (b) no general public usage documentation yet.  So far no one has mentioned any real problems with the core functionality so I'll probably release (just the self-extracting SFX archive) late this week or the weekend.

As Luis mentioned, everything is on master so you can build your own DevKit as simply as

cd rubyinstaller
rake devkit sfx=1
cd ..\pkg

Jon

Charles Roper

unread,
Aug 12, 2010, 1:03:11 PM8/12/10
to rubyin...@googlegroups.com
On 12 August 2010 17:42, Jon <jon.f...@gmail.com> wrote:

> As Luis mentioned, everything is on master so you can build your own DevKit
> as simply as
> git clone git://github.com/oneclick/rubyinstaller.git
> cd rubyinstaller
> rake devkit sfx=1
> cd ..\pkg

As you must have been writing this, I was doing a rake devkit 7z=1. Slick.

So I've got the old devkit installed via pik. Briefly, what do I need
to do to get this new one working?

Charles

Luis Lavena

unread,
Aug 12, 2010, 1:12:02 PM8/12/10
to rubyin...@googlegroups.com

1) Extract the new DevKit into a directory you're confortable with,
doesn't need to be in the PATH (eg C:\DevKit)
2) call dk.rb from one of your existing versions of ruby:

ruby C:\DevKit\dk.rb init

That will generate a config.yml in your current directory including a
list of all the Ruby versions if found. If your version of ruby is not
there...

3) Manually edit config.yml to include your versions of Ruby. In my
case, I did "pik ls -v" to obtain the paths and then edited config.yml
to contain them.

Since is a YAML file, remember use "-" and "/" for the paths.

Save the file

4) Review the list of Rubies:

ruby C:\DevKit\dk.rb review

Check all your MinGW-based Rubies are there.

5) Remove the stubs (gcc, make, sh) that Pik installed.

We are no longer encouraging to use those and instead we hook gem
installation. Remove them from your Ruby installations and then
proceed with next step

6) Install:

ruby C:\DevKit\dk.rb install

7) Try installing a new gem:

gem install RedCloth --platform=ruby

Expect to see this as part of the output:

Temporarily enhancing PATH to include DevKit...

You can later call "C:\DevKit\devkitvars.bat" to get GCC and MSYS
added to your PATH.

Jon

unread,
Aug 12, 2010, 1:12:51 PM8/12/10
to rubyin...@googlegroups.com
> > git clone git://github.com/oneclick/rubyinstaller.git
> > cd rubyinstaller
> > rake devkit sfx=1
> > cd ..\pkg
>
> As you must have been writing this, I was doing a rake devkit 7z=1. Slick.
>
> So I've got the old devkit installed via pik. Briefly, what do I need
> to do to get this new one working?

First, rename (or delete) all the old {gcc,make,sh}.bat scripts in your Ruby bindirs from the legacy DevKit to something like gcc.bat.orig.

Then...

# extract the pkg/DevKit...-sfx.exe to a dir with no spaces
cd <DEVKIT_INSTALL_DIR>
ruby dk.rb init
# edit to generated 'config.yml' to include the root dirs
# of all the installed Rubies on your system that were not
# automagically discovered
ruby dk.rb review
# all Rubies to be enhanced with the Devkit listed?
ruby dk.rb install

That's it. You can now "gem install some-native-gem --platform=ruby" and it should work. Let us know if you run into any problems.

Jon

Charles Roper

unread,
Aug 12, 2010, 1:23:19 PM8/12/10
to rubyin...@googlegroups.com
OK, thanks guys - I was doing dk.rb init and getting this:

[C:\Users\charlesr\Desktop\devkit]ruby dk.rb init
[INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\MRI...
[INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\Rubinius...
[INFO] unable to open HKEY_CURRENT_USER\Software\RubyInstaller\Rubinius...

Which was leading me to believe it wasn't working. Are there plans to
add detection support for pik? I'll try editing that yaml file now...

Cheers,
Charles

Luis Lavena

unread,
Aug 12, 2010, 1:26:49 PM8/12/10
to rubyin...@googlegroups.com
On Thu, Aug 12, 2010 at 2:23 PM, Charles Roper
<rea...@charlesroper.co.uk> wrote:
> OK, thanks guys - I was doing dk.rb init and getting this:
>
> [C:\Users\charlesr\Desktop\devkit]ruby dk.rb init
> [INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\MRI...
> [INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\Rubinius...
> [INFO] unable to open HKEY_CURRENT_USER\Software\RubyInstaller\Rubinius...
>
> Which was leading me to believe it wasn't working.

I think that should be changed to positive things instead of the
opposite (found instead of ..)

>Are there plans to
> add detection support for pik? I'll try editing that yaml file now...
>

Since pik can contain MSVC versions of Ruby too, we haven't considered
using ~/.pik/config.yml

But indeed is a good idea, and I believe can be paired after the
registry scan. Patches are welcome :-D

Jon

unread,
Aug 12, 2010, 1:43:45 PM8/12/10
to rubyin...@googlegroups.com
> [C:\Users\charlesr\Desktop\devkit]ruby dk.rb init
> [INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\MRI...
> [INFO] unable to open HKEY_LOCAL_MACHINE\Software\RubyInstaller\Rubinius...
> [INFO] unable to open HKEY_CURRENT_USER\Software\RubyInstaller\Rubinius...
>
> Which was leading me to believe it wasn't working. Are there plans to
> add detection support for pik? I'll try editing that yaml file now...

You're right, that's ugly. They're internal messages that really shouldn't be shown anyways...changing.

No plans yet for integration with pik although I want to talk a bit with Gordon and see what he thinks.

As Luis stated, pik supports MSVC versions as well as IronRuby so we need to think what makes most sense and doesn't cause weird corner case instability bugs.

Jon

Charles Roper

unread,
Aug 12, 2010, 1:54:09 PM8/12/10
to rubyin...@googlegroups.com
Sweet, all done. Just installed RedCloth, Eventmachine and win32-api
(with --platform=ruby) and all installed flawlessly.

To swing this thread back round to LiveReload, am I right in thinking
this would be the install procedure on a clean system:

1. Download and install RubyInstaller
2. Download the devkit.exe installer
3. Run devkit.exe SFX and extract to a path without spaces; e.g.,
C:\Users\*username*\DevKit
4. Open a command prompt and CD to your newly created DevKit directory
5. Run the following commands:

ruby dk.rb init
ruby dk.rb install
gem update --system
gem install eventmachine win32-changenotify win32-event livereload
--platform=ruby

Charles

Jon

unread,
Aug 12, 2010, 1:58:34 PM8/12/10
to rubyin...@googlegroups.com

> Sweet, all done. Just installed RedCloth, Eventmachine and win32-api
> (with --platform=ruby) and all installed flawlessly.
>
> To swing this thread back round to LiveReload, am I right in thinking
> this would be the install procedure on a clean system:
>
> 1. Download and install RubyInstaller
> 2. Download the devkit.exe installer
> 3. Run devkit.exe SFX and extract to a path without spaces; e.g.,
> C:\Users\*username*\DevKit
> 4. Open a command prompt and CD to your newly created DevKit directory
> 5. Run the following commands:
>
> ruby dk.rb init
> ruby dk.rb install
> gem update --system
> gem install eventmachine win32-changenotify win32-event livereload
> --platform=ruby
>
> Charles

Looks good to me and I would add a "ruby dk.rb review" between "init" and "install" as a quick double-check.

Before you post this to the LiveReload thread, give me some time to update dk.rb to get rid of the unnecessary info messages when running init.

Jon

Charles Roper

unread,
Aug 12, 2010, 2:01:44 PM8/12/10
to rubyin...@googlegroups.com
I'll wait until there's a download for the devkit SFX too.

Charles Roper

unread,
Aug 12, 2010, 2:14:17 PM8/12/10
to rubyin...@googlegroups.com
Jon, btw, thanks for the tip about installing eventmachine from its
master branch. I did as you suggested, it worked, and now LiveReload
works under 1.9.2.

You guys have done a truly remarkable job of making Ruby on Windows
vastly more pleasurable and practical. Thank you. :D

Jon

unread,
Aug 12, 2010, 2:32:40 PM8/12/10
to rubyin...@googlegroups.com
> I'll wait until there's a download for the devkit SFX too.
>

Download this and overwrite the existing dk.rb in your DevKit install dir:

http://github.com/oneclick/rubyinstaller/raw/master/resources/devkit/dk.rb


Then rename your existing config.yml to config.yml.orig and rerun "ruby dk.rb init" and tell me what you think.

FYI, you can rerun "ruby dk.rb install" multiple times and the script is smart enough to not overwrite files that already exist.

Jon

Charles Roper

unread,
Aug 12, 2010, 2:49:32 PM8/12/10
to rubyin...@googlegroups.com
On 12 August 2010 19:32, Jon <jon.f...@gmail.com> wrote:
>> I'll wait until there's a download for the devkit SFX too.
>
> Download this and overwrite the existing dk.rb in your DevKit install dir:
>
> http://github.com/oneclick/rubyinstaller/raw/master/resources/devkit/dk.rb
>
>
> Then rename your existing config.yml to config.yml.orig and rerun "ruby dk.rb init" and tell me what you think.

*Much* better!

[C:\Users\charlesr\Desktop\devkit]ruby dk.rb init

[INFO] found RubyInstaller v1.8.7 at C:/Users/charlesr/Tools/Ruby187

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

pete

unread,
Aug 12, 2010, 3:52:29 PM8/12/10
to rubyin...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To post to this group, send email to rubyin...@googlegroups.com.
To unsubscribe from this group, send email to rubyinstalle...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyinstaller?hl=en.

So EM's github master compiles with 1.9.2? I was going to test this after work, good to know! I'll update the thread on the eventmachine mailing list.

pete

david

unread,
Sep 27, 2010, 3:48:02 AM9/27/10
to RubyInstaller
Hi,

I am not able to overcome the error
"This application has failed to start because msvcrt-ruby18.dll was
not found. Re-installing the application may fix this problem."

I have uninstalled win32-api gem as follows:

C:\Work\gems>gem uninstall win32-api

You have requested to uninstall the gem:
win32-api-1.4.6-x86-mingw32
windows-api-0.4.0 depends on [win32-api (>= 1.4.5)]
windows-pr-1.0.9 depends on [win32-api (>= 1.4.5)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Successfully uninstalled win32-api-1.4.6-x86-mingw32

And then I have reinstalled using

C:\Work\gems>gem install win32-api --platform=ruby
Temporarily enhancing PATH to include DevKit...
Successfully installed win32-api-1.4.6-x86-mingw32
1 gem installed
Installing ri documentation for win32-api-1.4.6-x86-mingw32...
Installing RDoc documentation for win32-api-1.4.6-x86-mingw32...

but I still get the msvcrt-ruby18.dll error popup when I start irb and
reference 'win32/api'

irb(main):001:0> require 'win32/api'
LoadError: 126: The specified module could not be found. - C:/Ruby/
lib/ruby/ge
ms/1.9.1/gems/win32-api-1.4.6-x86-mingw32/lib/win32/api.so
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in
require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from (irb):1
from C:/Ruby/bin/irb:12:in `<main>'
irb(main):002:0>

At a loss...

David


On Aug 12, 1:30 am, pete <p...@peterhiggins.org> wrote:
> On Wed, Aug 11, 2010 at 8:07 AM, Charles Roper <charles.ro...@gmail.com>wrote:
>
>
>
> > Hey guys,
>
> > I've just been playing around with the excellent new LiveReload gem
> > (highly recommended if you're doing web dev/design). It uses a couple
> > of win32utils gems that depend on the win32-api gem. Unfortunately,
> > this is only compiled with 1.8 support and so you get the dreaded
> > "This application has failed to start because msvcrt-ruby18.dll was
> > not found" error when trying to use LiveReload under 1.9.
>
> > I've reported this to the authors, but I'm not sure how quickly (if
> > ever) they'll get around to updating:
>
> >http://rubyforge.org/forum/forum.php?thread_id=48004&forum_id=320
>
> > Daniel Berger mentions doing a "rake gem:install" but as I mention in
> > my response, this doesn't work. Do you guys know how to get it
> > compiled against 1.9 using the DevKit? I pretty much know nothing
> > about compiling stuff, so any help would be appreciated. :)
>
> > Cheers,
> > Charles
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "RubyInstaller" group.
> > To post to this group, send email to rubyin...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyinstalle...@googlegroups.com<rubyinstaller%2Bunsu...@googlegroups.com>
> > .

Boško Ivanišević

unread,
Sep 27, 2010, 6:43:32 AM9/27/10
to rubyin...@googlegroups.com
On Mon, Sep 27, 2010 at 9:48 AM, david <dschu...@gmail.com> wrote:
Hi,

I am not able to overcome the error
"This application has failed to start because msvcrt-ruby18.dll was
not found. Re-installing the application may fix this problem."

Binary version is compiled for Ruby 1.8 and that's why it doesn't work.
 
I have uninstalled win32-api gem as follows:

C:\Work\gems>gem uninstall win32-api

You have requested to uninstall the gem:
       win32-api-1.4.6-x86-mingw32
windows-api-0.4.0 depends on [win32-api (>= 1.4.5)]
windows-pr-1.0.9 depends on [win32-api (>= 1.4.5)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled win32-api-1.4.6-x86-mingw32

And then I have reinstalled using

C:\Work\gems>gem install win32-api --platform=ruby
Temporarily enhancing PATH to include DevKit...
Successfully installed win32-api-1.4.6-x86-mingw32
1 gem installed
Installing ri documentation for win32-api-1.4.6-x86-mingw32...
Installing RDoc documentation for win32-api-1.4.6-x86-mingw32...

This works for me

gem install win32-api --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed win32-api-1.4.6
1 gem installed
Installing ri documentation for win32-api-1.4.6...
Building YARD (yri) index for win32-api-1.4.6...
Installing RDoc documentation for win32-api-1.4.6...

but for some x86-mingw32 version is again installed on your computer (see the line: Successfully installed...). What is your path, output of ruby -v and how did you install Ruby (from installer or unzipped it)?

--
Regards,
Boško Ivanišević

Luis Lavena

unread,
Sep 27, 2010, 10:11:16 AM9/27/10
to rubyin...@googlegroups.com
On Mon, Sep 27, 2010 at 4:48 AM, david <dschu...@gmail.com> wrote:
> Hi,
>
> I am not able to overcome the error
> "This application has failed to start because msvcrt-ruby18.dll was
> not found. Re-installing the application may fix this problem."
>

The binary gem has been build against Ruby 1.8, not 1.9

Please uninstall all the win32-* and windows-* and install with --platform=ruby

> And then I have reinstalled using
>
> C:\Work\gems>gem install win32-api --platform=ruby
> Temporarily enhancing PATH to include DevKit...
> Successfully installed win32-api-1.4.6-x86-mingw32
> 1 gem installed
> Installing ri documentation for win32-api-1.4.6-x86-mingw32...
> Installing RDoc documentation for win32-api-1.4.6-x86-mingw32...
>
> but I still get the msvcrt-ruby18.dll error popup when I start irb and
> reference 'win32/api'

That is because it is always installing x86-mingw32 compiled gem.

david

unread,
Sep 27, 2010, 9:50:37 PM9/27/10
to RubyInstaller
Hi,

My path to Ruby is C:\Ruby\bin;
ruby -v => ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
I used windows installer to install this Ruby version.

David

On Sep 27, 8:43 pm, Boško Ivanišević <bosko.ivanise...@gmail.com>
wrote:

david

unread,
Sep 27, 2010, 10:21:32 PM9/27/10
to RubyInstaller
Hi,

I followed Luis' advice and uninstalled ALL the win32-* and windows-*
gems and then installed with --platform=ruby

This time I got this result when reinstalling

C:\Users\David>gem install win32-api --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed win32-api-1.4.6
1 gem installed
Installing ri documentation for win32-api-1.4.6...
Installing RDoc documentation for win32-api-1.4.6...

Problem fixed!

David

On Sep 28, 12:11 am, Luis Lavena <luislav...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages