title: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. UBUNTU 18.04
body: <p>I'm trying to move my GitLab to mysql following <a href="https://lessmind.github.io/2016/11/18/gitlab-ce-omnibus-package-with-mysql/" rel="nofollow noreferrer">this</a>. In the process when i try -</p>
  
  <pre><code>    $ cd /opt/gitlab/embedded/service/gitlab-rails
      $ sudo /opt/gitlab/embedded/bin/bundle install
  </code></pre>
  
  <p>I get the following error - </p>
  
  <blockquote>
    <p>Installing gpgme 2.0.13 with native extensions </p>
    
    <p>Installing nokogiri 1.8.2 with native extensions</p>
    
    <p>Gem::Ext::BuildError: ERROR: Failed to build gem native extension.</p>
    
    <p>current directory:
    /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/allocations-1.0.5/ext/liballocations
    /opt/gitlab/embedded/bin/ruby -r ./siteconf20180615-5748-1r5uwd8.rb
    extconf.rb</p>
    
    <p>mkmf.rb can't find header files for ruby at
    /opt/gitlab/embedded/lib/ruby/include/ruby.h</p>
    
    <p>extconf failed, exit code 1</p>
    
    <p>Gem files will remain installed in
    /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/allocations-1.0.5 for
    inspection. Results logged to
    /opt/gitlab/embedded/service/gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/allocations-1.0.5/gem_make.out</p>
    
    <p>An error occurred while installing allocations (1.0.5), and Bundler
    cannot continue. Make sure that <code>gem install allocations -v '1.0.5'</code>
    succeeds before bundling.</p>
  </blockquote>
  
  <p>I have tried <code>sudo gem install allocations -v '1.0.5'</code> which says one gem successfully built but gives the same error over and over. I have ruby2.5-dev installed also.</p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>As asked in the comments, this is the config in  /opt/gitlab/embedded/service/gitlab-rails/.bundle/config - </p>
  
  <hr>
  
  <blockquote>
    <p>BUNDLE_RETRY: "5"</p>
    
    <p>BUNDLE_PATH: "/opt/gitlab/embedded/service/gem"</p>
    
    <p>BUNDLE_JOBS: "9"</p>
    
    <p>BUNDLE_DISABLE_SHARED_GEMS: "true"</p>
    
    <p>BUNDLE_WITHOUT: "development:test:postgres"</p>
  </blockquote>
  
  <p>If I run <code>sudo gitlab-ctl reconfigure</code>, I get this massive error - </p>
  
  <pre><code>There was an error running gitlab-ctl reconfigure:
  
  bash[migrate gitlab-rails database] (gitlab::database_migrations line 49) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
  ---- Begin output of "bash"  "/tmp/chef-script20180618-9085-8vou2p" ----
  STDOUT: bundler: failed to load command: rake (/opt/gitlab/embedded/service/gem/ruby/2.3.0/bin/rake)
  Bundler::GemNotFound: Your bundle is locked to RedCloth (4.3.2), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of RedCloth (4.3.2) has removed it. You'll need to update your bundle to a different version of RedCloth (4.3.2) that hasn't been removed in order to install.
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:179:in `rescue in specs'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:173:in `specs'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:233:in `specs_for'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:222:in `requested_specs'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:118:in `block in definition_method'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:19:in `setup'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'
    /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `&lt;top (required)&gt;'
    /opt/gitlab/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /opt/gitlab/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  STDERR: 
  </code></pre>