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

bundle install failed: can't modify frozen String #5357

Closed
anpr opened this issue Jan 24, 2017 · 3 comments
Closed

bundle install failed: can't modify frozen String #5357

anpr opened this issue Jan 24, 2017 · 3 comments

Comments

@anpr
Copy link

anpr commented Jan 24, 2017

What I tried to accomplish

I tried to bundle install to install gems for my Rails app. (On the CI server within a Dockerfile.)

The command I ran

bundle install (within a Dockerfile, but that shouldn't matter)

What I expected to happen

That all gems where installed, including their native extensions.

What actually happened

An error message:

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

    can't modify frozen String

The exception backtrace

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

    can't modify frozen String

Gem files will remain installed in /usr/local/bundle/gems/rainbow-2.2.1 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.3.0-static/rainbow-2.2.1/gem_make.out

  /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/rake_builder.rb:13:in `build'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:164:in `block (2
levels) in build_extension'
  /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:163:in `chdir'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:163:in `block in
build_extension'
  /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:162:in
`build_extension'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:201:in `block in
build_extensions'
  /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:198:in `each'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:198:in
`build_extensions'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/installer.rb:752:in
`build_extensions'
  /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/installer.rb:304:in `install'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/source/rubygems.rb:146:in
`block in install'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/rubygems_integration.rb:187:in
`preserve_paths'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/source/rubygems.rb:136:in
`install'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/installer/gem_installer.rb:55:in
`install'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/installer/gem_installer.rb:15:in
`install_from_spec'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/installer/parallel_installer.rb:114:in
`block in worker_pool'
  /usr/local/bundle/gems/bundler-1.14.2/lib/bundler/worker.rb:63:in `apply_func'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/worker.rb:58:in `block in
process_queue'
  /usr/local/bundle/gems/bundler-1.14.2/lib/bundler/worker.rb:55:in `loop'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/worker.rb:55:in
`process_queue'
/usr/local/bundle/gems/bundler-1.14.2/lib/bundler/worker.rb:88:in `block (2
levels) in create_threads'

An error occurred while installing rainbow (2.2.1), and Bundler cannot continue.
Make sure that `gem install rainbow -v '2.2.1'` succeeds before bundling.

Everything output by bundle env

# bundle env
## Environment

Bundler 1.14.2
Rubygems 2.6.8
Ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
GEM_HOME /usr/local/bundle
GEM_PATH
Git 2.1.4
Platform x86_64-linux


## Bundler settings

disable_shared_gems
Set for your local app (/usr/local/bundle/config): "true"
silence_root_warning
Set via BUNDLE_SILENCE_ROOT_WARNING: "1"
app_config
Set via BUNDLE_APP_CONFIG: "/usr/local/bundle"
bin
Set via BUNDLE_BIN: "/usr/local/bundle/bin"
path
Set via BUNDLE_PATH: "/usr/local/bundle"


## Gemfile

### Gemfile

```ruby
source 'https://rubygems.org'

# Use puma as Web-Server, mainly because Elastic Beanstalk requires it.
gem 'puma'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.7'

# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'

# Use Rails (almost) exclusively as JSON API, bundle react UI via webpack from separate /client folder
gem "react_on_rails", "~> 6"

# AWS API client v2, also allows ActionMailer to use AWS SES to send email.
gem 'aws-sdk-rails'

# Authentication solution for Rails
gem 'devise'

# Add support to devise to send invitations via email
gem 'devise_invitable', '~> 1.6.0'

# Schema-based validation.
gem 'rschema', "~> 2.4"

# HTTP client
gem 'httparty'

# Useful information for every country.
# Cf https://github.com/hexorx/countries
gem 'countries'

# Gem to access Cloudinary API. Used to upload/transform/retrieve images.
gem 'cloudinary'

# Conversion of string to bool.
gem 'wannabe_bool'

# State machines support
gem 'aasm'

# Support for swagger
gem 'swagger-blocks'

# Keyset pagination
gem 'order_query'

# Log messages as JSON so that they can be forwarded to logstash without the need for parsing
gem 'logstash-logger'

# Data migration within schema migrations
gem 'migration_data'

# Performance monitoring with www.skylight.io
gem 'skylight'

# Track changes on models
gem 'paper_trail'

# Simple gem to work with currencies
gem 'currencies'

group :development, :test do
  # Run multiple processes with one command
  gem 'foreman'

  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Use RSpec for testing
  gem "rspec-rails"

  # Use factory girl to create stub data
  gem "factory_girl_rails", "~> 4.0"

  # Library to stub and mock HTTP requests
  gem 'webmock'

  # Possibility to replay HTTP requests
  gem 'vcr'

  # Loads environment variables from '.env'
  gem 'dotenv-rails', :groups => [:development, :test]

  # Github client library. Used within version_status.rb
  gem 'octokit'

  # Modification of environment variables during tests.
  gem 'climate_control'

  # Access to clipboard. Used by db_dump.rb.
  gem 'clipboard'

  # Domain-speficic language for command-line interface. Used by db_dump.rb.
  gem 'thor'

  # Ruby client for SSH. Used by db_dump.rb
  gem 'net-ssh'
  gem 'net-ssh-gateway'
end

group :development do
  # MailCatcher runs a super simple SMTP server which catches any email sent to it to display in a web interface.
  gem 'mailcatcher'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :console do
  # Mini view framework for the rails console. Type require 'hirb' and Hirb.enable.
  gem 'hirb'
end

gem 'therubyracer', platforms: :ruby

gem 'simplecov'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    aasm (4.11.1)
    actionmailer (4.2.7)
      actionpack (= 4.2.7)
      actionview (= 4.2.7)
      activejob (= 4.2.7)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.7)
      actionview (= 4.2.7)
      activesupport (= 4.2.7)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.7)
      activesupport (= 4.2.7)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.7)
      activesupport (= 4.2.7)
      globalid (>= 0.3.0)
    activemodel (4.2.7)
      activesupport (= 4.2.7)
      builder (~> 3.1)
    activerecord (4.2.7)
      activemodel (= 4.2.7)
      activesupport (= 4.2.7)
      arel (~> 6.0)
    activesupport (4.2.7)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.0)
      public_suffix (~> 2.0, >= 2.0.2)
    arel (6.0.4)
    aws-sdk-core (2.6.44)
      aws-sigv4 (~> 1.0)
      jmespath (~> 1.0)
    aws-sdk-rails (1.0.1)
      aws-sdk-resources (~> 2)
      railties (>= 3)
    aws-sdk-resources (2.6.44)
      aws-sdk-core (= 2.6.44)
    aws-sigv4 (1.0.0)
    aws_cf_signer (0.1.3)
    bcrypt (3.1.11)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.2.2)
    byebug (9.0.6)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    clipboard (1.1.1)
    cloudinary (1.3.0)
      aws_cf_signer
      rest-client
    concurrent-ruby (1.0.4)
    connection_pool (2.2.1)
    countries (2.0.5)
      i18n_data (~> 0.7.0)
      money (~> 6.7)
      unicode_utils (~> 1.4)
    crack (0.4.3)
      safe_yaml (~> 1.0.0)
    currencies (0.4.2)
    daemons (1.2.4)
    debug_inspector (0.0.2)
    devise (4.2.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.1)
      responders
      warden (~> 1.2.3)
    devise_invitable (1.6.1)
      actionmailer (>= 3.2.6)
      devise (>= 3.2.0)
    diff-lcs (1.2.5)
    docile (1.1.5)
    domain_name (0.5.20161129)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.1.1)
    dotenv-rails (2.1.1)
      dotenv (= 2.1.1)
      railties (>= 4.0, < 5.1)
    erubis (2.7.0)
    eventmachine (1.0.9.1)
    execjs (2.7.0)
    factory_girl (4.8.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.8.0)
      factory_girl (~> 4.8.0)
      railties (>= 3.0.0)
    faraday (0.10.1)
      multipart-post (>= 1.2, < 3)
    foreman (0.82.0)
      thor (~> 0.19.1)
    globalid (0.3.7)
      activesupport (>= 4.1.0)
    hashdiff (0.3.2)
    hirb (0.7.3)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httparty (0.14.0)
      multi_xml (>= 0.5.2)
    i18n (0.7.0)
    i18n_data (0.7.0)
    jbuilder (2.6.1)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jmespath (1.3.1)
    jquery-rails (4.2.2)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    jwt (1.5.6)
    libv8 (3.16.14.17)
    logstash-event (1.2.02)
    logstash-logger (0.22.0)
      logstash-event (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mailcatcher (0.6.5)
      eventmachine (= 1.0.9.1)
      mail (~> 2.3)
      rack (~> 1.5)
      sinatra (~> 1.2)
      skinny (~> 0.2.3)
      sqlite3 (~> 1.3)
      thin (~> 1.5.0)
    migration_data (0.3.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.10.1)
    money (6.8.0)
      i18n (>= 0.6.4, <= 0.7.0)
      sixarm_ruby_unaccent (>= 1.1.1, < 2)
    multi_json (1.12.1)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    net-ssh (4.0.1)
    net-ssh-gateway (1.2.0)
      net-ssh (>= 2.6.5)
    netrc (0.11.0)
    nokogiri (1.7.0.1)
      mini_portile2 (~> 2.1.0)
    octokit (4.6.2)
      sawyer (~> 0.8.0, >= 0.5.3)
    order_query (0.3.3)
      activerecord (>= 4.0, < 6.0)
      activesupport (>= 4.0, < 6.0)
    orm_adapter (0.5.0)
    paper_trail (6.0.2)
      activerecord (>= 4.0, < 5.2)
      request_store (~> 1.1)
    pg (0.19.0)
    public_suffix (2.0.5)
    puma (3.6.2)
    rack (1.6.5)
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.7)
      actionmailer (= 4.2.7)
      actionpack (= 4.2.7)
      actionview (= 4.2.7)
      activejob (= 4.2.7)
      activemodel (= 4.2.7)
      activerecord (= 4.2.7)
      activesupport (= 4.2.7)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.7)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.8)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.7)
      actionpack (= 4.2.7)
      activesupport (= 4.2.7)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rainbow (2.2.1)
    rake (12.0.0)
    react_on_rails (6.3.4)
      addressable
      connection_pool
      execjs (~> 2.5)
      foreman
      rails (>= 3.2)
      rainbow (~> 2.1)
    ref (2.0.0)
    request_store (1.3.2)
    responders (2.3.0)
      railties (>= 4.2.0, < 5.1)
    rest-client (2.0.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    rschema (2.4.0)
    rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    safe_yaml (1.0.4)
    sass (3.4.23)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sawyer (0.8.1)
      addressable (>= 2.3.5, < 2.6)
      faraday (~> 0.8, < 1.0)
    simplecov (0.12.0)
      docile (~> 1.1.0)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    sinatra (1.4.7)
      rack (~> 1.5)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    sixarm_ruby_unaccent (1.1.1)
    skinny (0.2.4)
      eventmachine (~> 1.0.0)
      thin (>= 1.5, < 1.7)
    skylight (1.0.1)
      activesupport (>= 3.0.0)
    spring (2.0.0)
      activesupport (>= 4.2)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.13)
    swagger-blocks (2.0.0)
    therubyracer (0.12.3)
      libv8 (~> 3.16.14.15)
      ref
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.19.4)
    thread_safe (0.3.5)
    tilt (2.0.5)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.4)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.2)
    unicode_utils (1.4.0)
    vcr (3.0.3)
    wannabe_bool (0.6.0)
    warden (1.2.6)
      rack (>= 1.0)
    web-console (2.3.0)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)
    webmock (2.3.2)
      addressable (>= 2.3.6)
      crack (>= 0.3.2)
      hashdiff

PLATFORMS
  ruby

DEPENDENCIES
  aasm
  aws-sdk-rails
  byebug
  climate_control
  clipboard
  cloudinary
  countries
  currencies
  devise
  devise_invitable (~> 1.6.0)
  dotenv-rails
  factory_girl_rails (~> 4.0)
  foreman
  hirb
  httparty
  jbuilder (~> 2.0)
  jquery-rails
  jwt_authentication (>= 0.0.11)!
  logstash-logger
  mailcatcher
  migration_data
  net-ssh
  net-ssh-gateway
  octokit
  order_query
  paper_trail
  pg (~> 0.15)
  puma
  rails (= 4.2.7)
  react_on_rails (~> 6)
  rschema (~> 2.4)
  rspec-rails
  sass-rails (~> 5.0)
  simplecov
  skylight
  spring
  swagger-blocks
  therubyracer
  thor
  turbolinks
  uglifier (>= 1.3.0)
  vcr
  wannabe_bool
  web-console (~> 2.0)
  webmock

BUNDLED WITH
   1.13.5

What's also Interesting

I could actually fix the problem by not using the latest bundler (i.e. 1.14.2), but 1.13.7 instead.

@olleolleolle
Copy link
Member

olleolleolle commented Jan 24, 2017

@anpr Hi! The root cause fix is to upgrade rubygems. gem update --system (This is not a Bundler issue.)

See the Rainbow repo for detailed discussion. ku1ik/rainbow#44

takahashim added a commit to kmuto/review that referenced this issue Jan 24, 2017
@segiddins
Copy link
Member

This was fixed in RubyGems 2.6.9

@anpr
Copy link
Author

anpr commented Jan 24, 2017

Thanks for your help.

david-a-wheeler added a commit to coreinfrastructure/best-practices-badge that referenced this issue Jan 29, 2017
This updates the gem rainbow from 2.1.0 to 2.2.0.

Previous "bundle install" efforts failed in some situations
with the message "can't modify frozen String".
As a quick workaround we forced use of the old version
until we worked out a better fix.

However, on investigation, the root cause turns out to be
a need to upgrade rubygems, using:
  gem update --system

More information:
rubygems/bundler#5357
ku1ik/rainbow#44

So we can now update the gem rainbow.

Signed-off-by: David A. Wheeler <[email protected]>
mmb added a commit to mmb/meme_captain_web that referenced this issue Feb 3, 2017
Fix bundle "can't modify frozen String" bug.

See rubygems/bundler#5357
mmb added a commit to mmb/meme_captain_web that referenced this issue Feb 3, 2017
viktorbenei added a commit to bitrise-io/datapi-client that referenced this issue Feb 10, 2017
tmp bundler fix for "Gem::Ext::BuildError: ERROR: Failed to build gem native extension."
"can't modify frozen String"

see: rubygems/bundler#5357 (comment)
kWhittington added a commit to kWhittington/united_states that referenced this issue Feb 18, 2017
masatake added a commit to masatake/ctags that referenced this issue Aug 17, 2017
lcoveralls reports following error:

	/home/.../lcoveralls/color_formatter.rb:46:in `capitalize!': can't modify frozen String (RuntimeError)

This fixes it based on the knowledge

	rubygems/bundler#5357
pierre added a commit to killbill/killbill-litle-plugin that referenced this issue Feb 6, 2018
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

3 participants