Ruby-LDAP and Snow Leopard - ruby

When I install Ruby-LDAP on my Snow Leopard box, all appears to go well:
$ sudo gem install ruby-ldap
Building native extensions. This could take a while...
Successfully installed ruby-ldap-0.9.9
1 gem installed
Installing ri documentation for ruby-ldap-0.9.9...
Installing RDoc documentation for ruby-ldap-0.9.9...
But when I run the Ruby script that relies on it, I get this error:
in 'require': no such file to load -- ldap (LoadError)
I also tried setting ARCHFLAGS, since doing so appears to be required for the MySQL gem to function correctly in Snow Leopard:
$ sudo env ARCHFLAGS="-arch x86_64" gem install ruby-ldap
Unfortunately, this produces exactly the same results (or lack thereof).
How do I get Ruby to work with the LDAP libraries correctly here?

Make sure you
require 'rubygems'
first.

gem install ruby-ldap

Related

Trying to install pg gem fails during ruby project build

I'm attempting to build a ruby project which uses postgres running locally. Build fails on the pg gem install. I get this error
$ gem install pg -v '0.12.2'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/path/to/.rvm/rubies/ruby-1.9.3-p545/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
so... I pass the pg_config path, and get a different error:
$ gem install pg --with-pg-config=/usr/pgsql-9.2/bin/pg_config -v '0.12.2'
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-pg-config=/usr/pgsql-9.2/bin/pg_config
Very confused.
Make sure you have libpq-dev package installed. If you don't, install it and try installing pg again without the --with-pg-config parameter.
In regards to the --with-pg-config parameter:
When passing parameters to the gem you're installing you must use two dashes before the two dashes from the option, like so:
gem install gem-name -- --gem-option
So what you want to run in order to achieve installing pg with the --with-pg-config option is:
gem install pg -v '0.12.2' -- --with-pg-config=/usr/pgsql-9.2/bin/pg_config
EDIT
Also, one last tip, after searching a bit more about this issue I found that your ruby version and architecture might affect pg's installation, I'm quoting this link:
I was hesitant to uninstall everything so I just uninstalled Ruby and reinstalled with the option set to 64-bit only (platform: "x86_64-darwin12.2.0"). After reinstalling Ruby with this option, the PG gem installed without hitch and I am back to being happy.

What's wrong with this Ruby dependency?

I am trying to use source2swagger on OSX 10.7.5
It depends on "json" so I am installing that, then trying to run as below.
machine:source2swagger jpbeuc1$ sudo gem install json
Password:
Building native extensions. This could take a while...
Successfully installed json-1.7.7
1 gem installed
Installing ri documentation for json-1.7.7...
Installing RDoc documentation for json-1.7.7...
machine:source2swagger jpbeuc1$ bin/source2swagger
bin/source2swagger:4:in `require': no such file to load -- json (LoadError)
from bin/source2swagger:4
Can anyone tell me what's not working here and how to make source2swagger see "json"?
You have source2swagger installed in your local and gems are installed in root. So your source2swagger which needs json can't access those gem which are installed in root. So I recommend to gems in local always and avoid using sudo for installing gems. To manage gems in local I suggest to use RVM.

Using RubyGems on ubuntu server

I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...
If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.

error while installing fastthread from ruby gem . How to remove the error?

gem install fastthread -v1.0.7
Building native extensions. This could take a while...
ERROR: Error installing fastthread:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:8
Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
This is what I got when I tried installing from fastthread to set up SUP mail client on my system . How to get rid of this error?
Install these and then try re-installing:
sudo apt-get install ruby1.8-dev
Try this link http://kenno.wordpress.com/2009/07/25/fixed-extconf-rb8in-require-no-such-file-to-load-mkmf-loaderror/
I was getting this same error in OS X Lion. Having Xcode 4.3 installed doesn't cut it. You have to go to preferences in Xcode and install the command line tools, which installs the necessary compiler tools for doing native builds on the system. After I did this, then gem install fastthread worked for me.
Just to add to this, on debian and ubuntu the "complete" ruby package is this:
ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
libopenssl-ruby1.8 libreadline-ruby1.8
So something like
sudo aptitude install ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8
Will save you a lot of time when doing bundle install on a large project.

Installing Watir-Web Driver on Fedora Linux

I'm trying to install watir-webdriver by using gem install watir-webdriver on Linux. I have installed ruby 1.8.6, activesupport 2.3.8 as well as firewatir. However, when I try to install watir-webdriver, I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing watir-webdriver:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
can't find header files for ruby.
(btw, for a bit of context - I'm a complete Linux newbie)
Assuming you installed ruby with yum, you'll need the rpm for development headers.
sudo yum install ruby-devel
and try again.

Resources