Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

[1.8.0+] Global build config ignored #3404

Closed
felixbuenemann opened this issue Feb 16, 2015 · 8 comments
Closed

[1.8.0+] Global build config ignored #3404

felixbuenemann opened this issue Feb 16, 2015 · 8 comments

Comments

@felixbuenemann
Copy link
Contributor

Example (bundler 1.7.13/1.8.2 on Mac OS X 10.10.2 w/homebrew):

brew install libarchive
# keg only lib requires build flags to be picked up
bundle config build.libarchive-ruby --with-opt-dir=$(brew --prefix libarchive)

Gemfile:

source 'https://rubygems.org'
gem 'libarchive-ruby'

On bundler 1.7.13 extconf.rb --with-opt-dir=/usr/local/opt/libarchive is called during installation of the gem by bundler:

/usr/local/opt/ruby/bin/ruby -r ./siteconf20150216-25666-1oqlbrx.rb extconf.rb --with-opt-dir=/usr/local/opt/libarchive
checking for main() in -larchive... yes
checking for archive.h... yes
checking for rb_string_value_cstr() in ruby.h... yes
checking for RETURN_ENUMERATOR in ruby.h... yes
checking for rb_proc_arity() in ruby.h... yes
checking for archive_read_support_format_raw() in archive.h... yes
creating extconf.h
creating Makefile

On 1.8.0+ (tested up to 1.8.2) the --with-opt-dir flag is not passed to extconf.rb and consequently compilation fails:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/opt/ruby/bin/ruby -r ./siteconf20150216-25453-apz89b.rb extconf.rb
checking for main() in -larchive... yes
checking for archive.h... no
libarchive dev files
@felixbuenemann
Copy link
Contributor Author

I tracked this down to commit ca7b782. Reverting it fixes compilation on 1.8.2.

@felixbuenemann felixbuenemann changed the title [1.8.0+] Bundle config buildflags not passed to extconf.rb [1.8.0+] Global build config ignored Feb 16, 2015
@indirect
Copy link
Member

Ugh, definitely need to add a test to make sure that global config is found and not found correctly. Thanks for reporting this!

@felixbuenemann
Copy link
Contributor Author

This is still broken in 1.9.1.

@indirect
Copy link
Member

Thanks for following up! I'll look at this as soon as possible.

@felixbuenemann
Copy link
Contributor Author

No worries, let me know if you need more info. Downgraded back to 1.7.x for now.

@indirect
Copy link
Member

Finally tracked this down! The underlying problem turned out to be not configuration but thread-safety: in Bundler 1.8 we switched to using threads to install gems instead of forking, and gem build options are set in a global variable. We've synchronized it for now using a Monitor, but hopefully we can figure out a non-global way to handle build options in the future.

@felixbuenemann
Copy link
Contributor Author

That sounds like a fun one to debug! ;-)
I'll check it out once a new version gets released.

@indirect
Copy link
Member

Released a fix for this in version 1.8.6, and it will also be fixed in 1.9.2, which I'll release as soon as CI is green. Thanks for the bug report!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants