質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.31%
Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

Q&A

解決済

1回答

2313閲覧

CircleCIでのみbundle installが失敗する(mysql2)

katahik

総合スコア79

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

0グッド

0クリップ

投稿2022/02/15 07:11

編集2022/02/15 07:21

実現したいこと

閲覧いただきありがとうございます。
CircleCIでbuildする際の「bundle install」で下記のエラーが出てしまいました
※手元の環境では問題なくbundle installができております。

解決方法などご教示いただける幸いです。

エラー

To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/circleci/myapp/web/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0-static/mysql2-0.5.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/circleci/myapp/web/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.2 for inspection. Results logged to /home/circleci/myapp/web/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0-static/mysql2-0.5.2/gem_make.out An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2 Exited with code exit status 5 CircleCI received exit code 5

コード

.circleci/config.yml

version: 2.1 orbs: ruby: circleci/ruby@1.1.2 jobs: build: docker: - image: cimg/ruby:2.6.5 working_directory: ~/myapp/web steps: - checkout: path: ~/myapp - ruby/install-deps workflows: version: 2 build_and_test: jobs: - build

Gemfile

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3', '>= 6.0.3.7' # Use mysql as the database for Active Record gem 'mysql2', '>= 0.4.4' # Use Puma as the app server gem 'puma', '~> 4.1' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 4.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # jQuery gem "jquery-rails" gem 'rails-i18n', '~> 6' gem "enum_help" gem "config" gem 'faraday' gem 'acts_as_paranoid', '~> 0.6.0' gem 'http-cookie' gem 'kaminari' gem 'devise' gem 'devise_token_auth' gem 'devise-security' gem 'devise-two-factor', '~> 3.1' # AWS gem 'aws-sdk' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false gem 'composite_primary_keys' # Antivirus gem 'clamav-client', require: 'clamav/client' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

試したこと

ruby/install-deps前にgem install mysql2 -vを実行するように記載

- run: name: Install mysql2 command: gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/' - ruby/install-deps


build

別なエラーが発生

To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/circleci/.rubygems/extensions/x86_64-linux/2.6.0-static/mysql2-0.5.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/circleci/.rubygems/gems/mysql2-0.5.2 for inspection. Results logged to /home/circleci/.rubygems/extensions/x86_64-linux/2.6.0-static/mysql2-0.5.2/gem_make.out Exited with code exit status 1 CircleCI received exit code 1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

config.ymlを下記のとおり修正したらbuildできました

steps: - checkout: path: ~/myapp - run: name: default mysql client install command: | sudo apt update sudo apt-get install default-mysql-client sudo apt-get install libmysqlclient-dev - run: name: bundle Install command: bundle install --path vendor/bundle

投稿2022/02/15 07:53

katahik

総合スコア79

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.31%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問