УСТАНОВКА РЕДМИНА В CENTOS (связка / mysql ошибка) - PullRequest
1 голос
/ 21 января 2020

Я следую инструкциям по установке Redmine в CentOS. Ссылка: (https://www.rosehosting.com/blog/how-to-install-redmine-on-centos-7/)

В 6-й части я застрял с ошибкой.

$ bundle install --without development test postgresql sqlite

результат:

Your Gemfile lists the gem puma (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once (per group).
While it's not a problem now, it could cause errors if you change the version of one of them later.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies......
Using rake 13.0.1
Using i18n 0.7.0
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using activesupport 4.2.11.1
Using builder 3.2.4
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.5
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.6
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 4.2.11.1
Using rack 1.6.12
Using rack-test 0.6.3
Using actionpack 4.2.11.1
Using globalid 0.4.2
Using activejob 4.2.11.1
Using mime-types-data 3.2019.1009
Using mime-types 3.3.1
Using mail 2.6.6
Using actionmailer 4.2.11.1
Using actionpack-xml_parser 1.0.2
Using activemodel 4.2.11.1
Using arel 6.0.4
Using activerecord 4.2.11.1
Using public_suffix 4.0.3
Using addressable 2.7.0
Using bundler 1.17.3
Using coderay 1.1.2
Using concurrent-ruby 1.1.5
Using css_parser 1.7.1
Using htmlentities 4.3.4
Using thor 1.0.1
Using railties 4.2.11.1
Using jquery-rails 3.1.5
Using mimemagic 0.3.3
Fetching mysql2 0.4.10
Installing mysql2 0.4.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
/opt/redmine/.rvm/rubies/ruby-2.3.8/bin/ruby -I /opt/redmine/.rvm/rubies/ruby-2.3.8/lib/ruby/site_ruby/2.3.0 -r ./siteconf20200121-15610-14mtaat.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using mysql_config at /bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... no
checking for MYSQL.net.pvio in mysql.h... yes
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
-----
Setting libpath to /usr/lib64/
-----
creating Makefile

current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
make "DESTDIR=" clean

current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from ./mysql2_ext.h:35:0,
                 from client.c:1:
client.c: In function ‘rb_set_ssl_mode_option’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
client.c:118:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(self);
   ^~~~~~~~~~
client.c:119:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   int val = NUM2INT( setting );
   ^~~
client.c:145:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
compiling infile.c
compiling mysql2_ext.c
compiling result.c
result.c: In function ‘rb_mysql_result_alloc_result_buffers’:
result.c:326:40: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     wrapper->result_buffers[i].is_null = &wrapper->is_null[i];
                                        ^
result.c:328:40: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     wrapper->result_buffers[i].error   = &wrapper->error[i];
                                        ^
result.c: In function ‘rb_mysql_result_fetch_row’:
result.c:589:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
           if (args->castBool && fields[i].length == 1) {
              ^
result.c:593:9: note: here
         case MYSQL_TYPE_SHORT:      /* SMALLINT field */
         ^~~~
compiling statement.c
statement.c: In function ‘rb_raise_mysql2_stmt_error’:
statement.c:50:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   VALUE rb_error_msg = rb_str_new2(mysql_stmt_error(stmt_wrapper->stmt));
   ^~~~~
statement.c:57:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   rb_encoding *default_internal_enc = rb_default_internal_encoding();
   ^~~~~~~~~~~
In file included from ./mysql2_ext.h:35:0,
                 from statement.c:1:
statement.c: In function ‘execute’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:273:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
statement.c:405:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
             VALUE rb_val_as_string = rb_funcall(argv[i], intern_to_s, 0);
             ^~~~~
In file included from ./mysql2_ext.h:35:0,
                 from statement.c:1:
statement.c: In function ‘fields’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:481:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
linking shared-object mysql2/mysql2.so
/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
make: ** [mysql2.so] Erro 1

make failed, exit code 2

Gem files will remain installed in /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10 for inspection.
Results logged to /opt/redmine/.rvm/gems/ruby-2.3.8/extensions/x86_64-linux/2.3.0/mysql2-0.4.10/gem_make.out

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

In Gemfile:
  mysql2

После этого я попытался установить mysql2 с

$ gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'

Затем произошла другая ошибка:

Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
/opt/redmine/.rvm/rubies/ruby-2.3.8/bin/ruby -I /opt/redmine/.rvm/rubies/ruby-2.3.8/lib/ruby/site_ruby/2.3.0 -r ./siteconf20200121-15921-15wh19l.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
-----
Using mysql_config at /bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes
checking for MYSQL.net.vio in mysql.h... no
checking for MYSQL.net.pvio in mysql.h... yes
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
-----
Setting libpath to /usr/lib64/
-----
creating Makefile

current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
make "DESTDIR=" clean

current directory: /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10/ext/mysql2
make "DESTDIR="
compiling client.c
In file included from ./mysql2_ext.h:35:0,
                 from client.c:1:
client.c: In function ‘rb_set_ssl_mode_option’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
client.c:118:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(self);
   ^~~~~~~~~~
client.c:119:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   int val = NUM2INT( setting );
   ^~~
client.c:145:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
compiling infile.c
compiling mysql2_ext.c
compiling result.c
result.c: In function ‘rb_mysql_result_alloc_result_buffers’:
result.c:326:40: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     wrapper->result_buffers[i].is_null = &wrapper->is_null[i];
                                        ^
result.c:328:40: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     wrapper->result_buffers[i].error   = &wrapper->error[i];
                                        ^
result.c: In function ‘rb_mysql_result_fetch_row’:
result.c:589:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
           if (args->castBool && fields[i].length == 1) {
              ^
result.c:593:9: note: here
         case MYSQL_TYPE_SHORT:      /* SMALLINT field */
         ^~~~
compiling statement.c
statement.c: In function ‘rb_raise_mysql2_stmt_error’:
statement.c:50:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   VALUE rb_error_msg = rb_str_new2(mysql_stmt_error(stmt_wrapper->stmt));
   ^~~~~
statement.c:57:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   rb_encoding *default_internal_enc = rb_default_internal_encoding();
   ^~~~~~~~~~~
In file included from ./mysql2_ext.h:35:0,
                 from statement.c:1:
statement.c: In function ‘execute’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:273:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
statement.c:405:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
             VALUE rb_val_as_string = rb_funcall(argv[i], intern_to_s, 0);
             ^~~~~
In file included from ./mysql2_ext.h:35:0,
                 from statement.c:1:
statement.c: In function ‘fields’:
./client.h:56:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   mysql_client_wrapper *wrapper; \
   ^
statement.c:481:3: note: in expansion of macro ‘GET_CLIENT’
   GET_CLIENT(stmt_wrapper->client);
   ^~~~~~~~~~
linking shared-object mysql2/mysql2.so
/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
make: ** [mysql2.so] Erro 1

make failed, exit code 2

Gem files will remain installed in /opt/redmine/.rvm/gems/ruby-2.3.8/gems/mysql2-0.4.10 for inspection.
Results logged to /opt/redmine/.rvm/gems/ruby-2.3.8/extensions/x86_64-linux/2.3.0/mysql2-0.4.10/gem_make.out

Заранее спасибо !! (Извините, если я что-то написал с ошибкой)

1 Ответ

0 голосов
/ 22 января 2020

Это распространенная ошибка, gem пытается скомпилировать на вашем сервере, и кажется, что в вашем centos отсутствуют заголовки разработки mysql / mariadb.

Чтобы это исправить, просто запустите это как root:

yum install -y mariadb-devel mariadb-shared

и повторите попытку

gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'

в соответствии с рекомендациями ...

...