Tags

, , , , , , ,

Today while running rails console, I got a weird error.

/Users/chandra/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found - /Users/chandra/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle

While debugging and performing a google search, I came through a solution to reinstall the ruby version. I followed the same.

Oops, I have to face another glitch

Error running '__rvm_make -j 1',
showing last 15 lines of /Users/chandra/.rvm/log/1472071369_ruby-2.3.1/make.log
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:18:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
ossl_ssl.c:2267:21: error: invalid application of 'sizeof' to an incomplete type 'const struct (anonymous struct at ossl_ssl.c:85:14) []'
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ossl_ssl.c:18:35: note: expanded from macro 'numberof'
#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
^~~~~
6 warnings and 9 errors generated.
make[2]: *** [ossl_ssl.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.

I got freaked up(what’s happening?). What changes I have made recently to the system? I try to remember hard but didn’t remember anything except fixing some SSL CERT issue.

Again I research on ossl_ssl and found that it’s OpenSSL issue. And now I start debugging the system and found that it’s OpenSSL symlink issue. I stopped here and to get proper remedy I follow these steps

Brew update

cd $(brew --repo); git fetch; git reset --hard origin/master; brew update

Uninstall OpenSSL(ignoring dependencies)

brew uninstall --ignore-dependencies openssl
brew install openssl
brew link --overwrite openssl —force

Export OpenSSL provided flags (LDFLAGS and CPPFLAGS)

export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include

Cleanup and get RVM master
There was an issue with RVM https://github.com/rvm/rvm/issues/3748

brew install ruby-build
rvm cleanup all
rvm get head

ReInstall Ruby and bundler

rvm install 2.3.1
gem install bundler
~/c/t/issue git⭠master ❯❯❯ rails c ✭
Running via Spring preloader in process 26404
Loading development environment (Rails 5.0.0.1)
gem install awesome_print #

Now, everything is working as expected, it’s time for coffee.