Specifying non-standard include/lib directories on gem install

Is it possible to specific non-standard directories when installing a
gem? For example, I’m working in a development environment where the
libraries and headers that the gem would compile against aren’t in
/usr/include and /usr/lib64 but instead are in my development
environment.

It’s a PITA to install the gem and then manually go to the gem directory
and re-run “ruby extconf.rb” with the --with-qpid-{lib,include} args.

On Jun 29, 2011, at 11:34 , Darryl L. Pierce wrote:

Is it possible to specific non-standard directories when installing a
gem? For example, I’m working in a development environment where the
libraries and headers that the gem would compile against aren’t in
/usr/include and /usr/lib64 but instead are in my development
environment.

It’s a PITA to install the gem and then manually go to the gem directory
and re-run “ruby extconf.rb” with the --with-qpid-{lib,include} args.

% gem help install
Usage: gem install GEMNAME [GEMNAME …] [options] – --build-flags
[options]

[… lots …]

If an extension fails to compile during gem installation the gem
specification is not written out, but the gem remains unpacked in 

the
repository. You may need to specify the path to the library’s
headers and
libraries to continue. You can do this by adding a – between
RubyGems’
options and the extension’s build options:

  $ gem install some_extension_gem
  [build fails]
  Gem files will remain installed in \
  /path/to/gems/some_extension_gem-1.0 for inspection.
  Results logged to 

/path/to/gems/some_extension_gem-1.0/gem_make.out
$ gem install some_extension_gem –
–with-extension-lib=/path/to/lib
[build succeeds]
$ gem list some_extension_gem

On Thu, Jun 30, 2011 at 03:54:57AM +0900, Ryan D. wrote:

and re-run “ruby extconf.rb” with the --with-qpid-{lib,include} args.
options and the extension’s build options:

  $ gem install some_extension_gem
  [build fails]
  Gem files will remain installed in \
  /path/to/gems/some_extension_gem-1.0 for inspection.
  Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
  $ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
  [build succeeds]
  $ gem list some_extension_gem

Ah, kk. Thanks. :slight_smile: