Unable to install the selenium-webdriver ruby gem

861 views
Skip to first unread message

MikeC

unread,
Nov 9, 2011, 8:07:36 PM11/9/11
to Selenium Users
Hi,

I'm trying to install the ruby selenium-webdriver gem using the
command `gem install selenium-webdriver`; however, when I execute the
command I get the following fatal error:

Fetching: rubyzip-0.9.4.gem (100%)
Fetching: ffi-1.0.9.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing selenium-webdriver:
ERROR: Failed to build gem native extension.

/Users/rfc/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for ffi.h in /usr/local/include... *** 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.

From the error described, the the installation is chocking due to an
apparently missing ffi.h header file.

I'm using Ruby v1.9.2-p290 and have rubygems v1.8.10 all installed on
OS X 10.7.

Any meaningful thoughts I what I can do to address this issue? I would
assume installing the gem should be a simple, straightforward matter.

-Mike

Jari Bakken

unread,
Nov 10, 2011, 10:12:27 AM11/10/11
to seleniu...@googlegroups.com
On Thu, Nov 10, 2011 at 2:07 AM, MikeC <michael....@gmail.com> wrote:

Any meaningful thoughts I what I can do to address this issue? I would
assume installing the gem should be a simple, straightforward matter.


Looks like a problem with the ffi gem, so you should probably ask on the ruby-ffi list [1]. 

Assuming this is a bug in ffi 1.0.9, does `gem install ffi --version 1.0.10` work for you? I'm about to release a new selenium-webdriver gem that loosens the ffi dependency, so you'd get 1.0.10 by default once that's out.


MikeC

unread,
Nov 10, 2011, 6:42:55 PM11/10/11
to Selenium Users
I found the problem and it has to do with Ruby's mkmf gem. The issue
is when you try to build a C extension. The mkmf generates a Makefile
to confirm a clean compile, such as the following:

"/usr/bin/gcc-4.2 -o conftest -I/Users/fc/.rvm/rubies/ruby-1.9.2-p290/
include/ruby-1.9.1/x86_64-darwin11.0.0 -I/Users/fc/.rvm/rubies/
ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/fc/.rvm/
rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -
D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-
parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-
initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe
conftest.c -L. -L/Users/fc/.rvm/rubies/ruby-1.9.2-p290/lib -L. -
lruby.1.9.1-static -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

The problem is that it's trying to make use of gcc-4.2. However, if
you have xcode 4.2 installed there is no gcc-4.2, rather you have llvm-
gcc-4.2 installed in the /usr/bin directory. The moment you change
gcc-4.2 to llvm-gcc-4.2 everything works. This will have to be brought
up with the core Ruby team.

-Mike

On Nov 10, 7:12 am, Jari Bakken <jari.bak...@gmail.com> wrote:

MikeC

unread,
Nov 10, 2011, 7:38:20 PM11/10/11
to Selenium Users
Note: If you have xcode 4.2 installed and there is not gcc-4.2 on your
system, you can still install selenium-webdriver by simply creating a
symbolic link to llvm-gcc-4.2 and calling it gcc-4.2. Ruby will then
find it and build the ffi gem properly.

-Mike
Reply all
Reply to author
Forward
0 new messages