gem install pam ... on Windows - ruby

I am trying to install "pam" on Windows. But starting
$ gem install pam
gives me
generating _pam-x64-mingw32.def
compiling pam_handle.c
In file included from pam_handle.c:5:0:
_pam.h:9:21: fatal error: version.h: No such file or directory
compilation terminated.
make: *** [pam_handle.o] Error 1
make failed, exit code 2
Ruby DevKit is installed and the Installation is checked with
$ gem install json --platform=ruby
$ ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
[42]
I doubt that version.h is unix/linux specific. Has anybody managed to install this gem on Windows?

It looks like pam gem is not supported anymore.
https://rubygems.org/gems/pam says, that the latest release was about 10 years ago.
I'd offer you to consider using some newer replacements, and the most common advice is Use some unix-based OS for Ruby development, instead of windows.

Related

Guide to installing ta-lib on Windows for Ruby gem

I have tried for quite a while to install ta-lib so I can use some of the indicator functions for trading based on this github example. So far I have determined that I need to:
run gem install talib_ruby
C:\Users\king\Desktop\_REPOS\misc\stock_analysis\forex\oanda\ruby>gem install talib_ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing talib_ruby:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160810-7176-j5lye2.rb extconf.rb
checking for TA_Initialize() in -lta_lib... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating talib-x64-mingw32.def
compiling talib.c
talib.c:2:32: fatal error: ta-lib/ta_abstract.h: No such file or directory
compilation terminated.
make: *** [talib.o] Error 1
make failed, exit code 2
....
Download ta-lib header files which are in the msvc from here
Tell the talib_ruby gem where the ta-lib files when installing. Based on this SO post the correct command should look something like: sudo env ARCHFLAGS="-arch x86_64" gem install talib_ruby -- --with-talib-include=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/include/ta-lib --with-talib-lib=/opt/local/var/macports/software/ta-lib/0.4.0_0/opt/local/lib
. The command specifies a path to a lib folder which is missing from the ta-lib I downloaded. Does anyone know how to fix this?
Windows?
Sorry for my english.
My system: Windows 7 SP1 x64, ruby 2.2.4p230
You have to install Ruby Development Kit to build the binary extensions.
Download and extract source, I used ta-lib-0.4.0-src.tar.gz.
Run msys.bat from Ruby DevKit or if you have installed mingw as part of RubyInstaller, run either mingw64.exe or ming32.exe. Navigate to ta-lib source files (in my case it is /d/dev/ta-lib) and build the library:
cd /d/dev/ta-lib
./configure
make
Because the path to C headers hardcoded in gem to #include <ta-lib/ta_abstract.h>, I just make a new directory ta-lib within d:\dev\ta-lib\include source folder and all copy header files here. (Files in d:\dev\ta-lib\include*.h are copied to d:\dev\ta-lib\include\ta-lib)
Install gem. Exit the msys or mingw terminal and run the following in your Windows cmd. Be sure to replace these paths with the correct path to your ta-lib source:
gem install talib_ruby -- --with-talib-include=d:/dev/ta-lib/include --with-talib-lib=d:/dev/ta-lib/src/.libs
Make sure to change paths to yours.

Ruby error on OS X Yosemite and chef

Getting this error when trying to install chef on OS X Yosemite, other gems have installed fine. Not seeing a requirement. Just wondering if anyone has and idea of what the issue is or has come across this.
$sudo gem install chef
Building native extensions. This could take a while...
ERROR: Error installing chef:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141023-4708-6api21.rb extconf.rb
creating Makefile
/Library/Ruby/Gems/2.0.0/gems/libyajl2-1.1.0/ext/libyajl2
extconf.rb:104:in `makemakefiles': unhandled exception
from extconf.rb:138:in `<main>'
extconf failed, exit code 1
EDIT: Although my answer below will help you install it on the system version of Ruby. I would probably suggest using RVM instead as the comment below mentions. I do not use Ruby very often and it would probably be fine, but I decided to take the 10 mins to change it to installing to RVM since that way I leave the system ruby untouched.
As I was searching across the web, I could actually resolve this issue (which also appeared on docker/ubuntu) as suggested in this thread:
https://stackoverflow.com/a/32191707/1948319
Long story short: The gmp library is missing. You can install it on ubuntu with
sudo apt-get install libgmp3-dev
I had this problem with this gem specifically, and another gem with c extensions as well.
Turns out I needed to accept new terms & conditions after updating XCode :-)
sudo xcodebuild -license
So I actually answered my own question very shortly after I posted and I hope it helps someone else in the future.
I used this instead:
$ sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install chef
The Apple LLVM compiler in Xcode treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Came across this issue which was similar enough:
https://github.com/FontCustom/fontcustom/issues/194

rbenv build failed on Ubuntu 14.04

I've successfully installed rbenv (along with the build tools) on my Ubuntu 14.04 desktop, and that appears to be working fine, but as soon as I try to install ruby 2.1.1, the build fails:
daniel#grape:~$ rbenv install 2.1.1
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /home/daniel/.rbenv/versions/2.1.1
Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20140418142258.3543
Results logged to /tmp/ruby-build.20140418142258.3543.log
Last 10 log lines:
installing default ripper libraries
compiling ossl_pkcs7.c
compiling ossl_ssl.c
installing default openssl libraries
linking shared-object openssl.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/openssl'
linking shared-object ripper.so
make[2]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1/ext/ripper'
make[1]: Leaving directory `/tmp/ruby-build.20140418142258.3543/ruby-2.1.1'
make: *** [build-ext] Error 2
The contents of the log file can be found here: http://pastebin.com/SXxTeCJY
I've done some searching for help with this issue, including following what is said here: https://github.com/sstephenson/ruby-build/wiki - but I've not had any joy.
UPDATE: Use Ruby 2.1.2, it fixes this issue.
14.04 is probably shipping with readline 6.3, which uses rl_hook_func_t instead of Function.
This bug has already been reported and fixed in Ruby (https://bugs.ruby-lang.org/issues/9578), but not released yet.
Until Ruby 2.1.2 comes out (which I assume will contain this fix), you can use a patch to properly support the new rl_hook_func_t method. Use this to install Ruby 2.1.1:
curl -fsSL https://gist.github.com/mislav/a18b9d7f0dc5b9efc162.txt | rbenv install --patch 2.1.1
(Source: http://gorails.com/setup/ubuntu/14.04)
UPDATE: Ruby 2.1.2, fixes this issue. If you need to patch ruby with Chef for another reason follow the example here.
Chef installation of Ruby 2.1.1 on to Ubuntu 14.04 using LWRP
Code to patch Ruby 2.1.1 on Trusty Ubuntu (14.04) using Riotgames rbenv cookbook - cut and pasted - no warranty :-) I have a wrapper cookbook which is tested on Ubuntu 14.04 (release 1.0.4). Easiest way is get this going is to clone the repository and converge it on test kitchen. The main gotcha is that the cookbook uses Berkshelf 3.1.1 and most people are probably on 2 still. The pasted code should work on Berkshelf 2.x and 3.1.1.
Berksfile
cookbook 'rbenv', github: "RiotGames/rbenv-cookbook"
Metadata
depends 'rbenv'
Attributes (attributes/default.rb)
default['ruby']['version'] = '2.1.1'
Recipe (recipes/default.rb)
# patchutils is required to patch Ruby version
package 'patchutils'
include_recipe "rbenv::default"
include_recipe "rbenv::ruby_build"
# Installs a patched, global, ruby
rbenv_ruby node['ruby']['version'] do
global true
patch "https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff?format=diff"
end
Discussion for patch
Rich

Ruby gem curb wont install on windows 7, even if I use libcurl

I'm trying to install the curb gem on windows 7 with libcurl but it returns errors. This is for the eventual purpose of running a ruby app on a vm with vagrant, explained here github catarse install. but it returns an error saying:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe: invalid option -V (-h will show valid
options) (RuntimeError)
these are the versions I have used:
C:\>ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
C:\>gem -v
2.0.3
C:\>vagrant -v
Vagrant version 1.2.2
So I've tried using http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html but there was an error and the make_gem.out file has a lot of these (as an example, I didnt think it necessary to post the whole file):
top:
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-curl-lib=C:\curl-7.30.0-devel-mingw32\bin --with-curl-include=C:\curl-7.30.0-devel-mingw32\include
checking for curl-config... no
checking for main() in -lcurl... yes
checking for curl/curl.h... yes
bottom:
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:454: undefined reference to `_imp__curl_free'
curb_postfield.o: In function `append_to_form':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:76: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:115: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:120: undefined reference to `_imp__curl_formadd'
collect2: ld returned 1 exit status
make: *** [curb_core.so] Error 1
I was getting the same lot of linker errors trying to install curb against the latest (at the time of this post) libcurl 7.32.0. Unfortunately, older versions that used to work for me before (e.g. 7.19.4) no longer include x86-mingw packages with the library and headers.
Here you can find a list of packages including libcurl 7.24.0 that can help you build the extensions. The first post also explains how to extract them and set up the environment. I was then able to install curb 0.8.5 with gem install curb -- --with-opt-dir=c:/path/to/libcurl.
I finally got curb to install by using the source for curl, curl-7.36.0.zip, after having to compile the DevKit, DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe with Ruby200 on windows 7 32bit. curl-7.36.0-win32-fix1.msi with curl-7.36.0-win32-fix1.zip didn't work, nor the older curl-7.34.0-devel-mingw32.zip.
It has been a harrowing experience, googling the problems to have answers given by individuals that don't connect to closed issues, etc.
My stack: Windows 7, git bash 1.8.4.msysgit, ruby 1.9.3p484, rubygems 1.8.28
I got it to work doing the following (mostly mentioned at http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html)
Install DevKit
Download and extract curl-7.34.0-devel-mingw32.zip to C: drive, let's called this location CURL7_HOME.
Add curl bin to the top of my PATH (something I missed the first time)
Install curb: gem install curb -- --with-curl-lib=$CURL7_HOME/bin --with-curl-include=$CURL7_HOME/include
Note: --with-curl-lib=$CURL7_HOME/bin is not a typo. Setting it to bin directory makes it work. I've tried --with-curl-dir=$CURL7_HOME and --with-curl-lib=$CURL7_HOME/lib and those don't work.

Ruby 1.9.3 + Rails on Solaris 10 - libyaml is missing

I'm trying to install Ruby on Rails on Solaris 10 box. I managed to build Ruby 1.9.3 from source and I installed gems but when I run gem command every time I get this message:
# gem list
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
This is really anoying :)
So I tried to rebuild Ruby and here is what I noticed in the output of make.
configuring psych
libyaml is missing. Please install libyaml.
Failed to configure psych. It will not be installed.
I found the extconf.rb script that checks for that and I tried to run it manually:
# pwd
/root/pub/ruby-1.9.3-p194/ext/psych
#
# irb --simple-prompt
>> require 'mkmf'
=> true
>> find_header 'yaml.h'
checking for yaml.h... yes
=> true
>> find_library 'yaml', 'yaml_get_version'
checking for yaml_get_version() in -lyaml... yes
=> true
>> exit
Apparently extconf.rb could find libyaml but make could not. So I'm puzzled why make does not find it. Any thoughts?
There are a couple of walk-throughs online regarding the install of Rails on Solaris.
This is for Rails 3: https://www.machine-unix.com/2011/05/installing-rails3-on-solaris-10-910/
And this one talks about avoiding issues with incompatible libraries: http://www.nowastedmoves.com/2009/geekery/installing-ruby-on-rails-on-solaris-10-1008-2/
I've never tried this on Solaris, but hopefully this will be of help.
I had this problem with Mac OS, perhaps it helps: http://icodeapps.net/?p=8
You need to install libyaml.
If you're install libyaml from a pre-built package, you will likely need a separate package with development headers, usually "libyaml-dev" or similar.
Alternatively you can install libyaml from source:
Download the source package:
http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz. To build and install LibYAML, run:
$ ./configure
$ make
# make install
(Note the last line begins with a #, indicated a root shell, prepend sudo when running as a normal user.)
Then reconfigure and recompile Ruby after installing libyaml.

Resources