Archive for December, 2009

Postgres + Ruby + OSX=Multi Architectural Hell

Tuesday, December 29th, 2009

I was finally able to get my ruby/rails environment setup with my database of choice.

It wasnt easy as postgres will not build with more than one architecture at a time, I had gone through similar hell the last time I tried to build anything on OSX that had to compile against libraries made for different architectures. Fortunately the solution was relatively simple.

My database is running 64 bit and I use it for many other applications that are compiled against either multiple architectures including 64bit but also some which are 64 bit only.

Ruby on the other hand is compled for 32 bit which worked flawlessly on mysql and most of the other gems i installed when I got to the postgres it puked in weird ways and when I tried every third solution on the net it was always the same.

Bash-3.2# gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.

The bottom line from one of the only success stories that I found on the net was that you either built everything 64bit or nothing. Easy enough if you want to build all of your dependencies by yourself. The whole point of gems is to have the tools work for you. I wasnt really able to figure this out in the web full of people beating their heads on the same problem each harder than the other and each reaching the same it doesnt work conclusion but I had the fortune of getting completely away from the web long enough to realize that only the client and libraries needed to match the architecture and since all interaction between rails and the database went through a socket the architecture of the client didn’t have to be the same as the database.

so going back to my postgres source tree i did a

...postgresql-8.3.6# make distclean

and then reconfigured the database using the prefix /usr/local32

..postgresql-8.3.6# ARCHFLAGS='-arch i386' ./configure --prefix=/usr/local32/

Then I just had to tel ruby/gem to use the 32 bit libraries. Since ruby uses pg_config I made sure that the 32bit version is in the path first.

# PATH=/usr/local32/bin/:$PATH ARCHFLAGS='-arch i386' \
gem install pg  -- --with-pgsql-dir=/usr/local32/

And we are off but my god what at PITA.

My Sample Design for Fabrication Workshop.

Tuesday, December 1st, 2009

At the eagle for fabrication workshop on sunday I started with a design that Thomas Lockney threatened to build about 2 years ago called the Low Fi Arduino Guitar Pedal.

(http://www.instructables.com/id/Lo_fi_Arduino_Guitar_Pedal/)

It was simple enough to get through the necessary parts of eagle that I was teaching and while it wasn’t perfect It beat the hell out of Craig Anderton’s circuits in terms of clarity and probability of actually working. To discuss from an over view perspective creating parts I decided to add the 1/4″ jacks from another great dorkbotpdx project from Hans Lindauer.

Once I got the library part together for the 1/4″ jack I had to rearrange things quite a bit but there was still pleanty of room. The next step was to add a power connector and a regulator. The idea is to be able to mount the resulting board in one of the cheapo danelectro pedels that I have around like this

In order to get the board to work out I had to create a new package for the potentiometers but I managed to get it all to fit on the board without resorting to surface mount components.

I will post the library example latere this evening.