Reputation: 153
I am trying to quickly calculate the hamming distance between two 64 bit integers in Ruby. I quickly discovered that even with Ruby's optimized string functions etc. it wouldn't be enough, so I turned to C extensions. For comparison, Pure Ruby benchmarked at about 350,000 comparisons per second and C extensions benchmarked at around 4,000,000.
I used the implementation here and compiled it on my computer where it worked fine. The problem I have is using it on Heroku. I tried ruby extconf.rb make
to create the makefile, which worked, and then make
to compile it which failed with make: gcc: Command not found
. It doesn't matter to me if I do this on deploy or not, but I don't know how to run code automatically at deploy. This has vexed me - if anyone could help it would be much appreciated.
Upvotes: 1
Views: 147
Reputation: 437
You can use Heroku Buildpacks to solve this https://blog.heroku.com/buildpacks
I did some work with the linguist gem which required C extensions to work and solved it by using the correct buildpack.
You can either use a prebuilt buildpack or build your own
Upvotes: 3