I was a little addicted to running old Ruby environment and old Rails

It became necessary to build an old execution environment

If you're updating Xcode, brew upgrade, etc. This is a memo I was addicted to when I reinstalled from Ruby with rbenv because the Rails app that was working stopped working. Since it stopped working at all, I deleted (renamed) Gemfile.lock as well.

environment

program The version that was working Stuck version Current version
bundler 1.13.2 2.2.3 1.13.2
Ruby 2.3.0 2.3.0 2.3.0
Rails ~> 4.2 ~> 4.2 ~> 4.2
PostgreSQL 11 13 13
Xcode 11.x 12.3 12.3

First bundler installation procedure (stuck version)

% rbenv uninstall 2.3.0
% rbenv install 2.3.0
% gem install bundler #← Because an error will occur if you renew rubygems
% gem update --system
% gem install bundler 
% cd MY_PROJECT
% bundle install --path vendor/bundle #← Error due to different version of budler

Then install the old bundler and it will be fine

% gem install bundler -v 1.13.2

After all it is an error due to the version difference, so take a look at gem

% gem list "^bundler$"

*** LOCAL GEMS ***

% bundler (default:2.2.3, 1.13.2)

I tried various things by referring to the links below, but I couldn't solve it at all. .. .. (Rather, bundle stopped working) How to change Bundler default version

Install bundler again (version error itself resolved)

% rbenv uninstall 2.3.0
% rbenv install 2.3.0
% gem install bundler -v 1.13.2 #Specify from the beginning
% cd MY_PROJECT
% bundle install #← Error in bundle is resolved

The error was resolved.

Frequent errors of native extension system (pg etc.) at the time of bundle install

The function name may be different, but it happened quite often. The cause seems to be stricter when using Xcode 12.

~snip~
Call.c:334:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
~snip~

There were many articles saying that it is okay to use old Xcode, but I was able to build it by executing the command referring to the following site. Postgresql gem install pg 0.18.4 passes, bundle install fails

bundle config build.pg '-- --with-cflags="-Wno-error=implicit-function-declaration"'

Similarly, puma, nokogiri, libxml, etc. may cause an error, but it seems to work if you add them as follows.

bundle config build.puma '-- --with-cflags="-Wno-error=implicit-function-declaration"'

I didn't understand the necessity of --. .. ..

The built pg gives an error when accessing PostgreSQL

(Excerpt)
Add `gem 'pg'` to your Gemfile and ensure its version is at the minimum required by ActiveRecord

I didn't specify the version, so pg 1.x was included.

Fixed Gemfile

gem 'pg'
↓
gem 'pg', '0.18.4'

Even though there is Gemfile.lock, you basically have to specify the version of the gem written in Gemfile. ..

Recommended Posts

I was a little addicted to running old Ruby environment and old Rails
A story I was addicted to before building a Ruby and Rails environment using Ubuntu (20.04.1 LTS)
A story I was addicted to in Rails validation settings
I was a little addicted to ssh connection from mac to linux (ubuntu)
I was a little addicted to the S3 Checksum comparison, so I made a note.
I want to use a little icon in Rails
I was addicted to setting default_url_options with Rails devise introduction
I was addicted to starting sbt
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
[Circle CI] A story I was addicted to at Start Building
I want to add a browsing function with ruby on rails
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
I get a Ruby version error when I try to start Rails.
What I was addicted to when implementing google authentication with rails
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
Steps to build a Ruby on Rails development environment with Vagrant
I was addicted to the roll method
I was addicted to the Spring-Batch test
[Rails] I was addicted to the nginx settings when using Action Cable.
How to build a Ruby on Rails environment using Docker (for Docker beginners)
A story I was addicted to when testing the API using MockMVC
I was addicted to a simple test of Jedis (Java-> Redis library)
Problems I was addicted to when building the digdag environment with docker
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
I was addicted to using RXTX on Sierra
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
[Ruby] I want to do a method jump!
I built a Java EE environment on AWS and tried running a web application
I was addicted to installing Ruby/Tk on MacOS
I was addicted to doing onActivityResult () with DialogFragment
SpringSecurity I was addicted to trying to log in with a hashed password (solved)
I made a portfolio with Ruby On Rails
What I was addicted to when developing a Spring Boot application with VS Code
[Rails] [Docker] Copy and paste is OK! How to build a Rails development environment with Docker
A memo that I was addicted to when making batch processing with Spring Boot
[Ruby on Rails] I get a warning when running RSpec because gem'chromedriver-helper' is deprecated.
Docker command to create Rails project with a single blow in environment without Ruby
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
What I was addicted to when trying to properly openAPI/Swagger documentation with Rails + Grape + Grape Swagger
A story I was addicted to when getting a key that was automatically tried on MyBatis
I was addicted to the NoSuchMethodError in Cloud Endpoints
[Introduction] Try to create a Ruby on Rails application
Build a Ruby on Rails development environment on AWS Cloud9
I was addicted to the record of the associated model
[Ruby] I made a crawler with anemone and nokogiri.
Deploy to Ruby on Rails Elastic beanstalk (Environment construction)
I want to define a function in Rails Console
(Ruby on Rails6) How to create models and tables
[Ruby on Rails] I get a warning when executing RSpec due to a different gem version.
A story I was addicted to with implicit type conversion of ActiveRecord during unit testing
I was addicted to WSl when trying to build an android application development environment with Vue.js
I tried to create a java8 development environment with Chocolatey
From 0 to Ruby on Rails environment construction [macOS] (From Homebrew installation to Rails installation)
Difficulties in building a Ruby on Rails environment (Windows 10) (SQLite3)
I made a development environment with rails6 + docker + postgreSQL + Materialize.
What I was addicted to when introducing the JNI library
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
[Rails] I tried to create a mini app with FullCalendar