LinuxmacOSRubyパソコンのこと

Rails 7.0.8.7 Updateで起動エラー "Logger::Severity.constants.each do |severity|"

1 Mins read

Ruby 3.2.6

Ruby on Rails 7.0.8.7

起動でこける

原因はgem

gem 'concurrent-ruby', '1.3.5'

Gemfileの末尾に追記して、しばらく固定にしておく

gem 'concurrent-ruby', '1.3.4'

追記したらインストール

bundle install

# Fetching concurrent-ruby 1.3.4 (was 1.3.5)
# Installing concurrent-ruby 1.3.4 (was 1.3.5)

以下ログ

# gem 'concurrent-ruby', '1.3.5' では以下エラーになるので'1.3.4'固定にしておく
#
# bundler: failed to load command: puma (/app-root/vendor/bundle/ruby/3.2.0/bin/puma)
# /app-root/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/logger_thread_safe_level.rb:12:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)
#
# Logger::Severity.constants.each do |severity|
# ^^^^^^^^^^
Read more
macOSRubyXcode日記

【Mac】rbenv openssl [BUILD FAILED] [make: *** [all] Error 2]

1 Mins read

古い環境が必要となり旧macへXcodeやRuby環境つくる時にハマったので覚書

20220315
■環境
macOS High Sierra 10.13.6
Homebrew 3.4.1-67-gb31d8e9
rbenv 1.2.0

こんなエラーが発生

Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...

BUILD FAILED (Mac OS X 10.13.6 using ruby-build 20220218)

Inspect or clean up the working tree at /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.ggie1q
Results logged to /var/folders/rc/9hwgt2nd0rxgjzvt9kc0zgph0000gn/T/ruby-build.20220315231102.889.log

Last 10 log lines:
/usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus'
typedef CCCryptorStatus CCRNGStatus;
        ^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
    if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
                                              ^
2 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

そこでOpenSSL1.0が必要
以下のコマンドにて「rbenv/tap/openssl@1.0 1.0.2t」がインストールされる

#OpenSSL1.0をInstall
brew install rbenv/tap/openssl@1.0

#環境変数設定 [hogeはuserだよ]
echo 'export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"' >> /Users/hoge/.bash_profile
#環境変数反映
source .bash_profile

#必要なら環境変数反映
export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"

#これその後のコマンド用に必要!
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl@1.0`"

#好きなRubyインストール
rbenv install 2.6.9

macOSの場合はOpenSSLの影響が他にもある

OpenSSLはRailsなどに使用するmysql2ライブラリーにも影響あり、MySQL5.6 Or 5.7使用する際にも影響あるので注意!

bundle installする前に
[.bundle/config]ファイルへ
以下、設定が必要!

BUNDLE_BUILD__MYSQL2: "--with-ldflags=-L/usr/local/opt/openssl@1.0/lib --with-cppflags=-I/usr/local/opt/openssl@1.0/include"
Read more