Redmine

Redmine 4.1.1をインストール中のbundle installでmysql2のエラー

redmine

Amazon Linux 2にredmine4.1.1をインストール中にエラーが発生しました。

少し長いですがエラーを添付します。

make "DESTDIR="
compiling client.c
In file included from ./mysql2_ext.h:39:0,
                 from client.c:1:
client.c: 関数 ‘rb_set_ssl_mode_option’ 内:
./client.h:22:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
client.c:114:3: 備考: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(self);
   ^~~~~~~~~~
client.c:115:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   int val = NUM2INT( setting );
   ^~~
client.c: トップレベル:
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-self-assign’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-parentheses-equality’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-constant-logical-operand’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-cast-function-type’ です
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
statement.c: 関数 ‘rb_raise_mysql2_stmt_error’ 内:
statement.c:48:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   VALUE rb_error_msg = rb_str_new2(mysql_stmt_error(stmt_wrapper->stmt));
   ^~~~~
statement.c:54:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   rb_encoding *default_internal_enc = rb_default_internal_encoding();
   ^~~~~~~~~~~
In file included from ./mysql2_ext.h:39:0,
                 from statement.c:1:
statement.c: 関数 ‘rb_mysql_stmt_execute’ 内:
./client.h:22:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:262:3: 備考: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
statement.c:390:13: 警告: ISO C90 は宣言とコードの混合を禁止しています
[-Wdeclaration-after-statement]
             VALUE rb_val_as_string = rb_funcall(argv[i], intern_to_s, 0);
             ^~~~~
In file included from ./mysql2_ext.h:39:0,
                 from statement.c:1:
statement.c: 関数 ‘rb_mysql_stmt_fields’ 内:
./client.h:22:3: 警告: ISO C90 は宣言とコードの混合を禁止しています [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:492:3: 備考: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
statement.c: トップレベル:
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-self-assign’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-parentheses-equality’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-constant-logical-operand’ です
cc1: 警告: 認識できないコマンドラインオプション ‘-Wno-cast-function-type’ です
linking shared-object mysql2/mysql2.so
/usr/bin/ld: -lmariadb が見つかりません
collect2: エラー: ld はステータス 1 で終了しました
make: *** [mysql2.so] エラー 1

make failed, exit code 2

Gem files will remain installed in
/home/ec2-user/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3 for
inspection.
Results logged to
/home/ec2-user/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mysql2-0.5.3/gem_make.out

An error occurred while installing mysql2 (0.5.3), and Bundler cannot
continue.
Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  mysql2

 

わたしの場合は、「MariaDB-shared」がインストールされていないために発生していました。