crasch (crasch) wrote,
crasch
crasch

GEEK: How to install Firewatir on Intel Mac OS X Tiger

[EDIT: This is outdated! Go here for an updated tutorial. ]

Firewatir is the Firefox version of Watir, which is a web application testing framework that uses ruby to drive Internet Explorer to run automated test scripts. Both Watir and Firewatir are developed natively on Windows--this is an incomplete, rough draft of my attempts to get it running on Mac OS X



About my setup:

Firefox 2.0.0.2
Mac OS X 10.4.8 (Intel)
XCode 2.4.1



* Download and install Firefox.

* Install the jssh extension. You can find it here:

http://people.mozilla.org/~davel/jssh/jssh-20060622-Darwin.xpi

To install it, double-click on the link above.

* Start Firefox manually with the jssh extension as follows:

$ cd /Applications/Firefox.app/Contents/MacOS

$ ./firefox -jssh &

* If the jssh installation works, you should be able to telnet to port 9997:

$ telnet localhost 9997
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Welcome to the Mozilla JavaScript Shell!

* Install the firewatir gem. You can find the gem here:

http://code.google.com/p/firewatir/downloads/list

Once you've downloaded it, cd to the download directory and install as follows:

$ cd ~/Desktop
$ sudo gem install --local firewatir-1.0.1-mswin32.gem

You should see:

Password:
Successfully installed firewatir, version 1.0.1
Installing ri documentation for firewatir-1.0.1-mswin32...
Installing RDoc documentation for firewatir-1.0.1-mswin32...

* To test that the unittests have run successfully, go to the unit tests directory in the firewatir gem install. Run “ruby mozilla_all_tests.rb” to run the unit test cases.

$ ruby mozilla_all_tests.rb
Loaded suite mozilla_all_tests
Started

[At this point, the script just hangs and does nothing until you interrupt it. I tried to run it with ruby-debug, by adding the following line to setup.rb:

require 'ruby-debug'
debugger

However, when I ran it again, I got the following error:

crasch2:/usr/local/lib/ruby/gems/1.8/gems/firewatir-1.0.1-mswin32/unittests crasch$ ruby mozilla_all_tests.rb
dyld: NSLinkModule() error
dyld: Symbol not found: _rl_filename_completion_function
Referenced from: /usr/local/lib/ruby/1.8/i686-darwin8.8.1/readline.bundle
Expected in: flat namespace

Trace/BPT trap

A search for the error message suggests that there is a problem with my readline installation. Readline is installed on my machine via ports:

$ port installed
The following ports are currently installed:
...
readline @5.1.004_0 (active)
...

Next I tried to rebuild readline per the instructions on this page:

http://www.nabble.com/Ruby-1.8.4-Mac-OS-X-readline-problems-t801880.html

$ curl -O ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
$ tar -xzf readline-5.1.tar.gz
$ cd readline-5.1
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

Configuration and compilation seemed to go okay. However, the "sudo make install" output resulted in the following:

 
/bin/sh ./support/mkinstalldirs /usr/local/include \
        /usr/local/include/readline /usr/local/lib \
        /usr/local/info /usr/local/man/man3
for f in readline.h chardefs.h keymaps.h history.h tilde.h rlstdc.h rlconf.h rltypedefs.h; do \
        /usr/bin/install -c -m 644 ./$f /usr/local/include/readline ; \
done
( if test -d doc ; then \
        cd doc && \
        make  infodir=/usr/local/info DESTDIR= install; \
  fi )
/bin/sh ../support/mkdirs /usr/local/info /usr/local/man/man3
if test -n "" ; then \
        /bin/sh ../support/mkdirs  ; \
fi
if test -f readline.info; then \
        /usr/bin/install -c -m 644 readline.info /usr/local/info/readline.info; \
else \
        /usr/bin/install -c -m 644 ./readline.info /usr/local/info/readline.info; \
fi
if test -f rluserman.info; then \
        /usr/bin/install -c -m 644 rluserman.info /usr/local/info/rluserman.info; \
else \
        /usr/bin/install -c -m 644 ./rluserman.info /usr/local/info/rluserman.info; \
fi
if test -f history.info; then \
        /usr/bin/install -c -m 644 history.info /usr/local/info/history.info; \
else \
        /usr/bin/install -c -m 644 ./history.info /usr/local/info/history.info; \
fi
if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
        install-info --dir-file=/usr/local/info/dir \
                /usr/local/info/readline.info ; \
        install-info --dir-file=/usr/local/info/dir \
                /usr/local/info/history.info ; \
        install-info --dir-file=/usr/local/info/dir \
                /usr/local/info/rluserman.info ; \
else true; fi
/usr/bin/install -c -m 644 ./readline.3 /usr/local/man/man3/readline.3
/usr/bin/install -c -m 644 ./history.3 /usr/local/man/man3/history.3
if test -n "" ; then \
        if test -f readline.html; then \
                /usr/bin/install -c -m 644 readline.html /readline.html; \
        else \
                /usr/bin/install -c -m 644 ./readline.html /readline.html; \
        fi ; \
        if test -f history.html; then \
                /usr/bin/install -c -m 644 history.html /history.html; \
        else \
                /usr/bin/install -c -m 644 ./history.html /history.html; \
        fi ; \
        if test -f rluserman.html; then \
                /usr/bin/install -c -m 644 rluserman.html /rluserman.html; \
        else \
                /usr/bin/install -c -m 644 ./rluserman.html /rluserman.html; \
        fi ; \
fi
mv /usr/local/lib/libreadline.a /usr/local/lib/libreadline.old
/usr/bin/install -c -m 644 libreadline.a /usr/local/lib/libreadline.a
test -n "ranlib" && ranlib /usr/local/lib/libreadline.a
mv /usr/local/lib/libhistory.a /usr/local/lib/libhistory.old
/usr/bin/install -c -m 644 libhistory.a /usr/local/lib/libhistory.a
test -n "ranlib" && ranlib /usr/local/lib/libhistory.a
test -d shlib || mkdir shlib
( cd shlib ; make  all )
make[1]: Nothing to be done for `all'.
( cd shlib ; make  DESTDIR= install )
/bin/sh ../support/mkdirs /usr/local/lib
/bin/sh ../support/shlib-install -O darwin8.8.1 -d /usr/local/lib -b /usr/local/bin -i "/usr/bin/install -c -m 644" libhistory.5.1.dylib
/bin/sh ../support/shlib-install -O darwin8.8.1 -d /usr/local/lib -b /usr/local/bin -i "/usr/bin/install -c -m 644" libreadline.5.1.dylib
install: you may need to run ldconfig


Searching for "install: you may need to run ldconfig" led me to this page:

http://blog.innerewut.de/articles/2005/05/08/tiger-and-ruby-readline

Lucas's blog archives were destroyed when his hosting company changed locations, but I was ultimately able to find a copy of the script in the wabyback machine:

http://web.archive.org/web/20050509041116/http://rufy.com/fix-ruby-tiger.sh

I downloaded and updated the script to reflect more recent versions of the software:

curl http://rubyforge.rubyuser.de/rubygems/rubygems-0.9.2.tgz | tar xfz -
cd rubygems-0.9.2
sudo ruby setup.rb
sudo gem install fixrbconfig
sudo fixrbconfig
cd ..
curl ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz | tar xfz -
cd readline-5.2
./configure
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd ..
make && sudo make install
sudo rm /usr/lib/libreadline*
sudo ln -s /usr/local/lib/libreadline* /usr/lib/
cd ..
curl ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz | tar xfz -
cd ruby-1.8.5/ext/readline/
ruby extconf.rb
make && sudo make install
cd ../../../
rm -rf ruby-1.8.5 readline-5.2 rubygems-0.9.2


The -dynamiclib flag is already present in the shlib/Makefile, so I removed the following lines from the original fix-ruby-tiger.sh script:

cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd .. 



I then ran each step manually to verify that they each worked.

After running through the modified script, I see this in my /usr/local/lib:

crasch2:/usr/local/lib crasch$ ls -al libreadline.*
-r-xr-xr-x 1 root wheel 444456 Feb 26 11:38 libreadline.5.1.dylib
-r-xr-xr-x 1 root wheel 444456 Feb 26 01:31 libreadline.5.1.dylib.old
-r-xr-xr-x 1 root wheel 425624 Feb 26 13:42 libreadline.5.2.dylib
lrwxr-xr-x 1 root wheel 21 Feb 26 13:42 libreadline.5.dylib -> libreadline.5.2.dylib
-rw-r--r-- 1 root wheel 577692 Feb 26 13:42 libreadline.a
lrwxr-xr-x 1 root wheel 21 Feb 26 13:42 libreadline.dylib -> libreadline.5.2.dylib
-rw-r--r-- 1 root wheel 578228 Feb 26 13:25 libreadline.old

But when I run the unittests with ruby-debug installed , I still get the same error:

crasch2:/usr/local/lib/ruby/gems/1.8/gems/firewatir-1.0.1-mswin32/unittests crasch$ ruby mozilla_all_tests.rb
dyld: NSLinkModule() error
dyld: Symbol not found: _rl_filename_completion_function
Referenced from: /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.8.1/readline.bundle
Expected in: flat namespace

Trace/BPT trap

Anyone have any suggestions for what to try next? Thanks!
Tags: firewatir, geek, programming, ruby
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 3 comments