rtomayko/posix-spawn

`gem install posix-spawn` works, vendored `bundle` does not

Closed this issue · 2 comments

Command rm -rf vendor/bundle vendor/cache .bundle && bundle --path vendor/bundle --binstubs vendor/bundle/bin

Installing posix-spawn (0.3.6)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/users/.rbenv/versions/1.9.3-p392/bin/ruby extconf.rb --with-ldflags=\"-L/usr/lib\
creating Makefile

make
compiling posix-spawn.c
In file included from /Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/ruby/ruby.h:24,
                 from /Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/ruby.h:32,
                 from posix-spawn.c:14:
/Users/users/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/x86_64-darwin11.4.2/ruby/config.h:17:1: warning: "_GNU_SOURCE" redefined
posix-spawn.c:3:1: warning: this is the location of the previous definition
linking shared-object posix_spawn_ext.bundle
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [posix_spawn_ext.bundle] Error 2


Gem files will remain installed in /Users/users/projects/tasks/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6 for inspection.
Results logged to /Users/users/projects/tasks/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/ext/gem_make.out
ᐅ ruby -e 'puts RUBY_DESCRIPTION'
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin11.4.2]
ᐅ gem list

*** LOCAL GEMS ***

bundler (1.3.4)
ᐅ xcode-select -version
xcode-select version 2308.
ᐅ
# Gemfile
source 'https://rubygems.org'

ruby '1.9.3'

gem 'pg' # another gem with native extensions that installs successfully
gem 'posix-spawn' 

Also tried gem install posix-spawn before bundling, and bundle package --all and deprecated bundle cache --all to no avail.

Suggestions?

Found the exact variable which causes the problem, but not the source: $LDFLAGS in extconf.rb

works gem install posix-spawn: $LDFLAGS=-L. -L'/Users/user/.rbenv/versions/1.9.3-p392/lib'
broken bundle: $LDFLAGS="-L/usr/lib 2 " is not a typo, but part of the variable's value.

Found it. Bundler was not unescaping a setting that somehow was introduced. Removing the following line fixed this.

# ~/.bundle/config
# ...
BUNDLE_BUILD__POSIX-SPAWN: --with-ldflags=\"-L/usr/lib\"