One of my aspirations is to blog a bit more (not everything I do is traveling, and besides, I returned months ago)! I
have a techie side too, so I thought I would blog about some of the more interesting tech topics that I have been
working with lately. (I know how much others’ tech blogs have helped me!)
I develop sites using Rails, and use the Deprec gem of Capistrano recipies to greatly speed up the installation /
configuration of my machines. Lately I’ve used Ubuntu 8.04 and Deprec tends to work flawlessly. However with Debian 5
Lenny I ran into a hiccup that required me to patch the Swiftiply gem. During cap deprec:rails:install_stack
Deprec-2.0.9 installs the Swiftiply gem. In Debian it fails with the following trace:
1234567891011121314
~/swiftiply-0.6.1.1$ sudo ruby setup.rb
Building extension in /home/kmtrowbr/swiftiply-0.6.1.1/ext/fastfilereader with {:mkmf=>true}.
checking for main() in -lpthread... yes
checking for sys/epoll.h... yes
....
creating Makefile
g++ -I. -I. -I/opt/ruby-enterprise-1.8.6-20090113/lib/ruby/1.8/x86_64-linux -I/home/kmtrowbr/swiftiply-0.6.1.1/ext/fastfilereader -DHAVE_SYS_EPOLL_H -DHAVE_OPENSSL_SSL_H -DHAVE_OPENSSL_ERR_H -DOS_UNIX -DBUILD_FOR_RUBY -DHAVE_EPOLL -DWITH_SSL -fPIC -g -O2 -c mapper.cpp
mapper.cpp: In constructor 'Mapper_t::Mapper_t(const std::string&)':
mapper.cpp:53: error: 'strerror' was not declared in this scope
mapper.cpp:57: error: 'strerror' was not declared in this scope
mapper.cpp:62: error: 'strerror' was not declared in this scope
make: *** [mapper.o] Error 1
Long and short, get the Swiftiply source, and patch the file /ext/fastfilereader/mapper.cpp to add in a few missing
header files:
1234567
~$ wget --quiet http://swiftiply.swiftcore.org/files/swiftiply-0.6.1.1.tgz
~$ tar xvf swiftiply-0.6.1.1.tgz
~$ cd swiftiply-0.6.1.1/ext/fastfilereader/
~/swiftiply-0.6.1.1/ext/fastfilereader$ ls
Makefile extconf.rb mapper.cpp mapper.h mkmf.log rubymain.cpp rubymain.o
~/swiftiply-0.6.1.1/ext/fastfilereader$ nano mapper.cpp
If you have the eventmachine gem installed on your machine, you can compare the mapper.cpp headers in Swiftiply’s
source to those in Eventmachine’s produce your own diff:
Or here is a diff in image format to make it very clear:
Once you’ve patched that file, install the gem using the setup.rb file in the root of the source:
1234
~/swiftiply-0.6.1.1$ sudo ruby setup.rb
[sudo] password for kmtrowbr:
Building extension in /home/kmtrowbr/swiftiply-0.6.1.1/ext/fastfilereader with {:mkmf=>true}.
...