wycats / bundler

408 stars 30 forks source link

recompile native extensions when using :git option #142

Open snusnu opened 14 years ago

snusnu commented 14 years ago

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 commented 14 years ago

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

snusnu commented 14 years ago

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 commented 14 years ago

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.

lukeredpath commented 14 years ago

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.

freeformz commented 14 years ago

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

darkhelmet commented 14 years ago

Currently running into this problem with nokogiri. +1