bundler icon indicating copy to clipboard operation
bundler copied to clipboard

recompile native extensions when using :git option

Open snusnu opened this issue 15 years ago • 6 comments

The thing is that when bundling do_mysql (or any other gem with native extensions i assume) with the :git option, then the bundling process won't put .gem files into bundler's cache/ directory and doesn't do any compiling for the native extensions. This leaves the bundle in a broken state because there's no way (that I'm aware of) to force bundler to recompile stuff (can't use --cache option because there is no .gem file, just symlinks to the dirs/gem_name from within gems/gems/. Additionally, since no .gem files are placed inside the cache/, deploying will always need to fetch the sources. Even if I commit the (poorly named) dirs/ folder to git, it still wouldn't compile the native extensions. Apologies if I'm missing something

snusnu avatar Dec 28 '09 18:12 snusnu

I added a minimal Gemfile plus a bit explanation at http://pastie.org/759302

snusnu avatar Dec 28 '09 21:12 snusnu

So I tried manually building the .gem files from the .gemspec files, adding them to gems/cache and putting them into git. However, when i run gem bundle on a fresh checkout, bundler still prefers to clone the git repos instead of using the gems, and again missing to compile the native extensions.

snusnu avatar Dec 29 '09 04:12 snusnu

Additionally, the generated environment.rb of course requires the libs from below the dirs/whatever_gem folder, where they haven't been properly built. So it seems to me that it's just not possible to use gems from :git with native extensions.

snusnu avatar Dec 29 '09 14:12 snusnu

I've just run into this problem as well. We're trying to use a fork of the yajl-ruby project which has native extensions. We were using the :git option to point at the repository for our fork.

It seems that instead of assuming the clone is a ready-to-go unpacked gem, it should instead be building the gem from the gemspec file, then installing that gem (and copying it to the cache dir) as if it were any other gem (e.g. one pulled from a gem server), which would then mean its native extensions get built.

lukeredpath avatar Jan 12 '10 13:01 lukeredpath

I've run into this issue as well. So +1.

freeformz avatar Jan 12 '10 18:01 freeformz

Currently running into this problem with nokogiri. +1

darkhelmet avatar Jul 09 '10 04:07 darkhelmet