Bitnami Redmine にjson2.6.3を入れるまで

Bitnami Redmine 5.0.5のVMイメージを使って以下のプラグインを入れようとしたところ、json2.6.3が入れられなくて躓いていろいろ調べたのでメモ。

# 入れたプラグイン

```
redmine_absolute_dates
redmine_full_text_search
redmine_issue_templates
redmine_jstoolbar_ext
redmine_jstoolbar_ext_buttons
redmine_mattermost
redmine_theme_changer
redmine-view-customize
redmine_wiki_lists
redmine_wiki_unc
redmine_work_time
redmine_xlsx_format_issue_exporter
```

# 発生したエラー

`bundle install`したら以下のエラーが出ました。
※実行ディレクトリは大事。`/home/bitnami/redmine`でやらないと別のエラー(`No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
`)になります。

```
bitnami@debian:~/redmine$ pwd
/home/bitnami/redmine
bitnami@debian:~/redmine$ bundle install
Bundler 2.4.14 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.4.13
Installing bundler 2.4.13
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the /opt/bitnami/redmine/Gemfile freeze
by running `bundle config unset deployment`.

The dependencies in your gemfile changed

You have added to the Gemfile:
* activerecord-compatible_legacy_migration
* chupa-text (>= 1.3.3)
* groonga-client (>= 0.6.1)
* tty-progressbar
* webrick
* httpclient
* write_xlsx
```

メッセージに従って、freezeを削除
```
bundle config unset deployment
```

再チャレンジすると別のエラーに引っ掛かります。
```
bitnami@debian:~/redmine$ bundle install
Fetching gem metadata from https://rubygems.org/.........
(中略)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/json-2.6.3/ext/json/ext/generator
/opt/bitnami/ruby/bin/ruby extconf.rb
creating Makefile

current directory: /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/json-2.6.3/ext/json/ext/generator
make DESTDIR\= sitearchdir\=./.gem.20231005-1318-74bvi5 sitelibdir\=./.gem.20231005-1318-74bvi5 clean
current directory: /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/json-2.6.3/ext/json/ext/generator
make DESTDIR\= sitearchdir\=./.gem.20231005-1318-74bvi5 sitelibdir\=./.gem.20231005-1318-74bvi5
make failedNo such file or directory - make

Gem files will remain installed in /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/gems/json-2.6.3 for inspection.
Results logged to /opt/bitnami/redmine/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0-static/json-2.6.3/gem_make.out
(中略)
An error occurred while installing json (2.6.3), and Bundler cannot continue.

In Gemfile:
  groonga-client was resolved to 0.6.7, which depends on
    groonga-command-parser was resolved to 1.1.4, which depends on
      groonga-command was resolved to 1.5.2, which depends on
        json
```

`make failedNo such file or directory - make`という文言から、どうやら`make`が入ってなくてjson2.6.3がインストールできないっぽい。(まさかmakeとは思わず、ほかのものがちゃんと表示されないのかと思っていたので、気づくまでに時間かかってしまった)

そんなものが引っ掛かるのかよ。。
で、いろいろTry&Errorで調べた結果、BitnamiのVMはほかにも色々入ってないから引っ掛かってインストールできないことが判明しました。

# 対処

Try&Errorで調べながら入れていった結果、以下を実施すればjson2.6.3がインストールできるようです。
```
sudo apt install make
sudo apt install gcc
sudo apt install libc6-dev
sudo apt-get install zlib1g-dev
```

# 結果

ここまでやってから`bundle install`するとこうなります
```
bitnami@debian:~/redmine$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 13.0.6
Using minitest 5.18.0
Using concurrent-ruby 1.2.2
Using builder 3.2.4
Using zeitwerk 2.6.8
Using erubi 1.12.0
Using racc 1.6.2
Using rack 2.2.7
Using nio4r 2.5.9
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using method_source 1.0.0
Using crass 1.0.6
Using public_suffix 5.0.1
Using io-like 0.3.1
Using bundler 2.4.13
Using chunky_png 1.4.0
Using csv 3.2.6
Using rexml 3.2.5
Using commonmarker 0.23.9
Using thor 1.2.2
Using digest 3.1.1
Using gqtp 1.0.7
Using json-stream 0.2.1
Using hashie 5.0.0
Using htmlentities 4.3.4
Using httpclient 2.8.3
Installing json 2.6.3 with native extensions
Using mini_magick 4.11.0
Using mysql2 0.5.5
Using timeout 0.3.2
Using strscan 3.0.6
Using net-ldap 0.17.1
Using pg 1.2.3
Using rbpdf-font 1.19.1
Using redcarpet 3.5.1
Using rotp 6.2.2
Using rouge 3.28.0
Using rqrcode_core 1.2.0
Using rubyzip 2.3.2
Using strings-ansi 0.2.0
Using tty-cursor 0.7.1
Using tty-screen 0.8.1
Using unicode-display_width 2.4.2
Using i18n 1.10.0
Using tzinfo 2.0.6
Using nokogiri 1.13.10 (x86_64-linux)
Using rack-test 2.1.0
Using websocket-driver 0.7.5
Using mail 2.7.1
Using passenger 6.0.17
Using sprockets 4.2.0
Using request_store 1.5.1
Using addressable 2.8.4
Using archive-zip 0.12.0
Using net-protocol 0.2.1
Using rbpdf 1.21.1
Using activesupport 6.1.7.2
Using rqrcode 2.2.0
Using tty-progressbar 0.18.2
Using write_xlsx 1.11.1
Using loofah 2.21.3
Using chupa-text 1.3.3
Using css_parser 1.14.0
Using net-imap 0.2.3
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using sanitize 6.0.1
Using rails-dom-testing 2.0.3
Using rails-html-sanitizer 1.5.0
Using globalid 1.1.0
Using activemodel 6.1.7.2
Using html-pipeline 2.13.2
Using roadie 5.1.0
Using actionview 6.1.7.2
Using activejob 6.1.7.2
Using activerecord 6.1.7.2
Using deckar01-task_list 2.3.2
Using actionpack 6.1.7.2
Using activerecord-compatible_legacy_migration 0.1.2
Using actioncable 6.1.7.2
Using activestorage 6.1.7.2
Using actionmailer 6.1.7.2
Using railties 6.1.7.2
Using sprockets-rails 3.4.2
Using actionmailbox 6.1.7.2
Using actionpack-xml_parser 2.0.1
Using actiontext 6.1.7.2
Using roadie-rails 3.0.0
Using rails 6.1.7.2
Fetching groonga-command 1.5.2
Installing groonga-command 1.5.2
Fetching groonga-command-parser 1.1.4
Installing groonga-command-parser 1.1.4
Fetching groonga-client 0.6.7
Installing groonga-client 0.6.7
Bundle complete! 52 Gemfile dependencies, 94 gems now installed.
Gems in the groups 'development', 'sqlite' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`
```