Search code examples
rubybundlerruby-native-extensions

Ruby Native Extension - Manual Compilation


I created new Ruby C Extension and hosted it in GitHub, and I install via Bundler (gem 'my_cool_gem', git: '..').

But when I run the application (rails s) I get an error -

cannot load such file -- my_cool_gem/my_cool_gem

My current solution, is to manually compile it:

$ cd $(bundle show my_cool_gem)
$ rm ext/my_cool_gem/*.o
$ rake compile

only then, my app works.

Any ideas?


Solution

  • You probably misconfigured your extconf.rb.

    Make sure you have create_makefile line to look like:

    create_makefile(File.join(extension_name, extension_name))