Cannot install the mechanize gem - ruby

I only had ruby 2.0 on my system. I tried to install mechanize gem. It gave me an error which told me to install ruby devkit. I installed devkit as follows - Download the installer/extractor > extract devkit to c:\devkit > cd into c:\devkit > add the path c:\Ruby200-x64 into the config.yml file > ruby dk.rb init > ruby dk.rb install. Then I got the error below. How can this be fixed ?
config.yml file -
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- C:\Ruby200-x64
Error -
C:\Ruby2Devkit>gem install mechanize
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -lstdc++... *** 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:/Ruby200-x64/bin/ruby
--with-stdc++lib
--without-stdc++lib
C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed
to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:720:in `try_func'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:950:in `block in
have_library'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:895:in `block in
checking_for'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels)
in postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:945:in `have_library'
from extconf.rb:2:in `<main>'
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/
2.0.0/gems/unf_ext-0.0.6 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/unf_ext-0.0.6/
ext/unf_ext/gem_make.out

If possible, please upvote this guy, whose answer helped me - https://stackoverflow.com/a/16579164/3184475
I spent hours trying to figure out a way to get this right using my existing ruby installation. I installed devkit and mingw (base and dev tools). Nothing helped ! I could not install any of the gems that mattered.
Solution - Delete your devkit. Uninstall your ruby. Install RailsInstaller from - http://railsinstaller.org/en
You will get some extra software with this installer. But, who cares ? It will save you 5 hours of frustration, googling, running commands and following steps about which you have no clue. If you are not allowed to do that, then prepare for hell.
After you install this software, go to cmd and run ruby -v to check which ruby you have.
When you try to install a gem, you might get some ssl security certificate errors like - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
The solution is here - https://gist.github.com/luislavena/f064211759ee0f806c88
I have the main steps from the above link which worked for me. I suggest you read the whole article though.
Step 1: Obtain the new trust certificate
If you've read the previous sections, you will know what this means (and shame on you if you have not).
We need to download AddTrustExternalCARoot-2048.pem.
Use the above link and place/save this file somewhere you can later find easily (eg. your Desktop).
IMPORTANT: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.
Step 2: Locate RubyGems certificate directory in your installation
In order for us copy this file, we need to know where to put it.
Depending on where you installed Ruby, the directory will be different.
Take for example the default installation of Ruby 2.1.5, placed in C:\Ruby21
Open a Command Prompt and type in:
C:\>gem which rubygems
C:/Ruby21/lib/ruby/2.1.0/rubygems.rb
Now, let's locate that directory. From within the same window, enter the path part up to the file extension, but using backslashes instead:
C:\>start C:\Ruby21\lib\ruby\2.1.0\rubygems
This will open a Explorer window inside the directory we indicated.
Step 3: Copy new trust certificate
Now, locate ssl_certs directory and copy the .pem file we obtained from previous step inside.
It will be listed with other files like GeoTrustGlobalCA.pem.
Step 4: Profit
There is actually no step 4. You should be able to install Ruby gems without issues now.
In case you can't get that file AddTrustExternalCARoot-2048.pem, you can use the text below and save it as a .pem file.
-----BEGIN CERTIFICATE-----
MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
-----END CERTIFICATE-----

Side note for OSX users. You may just need to accept XCode License sudo xcodebuild -license
In any case, take a look at mkmf.log for more details

Related

Unable to install package from ruby package management `gem` from maxOS

I am trying to use a org-roambibtexwhich in it's documentary needs also a package wirtten in Ruby, the package itself is calledanystyle-cli`, the github page is here. The package can be installed from RubyGem but when I tried to run through it I run into the following error:
gem install anystyle --user-install  ✔  at 11:59:33 
WARNING: You don't have /Users/zhouqiaohui/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing anystyle:
ERROR: Failed to build gem native extension.
current directory: /Users/zhouqiaohui/.gem/ruby/2.6.0/gems/wapiti-2.0.0/ext/wapiti
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 extconf.rb
checking for -lpthread... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in `try_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:in `block in have_library'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:in `have_library'
from extconf.rb:20:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/zhouqiaohui/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/wapiti-2.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/zhouqiaohui/.gem/ruby/2.6.0/gems/wapiti-2.0.0 for inspection.
Results logged to /Users/zhouqiaohui/.gem/ruby/2.6.0/extensions/universal-darwin-21/2.6.0/wapiti-2.0.0/gem_make.out
In fact, at first, my error is : You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
In order to solve the problem, I reinstalled ruby from homebrew and did the following the suggestion from here, but afterward, when I tried to run the command again I am encountering the problem I just showed.
I looked into the path ~/.gen/ruby/2.6.0 and saw there's no bin folder so I created it manually and rerun the command, the error persists.
I found a solution that works for macos:https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
I think this is the most important part of the error message:
You have to install development tools first.
Installing the developer tools on a Mac can be done with this command:
xcode-select —install
When you get the error command line tools are already installed, use "Software Update" to install updates when trying to install the developer tools. Then they are already installed and need to be updated. This usually happens each time after an macOS upgrade. To update the developer tools, choose System Settings from the Apple menu  in the corner of your screen. Then click General in the sidebar, and Software Update on the right. Or choose System Preferences. Then click Software Update.

Ruby Shopify CLI installation - missing libraries - error

I am fairly new to Ruby and getting an error in the command line when attempting to use it to install Shopify CLI gem install shopify-cli.
I verified that I have ruby installed by running ruby -v
Here is the error:
C:\Users\mso87>gem install shopify-cli
Fetching rb-fsevent-0.11.0.gem
Fetching rb-inotify-0.10.1.gem
Fetching ffi-1.15.3-x64-mingw32.gem
Fetching listen-3.6.0.gem
Fetching liquid-5.0.1.gem
Fetching nokogiri-1.12.3-x64-mingw32.gem
Fetching nokogumbo-2.0.5.gem
Fetching theme-check-1.2.0.gem
Fetching shopify-cli-2.2.2.gem
Successfully installed rb-fsevent-0.11.0
Successfully installed ffi-1.15.3-x64-mingw32
Successfully installed rb-inotify-0.10.1
Successfully installed listen-3.6.0
Successfully installed liquid-5.0.1
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing shopify-cli:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/racc-1.5.2/ext/racc/cparse
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20210816-16376-5tlz85.rb extconf.rb
checking for rb_ary_subseq()... *** 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:/Ruby26-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:552:in try_link0'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:570:in try_link' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:782:in try_func'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1069:in block in have_func' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:959:in block in checking_for'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:331:in open'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:331:in open'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:357:in postpone' from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:958:in checking_for'
from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1068:in have_func' from extconf.rb:6:in '
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/racc-1.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/racc-1.5.2 for inspection.
Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/racc-1.5.2/gem_make.out
The docs for shopify cli mention that you need ruby 2.7 installed on your system. From looking at your output, you're using ruby 2.6.
https://shopify.dev/apps/tools/cli/installation

Cannot install vagrant plugins without sudo on OS X

I've installed plugins previously within vagrant. Now on a different MacBook, I'm trying to install some of the same plugins I was using on my older MacBook.
For example when I try to install vagrant-hostmanager I get a ruby permissions error:
$ vagrant plugin install vagrant-hostmanager
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
An error occurred while installing ffi (1.9.8), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.8'` succeeds before bundling.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/vagrant/embedded/bin/ruby 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
--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=/opt/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}/
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/opt/vagrant/embedded/lib/ruby/2.0.0/tmpdir.rb:92:in `mktmpdir': parent directory is world writable but not sticky (ArgumentError)
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:510:in `try_link0'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:427:in `have_devel?'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:433:in `try_do'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /opt/vagrant/embedded/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:16:in `<main>'
Gem files will remain installed in /Volumes/Passport/vagrant.d/gems/gems/ffi-1.9.8 for inspection.
Results logged to /Volumes/Passport/vagrant.d/gems/gems/ffi-1.9.8/ext/ffi_c/gem_make.out
One thing that is different is that as I'm tight on space on my local SSD, I've defined the following in my .bashrc:
export VAGRANT_HOME=/Volumes/Passport/vagrant.d
So my box files are stored on a 2TB USB3 drive instead of chewing up valuable SSD space.
Now I could execute the plugin install using sudo, but that becomes a cascading issue, in that vagrant up now cannot see the plugin within the Vagrantfile without doing sudo vagrant up. And then the VM is owned by root... you can see how this cascades out of control.
Anyone know what is wrong? How I might solve?
edit: I discovered that if I change my VAGRANT_HOME back to the default value of ~/.vagrant.d, I can install the plugin - however my boxes are now on a volume not accessible by the default setting. Apparently this is a Ruby limitation.
TIA!
Okay I found the problem to this, but unclear where the responsibility for fixing this lies - I'm thinking this is a Ruby bug on OS X (for at least the version embedded within Vagrant).
Turns out Dir.mktmpdir expects the $TMPDIR variable to have the sticky bit set. On OS X the $TMPDIR variable points to unique per user directory like:
/var/folders/yl/y9zbwwm951v3x6p62yn24ckw0000gn/T
Changing the sticky bit using
chmod +t $TMPDIR
or really the more appropriate
chmod 700 $TMPDIR
Fixes this problem.
Note: I'm not sure why or how my $TMPDIR got 777 permissions, I've checked other OS X 10.10 installs and found that $TMPDIR correctly has 700 permissions.
I suspect the permissions on /Volumes/Passport might be strange. You may want to try:
> sudo chown -R `whoami` /Volumes/Passport
> sudo chmod 755 /Volumes/Passport
And then retry your install.

Error in uuid4r gem installation in linux

I am getting this error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-opt-include=/usr/local/opt/ossp-uuid/include --with-opt-lib=/home/kiwitech/Documents/ossp-uuid
checking for uuid_export() in -luuid... no
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-uuidlib
--without-uuidlib
OSSP uuid library 'uuid' required -- not found.
extconf failed, exit code 1
Gem files will remain installed in /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/gems/uuid4r-0.2.0 for inspection.
Results logged to /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/uuid4r-0.2.0/gem_make.out
Please someone help me
You need to install libossp-uuid and it's dev headers.
Probably something like:
sudo apt-get install libossp-uuid-dev
And then the gem installs.
Are you sure you need to use that gem anyway? In ruby 1.9+ there's already the module SecureRandom in standard library which provides UUID and also lots of pure ruby gems like uuidtools and uuid. If you need to parse the UUID's, there's ruby-uuid.
If you're running OS X Yosemite do the following:
gem install uuid
brew install ossp-uuid
(You need to have brew already installed. If you don't you can get it from here: http://brew.sh)
If you're using rvm, check that your session state is correct. If you cd around a lot, reset your terminal, or your environment variables get corrupted, you can end up with your commands trying to work with the system Ruby. A quick way to reset rvm-related stuff is just doing cd . in a project directory.
$ cd .
$ gem install uuid

Standalone RedCloth on Windows

Context
I've recently taken part of a software development project for which I'd like technical documents to be written using a textual markup (suitable to be tracked in the code repository, alongside the code). Because the project is already using Redmine, I'd like to use Textile thus avoiding other developers to learn Yet Another Markup Language. I know implementations vary somewhat, so in the spirit of POLS, I would like to use RedCloth, which is used internally by Redmine.
We are developping on and deploying to multiple OSes, including Windows. For lots of convenience, as well as non-technical, non-developer users using Windows only I'd like to be able to compile said technical documents using a standalone tool, preferably deployed as a single installer.
I'm 100% new to Ruby, so please be patient. I don't plan on developing in Ruby for this project, I just want a working install on Windows, I'll take care of the rest from there.
Help wanted
I'm not developing a Rails application and this is for desktop installation, so don't tell me to "just use it on Linux". I have installed the DevKit which installs make, g++ etc. and is accepted by ./configure scripts as a "sane development environment".
I have a simple problem and I'm looking for a simple solution. Googling this problem has shown this problem to has been reported before and I've only found recommendations to switch to Linux, and people that tell me it "just works as advertised".
I'd like some actual help, please, even if it's only in the form of a checklist of possible failure points that I can check.
Environment
This problem occurs on Windows 7, 64-bit machines with no prior history of Ruby installation. I don't have access to a 32-bit at the moment.
Linux installs are not a problem.
Problem
I've just downloaded the Ruby Installer for Windows Ruby 1.9.2-p136 , and the Ruby Development Kit DevKit-tdm-32-4.5.1-20101214-1400-sfx.exe, which is required for compiling RedCloth. Both are the current recommended versions for deploying Ruby on Windows at the moment (or so I've read).
I'm following instructions, and so far so good. Both Ruby and the DevKit are installed in the default paths (no spaces in folder names). config.yml correctly points to the new install and nothing else. ruby dk.rb install runs fine. I can now see, in the Ruby installation folder, a file called lib/ruby/site_ruby/devkit.rb that is, I presume, the compilation pre-hook that sets the path to the DevKit when compiling Ruby gems. The code points to the correct folders, as expected.
When I test the installation with the recommended gem install rdiscount --platform=ruby command, I get this:
C:\DevKit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
"C:/Ruby192/bin/ruby.exe" extconf.rb
This is a little confusing, so I started looking around and I can find the file lib/ruby/gems/1.9.1/gems/rdiscount-1.6.5/ext/extconf.rb file. Running it through ruby extconf.rb in that folder gives me:
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:/Ruby192/bin/ruby
--with-rdiscount-dir
--without-rdiscount-dir
--with-rdiscount-include
--without-rdiscount-include=${rdiscount-dir}/include
--with-rdiscount-lib
--without-rdiscount-lib=${rdiscount-dir}/lib
c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:678:in `flush': Broken pipe (Errno::EPIPE)
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:678:in `message'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:690:in `checking_for'
from c:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
from extconf.rb:5:in `<main>'
I have read somewhere (can't find a link to it right now) that rdiscount doesn't compile on Windows, so I've proceeded with fetching the source code for RedCloth from the source repository (git clone git://github.com/jgarber/redcloth.git), as instructed.
When I try rake install from the given directory, I get errors for missing gems (diff-lcs and others), so I install them using gem install diff-lcs --version '=...' and then I can start the real installation.
When I get there, rake fails the following message:
(in c:/Users/carona/Desktop/redcloth)
rake aborted!
No such file or directory - gem build c:/Users/carona/Desktop/redcloth/redcloth.gemspec 2>&1
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:138:in ``'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:138:in `block in sh_with_code'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:137:in `chdir'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:137:in `sh_with_code'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:129:in `sh'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:42:in `build_gem'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:53:in `install_gem'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.8/lib/bundler/gem_helper.rb:31:in `block in install'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run'
c:/Ruby192/bin/rake:31:in `<main>'
However, the file c:/Users/carona/Desktop/redcloth/redcloth.gemspec actually does exist, so I have no idea how to go about this.
I've tracked the problem down to two things, the 2nd of which is my "mistake".
The MinGW tools distributed with the DevKit 4.5.1 don't work on Windows 7 64-bit. They seem to have an old version of MinGW which exhibited this problem. Installing up-to-date MinGW tools and using those allowed to compile.
I initially used Git Bash to run gem install RedCloth and this caused some paths to be translated to /C/... instead of C:/ inside the Makefile. Obviously, g++ and friends could not open any of the given files. Re-installing by running ruby and gem from cmd.exe has fixed all the problems.
I now have a happy install. I've also reported the 1st issue to the RubyInstaller team.

Resources