Перед сборкой убедитесь, что `gem install mysql2 -v '0.3.21'` успешно завершен - PullRequest
0 голосов
/ 28 августа 2018

Я пытаюсь связать установку приложения Rails 3.2 LTS на моем Mac (High Sierra), но когда он попадает в gem mysql2, он не работает:

current directory: /Users/Daniel/.gem/ruby/2.3.5/gems/mysql2-0.3.21/ext/mysql2
/Users/Daniel/.rubies/ruby-2.3.5/bin/ruby -r ./siteconf20180828-30901-1g9qqrc.rb extconf.rb
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
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /usr/local/Cellar/mysql/8.0.12/lib
-----
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/Daniel/.gem/ruby/2.3.5/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.3.21/mkmf.log

current directory: /Users/Daniel/.gem/ruby/2.3.5/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR=" clean

current directory: /Users/Daniel/.gem/ruby/2.3.5/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR="
compiling client.c
client.c:367:33: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
        elapsed_time = end_time - start_time;
                     ~ ~~~~~~~~~^~~~~~~~~~~~
client.c:439:3: error: use of undeclared identifier 'my_bool'
  my_bool res = mysql_read_query_result(client);
  ^
client.c:441:19: error: use of undeclared identifier 'res'
  return (void *)(res == 0 ? Qtrue : Qfalse);
                  ^
client.c:762:3: error: use of undeclared identifier 'my_bool'
  my_bool boolval;
  ^
client.c:793:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:794:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
    case MYSQL_SECURE_AUTH:
         ^~~~~~~~~~~~~~~~~
         MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
client.c:798:7: error: use of undeclared identifier 'boolval'
      boolval = (value == Qfalse ? 0 : 1);
      ^
client.c:799:17: error: use of undeclared identifier 'boolval'
      retval = &boolval;
                ^
client.c:830:38: error: use of undeclared identifier 'boolval'
        wrapper->reconnect_enabled = boolval;
                                     ^
client.c:1152:56: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
  mysql2rb = mysql2_mysql_enc_name_to_rb(charset_name, charset_name_len);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~               ^~~~~~~~~~~~~~~~
client.c:1185:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
  return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
                                     ^~~~~~~~~~~~~~~~~
                                     MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.12/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here
  MYSQL_DEFAULT_AUTH,
  ^
2 warnings and 10 errors generated.
make: *** [client.o] Error 1

make failed, exit code 2

Я испробовал все другие приемы, связанные с устранением подобных проблем, но ни один из них не сработал, поэтому я публикую здесь.

UPDATE:

Кажется, я знаю, в чем проблема - я запускаю mysql 8 на своей машине, но gem mysql2 0.3 не совместим с этим - поэтому я думаю, что нужен новый вопрос - как я могу установить оба mysql 5 . * и mysql8, и есть ли у каждого из них соответствующие версии самоцвета mysql2?

Нужно ли мне даже использовать 8, или я могу обойтись только с помощью 5.7?

1 Ответ

0 голосов
/ 17 мая 2019

Вы, вероятно, уже нашли ответ на этот вопрос, но если нет (или если я забыл, и мне нужно снова поискать это в Google), вот что сработало для меня:

gem install mysql2 -v '0.3.21' -- --with-opt-dir="$(brew --prefix openssl)"

Я использую Rails 4.2.11 и сервер MySQL версии 5.7.24 (установлен через Homebrew)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...