Can't get ffi-rzmq zeromq gem working on Windows - ruby

I've having trouble getting the ffi-rzmq gem to work on windows.
I've installed the windows installer for ZeroMQ 2.2 from here:
http://www.zeromq.org/distro:microsoft-windows
And I've added C:\Program Files\ZeroMQ 2.2.0\bin to my PATH variable.
I then installed the ffi and ffi-rzmq gems with
gem install ffi
gem install ffi-rzmq
But when I start an irb and run:
require 'ffi-rzmq'
I get this message:
irb(main):001:0> require 'ffi-rzmq'
Unable to load this gem. The libzmq library (or DLL) could not be found.
If this is a Windows platform, make sure libzmq.dll is on the PATH.
For non-Windows platforms, make sure libzmq is located in this search path:
["C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/ffi-rzmq-0.9.3/lib/ffi-rz
mq/../../ext/libzmq.dll", "/usr/local/lib/libzmq.dll", "/opt/local/lib/libzmq.dl
l", "/usr/local/homebrew/lib/libzmq.dll", "/usr/lib64/libzmq.dll"]
The weird thing is that the Zero MQ installer doesn't seem to package a libzmq.dll, only libzmq-v100-mt.dll
I'm sure I'm doing something very obvious that's wrong, but I can't see what it is... can anyone help?
Thanks.

I've managed to fix the problem - the error message given by ffi-rzmq has actually improved somewhat in the latest version.
Nathan was right that I had to rename the libzmq-v100-mt.dll to libzmq.dll, but that alone wasn't enough - I was using the 64bit compiled version of ZMQ, but for some reason ffi-rzmq is linked against the 32bit version.
So everything worked once I uninstalled the 64bit version, installed the 32bit version instead, reanamed the dll to libzmq.dll and adjusted my path to point to the 'c:\program files (x86)' version of zmq.

You have to rename libzmq-v100-mt.dll to libzmq.dll - I have no idea why they decided to have the windows build output a different library name.
I had the same problem, and as soon as I renamed the file zeromq started working fine.
(Okay, technically I had to fix my code first, but THEN zeromq worked fine).

Related

How to install Ruby Installer in Azure Websites

I'm using SASS in my application and i'm in the process of migrating to Azure.
I've got my project setup but it's not compiling the SASS. I'm trying to use the Ruby Installer from here http://rubyinstaller.org/downloads/ (Ruby 1.9.3-p551) and I've uploaded this via FTP to D:/home however when I try to install it simply using the command rubyinstaller-1.9.3-p551.exe it doesn't do anything. No error message or anything either.
Any suggestions?
Using the installer won't work because it probably requires an interactive session. What I did was get the Ruby binaries and FTP those to the website. You can find the binaries as as 7zip file on Ruby download page. I followed along this post: Installing Ruby 1.8.7 (and other stuff) manually. The part about zlib is probably outdated because there is a corresponding dll in the zipped archive already. I did download the other mentioned dll though (the iconv dll) and placed it in the Ruby bin folder.
Gem is already bundled in the package so no need to install that separately.
Unfortunately now I'm having difficulties in getting the gulp task to work because it is still saying "ruby and compass must be installed and in path". I set the path in the gulpfile.
You no longer need to depend on Ruby to compile your SASS.
LIBSASS has 100% parity with RUBY SASS, and doesn't come with the Ruby dependency.
If you're using grunt, you can switch over to LIBSASS by editing your gruntfile.js to use
grunt.loadNpmTasks('grunt-sass');
instead of
grunt.loadNpmTasks('grunt-contrib-sass');
You should also update your package.json file accordingly.
You can then get Azure to execute your grunt tasks as explained in this answer.

How to install ruby 2.1.2 on windows?

I didn't get any windows installer to install ruby 2.1.2. The only resource I found is a tar/zip file that is available at https://www.ruby-lang.org/en/downloads/.
I have no idea how to install this , anyone provide some suggestions how to install 2.1.2 version of ruby.
I have been able to crack the zlib nut (for Windows 8.1 -- see below), but I'm still struggling with openssl, readline, etc... I find it amazing that this documentation does not seem to be easily found, and that some experts/respondents advise using the 2.0 installer without considering that users are fighting this fight because we need the 2.1.2 functionality.
I downloaded zlib128-dll.zip from http://zlib.net and unzipped the contents to a directory (e.g., c:\zlib).
Then following some hints from this post (https://www.ruby-forum.com/topic/4421852), I created these dirs off of my c:\ruby-build\usr directory:
zlib
zlib\include
zlib\lib
Then I copied some files from my C:\zlib directories to my c:\ruby-build\usr directories:
*.h files (both) from C:\zlib\include to c:\ruby-build\usr\zlib\include
zdll.lib from C:\zlib\lib to c:\ruby-build\usr\zlib\lib.
zlib1.dll *AS* zlib.dll from C:\zlib to both c:\ruby-build\usr\zlib\lib and c:\ruby-build\usr\bin
(not sure which one or both are necessary).
Then from a VS 2012 Native Tools Command Window, I naviagted to C:\ruby-2.1.2\ext\zlib and executed:
\ruby-build\usr\bin\ruby extconf.rb --with-zlib-dir=c:/ruby-build/usr/zlib
Then nmake, followed by nmake install, and voila, I zlib was finally installed.
Let me know if you any questions about my steps.
The project Ruby Installer has published Ruby 2.1.3 for Windows (32 and 64 bits versions) on their download page:
http://rubyinstaller.org/downloads/
You will also find there a new build for Ruby 2.0 (p576).
Although they didnĀ“t updated their news page yet.
The standard way to install Ruby on Windows is with Ruby Installer. However, due to some bugs/regressions in Ruby, there has been some hold up creating an installer for Ruby 2.1 on Windows. To get Ruby 2.1 on Windows, you'll likely have to compile from source.
That's a good question. It seems that 2.1.2 is not easily available on bitnami or ruby installer.
Check this out.
If it's not worth the pain or if you don't explicitly need the features of 2.1.2, I would recommend just installing 2.0.x's stable release.
Please let me know if you have any questions!

trouble installing capybara-webkit on Windows8

I am following the tutorial:https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#gentoo-linux
and get stuck at step 11, where I get an error saying Command 'qmake -spec win32-g++ CONFIG+=test' not avalable.
I have no idea how to solve this, and I did add Qt/4.8.6/bin in the path.
I just spent a while getting this to work. I found that the QT environment/system variables were not set up correctly when QT installed. Short version: I found a problem with my Qt install: although it was in my path and qmake would run (I could do qmake -v and get output), that wasn't enough. The variables that Qt uses for paths (e.g. QT_INSTALL_HEADERS, etc.) were not correct. I had to run the Qt configuration program configure.exe. That correctly set all of the Qt variables and all was fixed.
I figured that it must be some kind of issue on my end, since I saw that others have installed it successfully. I went through each of the components required to verify the installation and setup -- and found the problem. I've been able to compile gems just fine using just DevKit, so suspected that it had something to do with Qt. (and it did) Here's what I did to check and verify each component:
DevKit: made sure it was installed in the ruby versions needed, and
verified that it worked:
checked '/devkit/config.yml' to make sure it listed each of different installed ruby versions, and then
re-ran the DevKit install script (ruby dk.rb install) to be sure that DevKit had installed the right files into each of those ruby versions.
I verified that DevKit was working using the recommendation on the DevKit page [https://github.com/oneclick/rubyinstaller/wiki/Development-Kit]: I installed the json gem. It was able to build the native version so that verified that DevKit was installed and working properly.
Qt: I downloaded the Qt files (I used 4.8.5; glad to know I can upgrade). I ran the .exe file downloaded to install them.
made sure that Qt directories were in my path (see the list below).
made sure that the environment variable QMAKESPEC was defined:QMAKESPEC=win32-g++
made the edits to the qmake.conf file (the 'Frommel workaround') as described on https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#windows
ran qmake -version to verify that qmake would run and to verify the version
ran qmake -query to verify the set-up for Qt. This is where I saw the problem with my Qt install: the paths were all wrong.
ran the Qt configure.exe program to fully configure my Qt install. This was the key step. (I thought that the initial installation program would have configured things, but obviously it didn't.) Running this will build all of the demos and examples and so takes a while. But when it completed, all was well.
ran qmake -query to verify that the Qt settings and been fixed and were correct.
System path and ENV variables: the following need to be in your path:
[devkit dir] (ex: C:\rubys\devkit-mingw64-32-4.7.2)
[devkit dir]\mingw\bin;
[devkit dir]\bin;
[qt dir] (ex: C:\Qt\qt-4.8.5-x86-mingw)
[qt dir]\bin;
[ruby version]\bin (ex: C:\rubys\ruby-2.0.0-p598-i386-mingw32\bin)
[ruby version]\lib\ruby\gems\
define the environment (system) variable QMAKESPEC=win32-g++ (If you don't give qmake/Qt the specification about which system to build for, it will look for this ENV.)
I know it's been a while since you posted your question, so hopefully you've solved it. If not, try these steps and see if they help.

What version of Ruby is required for P4Ruby and where is P4Ruby installed?

I am trying to set up Ruby and P4Ruby so I can use the p4replicate.rb script, but whenever I run the p4ruby18.exe (from the Perforce FTP) I get the following error:
Perforce P4Ruby API for Ruby 1.8 - InstallShield Wizard
There was a problem tying to get the P4Ruby install path.
Possible reasons are:
1) Ruby is not installed.
2) An unsupported version of Ruby is installed.
3) The folder containing the Ruby executable is not in the system path.
4) The folder of another version's executable is in the system path before the supported version.
5) The P4Ruby install paths are not writable.
OK
I'm running Windows Vista, and have Ruby 1.8.6-p398 installed in C:\Ruby186. The directory C:\Ruby186\bin is the first thing on my Path variable (the Ruby installer put it there)! I've also confirmed it's accessible by running which ruby (cygwin is installed) which returns /cygdrive/c/Ruby186/bin/ruby. I've tried 1.8.7-p334 and 1.9.2-p290 as well.
The P4Ruby release notes claim that Ruby 1.8 is supported for versions of P4Ruby 2007.3 onwards, so I thought I'd met this criteria but it will not install.
As I'm fairly certainly I've met criteria 1, 3 and 4, I wondered whether anyone could tell me if they've managed to install P4Ruby on Windows with a specific version of Ruby (2), and if so what path P4Ruby installs to (5)?
Just a sanity check: do you have admin rights when running the installer?
To answer my own specific questions (rather than solve my problem as thankfully #p4-randall did):
the p4rubynotes.txt manual says "The P4Ruby Windows installer requires Ruby 1.8."
P4Ruby is seemingly not installed anywhere! To clarify this, it looks like the P4 client is updated with a version supporting P4Ruby, so the directory it needs to write to is the Perforce installation directory (e.g. C:\program Files\Perforce\).

Installing Ruby 1.8.7 (and other stuff) manually

I don't want to rely on the one-click installer any more, and I want to learn how to install Ruby manually. Is there a resource for this?
Download the Windows binaries for Ruby 1.8.7 here: http://www.ruby-lang.org/en/downloads/. Extract that to wherever you would like; I use C:\ruby. Then put C:\ruby\bin in your PATH environment variable.
Download the zlib package: http://www.zlib.net/zlib123-dll.zip and extract the zlib1.dll, rename it to zlib.dll and move it into your Windows\System32.
Download the iconv package: http://sourceforge.net/project/showfiles.php?group_id=25167&package_id=51458. Find and extract the iconv.dll file into your Windows\System32.
Download the rubygems package and follow the instructions, basically extracting the package and running ruby setup.rb.
Verify that everything works properly by trying a gem install rails, once that installs then do: rails test_project
Well, if you're on a Mac I'd recommend MacPorts. There's a good post on it here that's still valid.
If you're on Windows and don't want to use the one-click installer you can install Cygwin and build ruby through it. Here's a post I found.
I'd start with the one-click installer, probably by taking a good look inside the source on RubyForge (disclaimer, I haven't actually done this...). These guys clearly know how to build Ruby on Windows from source, so I'd be inclined to see how they did it.
Beyond that, did you know you can download the 1.8.7 Windows binary from the ruby-lang.org downloads page? That page also has the current stable 1.8.7 source
You might also need libeay32.dll and ssleay32.dll, found in OpenSSL: http://www.slproweb.com/products/Win32OpenSSL.html
I've pretty much concluded that Ruby 1.8.7 just isn't stable yet for Windows. I was able to get it running on one Vista machine following the instructions above but not my laptop.
For the laptop I followed the following steps and everything seems to be working so far:
Install 1.8.6 using the 1-click
installer. Let it delete old copies
of Ruby if necessary.
Install gems 1.3.4
gem install rails
ruby script\console
point browser to http://localhost:3000/. Make sure everything works as expected
stop console
extract 1.8.7 zip file into the Ruby 1.8.6 directory
copy dll files discussed above into the ruby/bin directory
restart console and again check http://localhost:3000/
I would only follow these directions as a last resort if the instructions above don't work.
Before you wag a finger at me and scold me for this approach...
please consider that I spent ~8 hours reading and trying everything possible and was able to use the approach above successfully on another computer. I'm open to other suggestions!
If you are looking for a place to get all those DLL files - here is a trick: If you install the Ruby one-click-installer for Ruby 1.8.6, it has all of those DLL files in C:\ruby1.8.6\bin (assuming you installed it there).
I was playing with the PIK gem (rvm for Windows) and ran into that problem for Ruby 1.9.1 and after copying those DLL files everything worked perfectly.
Of course, those DLL files are somewhat old, so if Ruby 1.9.1 or 1.8.7 relies on any new features in those DLL files there might be a potential for a bug, but I haven't noticed anything so far and it beats hunting down them on the Internet.

Resources