# Bundle install fails after adding gem "mysql2" and gem "reverse\_markdown"

**URL:** <https://meta.discourse.org/t/bundle-install-fails-after-adding-gem-mysql2-and-gem-reverse-markdown/272925>\
**Category:** Migration\
**Tags:** unsupported-install\
**Created:** [July 26, 2023, 1:39pm UTC](https://meta.discourse.org/t/bundle-install-fails-after-adding-gem-mysql2-and-gem-reverse-markdown/272925 "2023-07-26T13:39:16Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![xbd](https://avatars.discourse-cdn.com/v4/letter/x/b5e925/32.png) [@xbd](https://meta.discourse.org/u/xbd)\
**Post date:** [July 26, 2023, 1:39pm UTC](https://meta.discourse.org/t/bundle-install-fails-after-adding-gem-mysql2-and-gem-reverse-markdown/272925/1 "2023-07-26T13:39:16Z")

</div>

I’m trying to add “mysql2” and “reverse\_markdown” to my fresh discourse container in “Gemfile” to migrate data with the ipb script.

> bundle config unset deployment  
> bundle install

results with:

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

    current directory: /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/mysql2-0.5.5/ext/mysql2
/opt/bitnami/ruby/bin/ruby extconf.rb
checking for rb_absint_size()... ***extconf.rb failed***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/bitnami/ruby/bin/$(RUBY_BASE_NAME)
/opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:583:in `try_link0'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:601:in `try_link'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:812:in `try_func'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:1116:in `block in have_func'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:989:in `block in checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:354:in `block (2 levels) in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:354:in `block in postpone'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:324:in `open'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:350:in `postpone'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:988:in `checking_for'
        from /opt/bitnami/ruby/lib/ruby/3.2.0/mkmf.rb:1115:in `have_func'
        from extconf.rb:34:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0-static/mysql2-0.5.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/mysql2-0.5.5 for inspection.
Results logged to /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0-static/mysql2-0.5.5/gem_make.out

  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:118:in `run'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:27:in `build'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:186:in `build_extension'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:220:in `block in build_extensions'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:217:in `each'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:217:in `build_extensions'
  /opt/bitnami/ruby/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:845:in `build_extensions'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/source/rubygems.rb:200:in `install'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/installer/gem_installer.rb:54:in `install'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/installer/parallel_installer.rb:155:in `do_install'
/opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/installer/parallel_installer.rb:146:in `block in
worker_pool'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/worker.rb:62:in `apply_func'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/worker.rb:57:in `block in process_queue'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/worker.rb:54:in `loop'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/worker.rb:54:in `process_queue'
  /opt/bitnami/discourse/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.1/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing mysql2 (0.5.5), and Bundler cannot continue.

In Gemfile:
  mysql2

```

---

_[View the full topic](https://meta.discourse.org/t/bundle-install-fails-after-adding-gem-mysql2-and-gem-reverse-markdown/272925)._
