m1 MacでのRails環境設定でdb Gemがインストールできません。
m1 macminiを購入しました。これまでMacをほとんど使ってこなかったため、PATHを通すのにも悪戦苦闘しながら
Homebrewから以下のようなrailsに必要そうなファイルはインストールしました。
ruby,rails,mysqlなどは以下のようにインストール済です。
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
Rails 6.1.3.1
mysql: stable 8.0.23 (bottled)
rbenv: stable 1.1.2 (bottled)
.zshrcは以下のようになっております。
export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH" export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig" export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1" export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig" export PATH="/usr/local/opt/mysql@8.0/bin:$PATH"
RubymineでrubyプロジェクトでHello Worldが動作する事は確認しましたので、次はRailsプロジェクトを作成しようと
したのですが、以下のようなエラーが出続けて前に進むことができませんでした。
sudo bundle installなど試しましたが解決できませんでした。
また、mysqlだけの問題かと思いpostgresql、sqliteも試しましたが同様にdbのGemだけがインストールできませんでした。
アドバイスいただけませんでしょうか?
/bin/zsh -c "bash -c 'env RBENV_VERSION=2.7.2 /opt/homebrew/Cellar/rbenv/1.1.2/libexec/rbenv exec ruby /Users/myusername/RubymineProjects/untitled1/bin/rails server -b 0.0.0.0 -p 3000 -e development'" Could not find gem 'mysql2 (= 0.5.2)' in rubygems repository https://rubygems.org/ or installed locally. The source does not contain any versions of 'mysql2' Run `bundle install` to install missing gems.
/bin/zsh -c "bash -c 'env RBENV_VERSION=2.7.2 /opt/homebrew/Cellar/rbenv/1.1.2/libexec/rbenv exec bundle install'" Fetching gem metadata from https://rubygems.org/............ Resolving dependencies... Using rake 13.0.3 Using concurrent-ruby 1.1.8 Using nio4r 2.5.7 Using websocket-extensions 0.1.5 Using marcel 1.0.0 Using mini_mime 1.0.3 Using public_suffix 4.0.6 Using bindex 0.8.1 Using msgpack 1.4.2 Using bundler 2.2.15 Using byebug 11.1.3 Using regexp_parser 2.1.1 Using childprocess 3.0.0 Using ffi 1.15.0 Using rb-fsevent 0.10.4 Using method_source 1.0.0 Using zeitwerk 2.4.2 Using thor 1.1.0 Using builder 3.2.4 Using erubi 1.10.0 Fetching mysql2 0.5.2 Using semantic_range 3.0.0 Using rack 2.2.3 Using spring 2.1.1 Using turbolinks-source 5.2.0 Using i18n 1.8.9 Using tzinfo 2.0.4 Using websocket-driver 0.7.3 Using mail 2.7.1 Using addressable 2.7.0 Using bootsnap 1.7.3 Using rb-inotify 0.10.1 Using puma 5.2.2 Using sassc 2.4.0 Using crass 1.0.6 Using rubyzip 2.3.0 Using rack-test 1.1.0 Using listen 3.5.0 Using rack-mini-profiler 2.3.1 Using rack-proxy 0.6.5 Using sprockets 4.0.2 Using turbolinks 5.2.1 Using tilt 2.0.10 Using racc 1.5.2 Using minitest 5.14.4 Using selenium-webdriver 3.142.7 Using activesupport 6.1.3.1 Using nokogiri 1.11.2 (arm64-darwin) Using rails-dom-testing 2.0.3 Using loofah 2.9.0 Using globalid 0.4.2 Using activemodel 6.1.3.1 Using xpath 3.2.0 Using jbuilder 2.11.2 Using webdrivers 4.6.0 Using rails-html-sanitizer 1.3.0 Using activejob 6.1.3.1 Using activerecord 6.1.3.1 Using capybara 3.35.3 Using actionview 6.1.3.1 Using actionpack 6.1.3.1 Using actioncable 6.1.3.1 Using activestorage 6.1.3.1 Using actionmailer 6.1.3.1 Using railties 6.1.3.1 Using sprockets-rails 3.2.2 Using sassc-rails 2.1.2 Using web-console 4.1.0 Using webpacker 5.2.1 Using actionmailbox 6.1.3.1 Using actiontext 6.1.3.1 Using rails 6.1.3.1 Using sass-rails 6.0.0 Installing mysql2 0.5.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/mysql2-0.5.2/ext/mysql2 /Users/myusername/.rbenv/versions/2.7.2/bin/ruby -I /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/2.7.0 -r ./siteconf20210330-45941-q252jg.rb extconf.rb --with-cppflags\=-I/usr/local/opt/openssl@1.1/include --with-ldflags\=-L/usr/local/opt/openssl@1.1/lib checking for rb_absint_size()... no checking for rb_absint_singlebit_p()... no checking for rb_wait_for_single_fd()... no ----- Using mysql_config at /opt/homebrew/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for SSL_MODE_DISABLED in mysql.h... yes checking for SSL_MODE_PREFERRED in mysql.h... yes checking for SSL_MODE_REQUIRED in mysql.h... yes checking for SSL_MODE_VERIFY_CA in mysql.h... yes checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes checking for MYSQL.net.vio in mysql.h... yes checking for MYSQL.net.pvio in mysql.h... no checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes checking for my_bool in mysql.h... no ----- Setting rpath to /opt/homebrew/Cellar/mysql/8.0.23_1/lib ----- creating Makefile current directory: /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/mysql2-0.5.2/ext/mysql2 make "DESTDIR=" clean current directory: /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/mysql2-0.5.2/ext/mysql2 make "DESTDIR=" compiling client.c In file included from client.c:13: ./wait_for_single_fd.h:32:10: error: implicit declaration of function 'rb_thread_select' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return rb_thread_select(fd + 1, rfds, wfds, efds, tvp); ^ client.c:782:14: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types] rb_rescue2(do_send_query, (VALUE)&args, disconnect_and_raise, self, rb_eException, (VALUE)0); ^~~~~~~~~~~~~ /Users/myusername/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby/ruby.h:1988:25: note: passing argument to parameter here VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...); ^ client.c:790:16: warning: incompatible pointer types passing 'VALUE (void *)' (aka 'unsigned long (void *)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-pointer-types] rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0); ^~~~~~~~ /Users/myusername/.rbenv/versions/2.7.2/include/ruby-2.7.0/ruby/ruby.h:1988:25: note: passing argument to parameter here VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...); ^ 2 warnings and 1 error generated. make: *** [client.o] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/mysql2-0.5.2 for inspection. Results logged to /Users/myusername/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/extensions/arm64-darwin-20/2.7.0/mysql2-0.5.2/gem_make.out An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2
回答2件
あなたの回答
tips
プレビュー