Unable to install Ruby 3.2.0 with Rbenv -- Missing Pysch gem - ruby-on-rails

I'm currently trying to install Ruby 3.2.0 with Rbenv and I'm getting this error every time.
BUILD FAILED (Ubuntu 22.04 using ruby-build 20230202)
Inspect or clean up the working tree at /tmp/ruby-build.20230202161804.1244.1gO1Ch
Results logged to /tmp/ruby-build.20230202161804.1244.log
Last 10 log lines:
Fix the problems, then remove these directories and try again if you want.
make[1]: Leaving directory '/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0'
Generating RDoc documentation
/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby. uh-oh! RDoc had a problem:
cannot load such file -- psych
run with --debug for full backtrace
make: *** [uncommon.mk:598: rdoc] Error 1
It seems this gem PSYCH is missing, but when I run
gem install psych
I get this other message.
Building native extensions. This could take a while...
ERROR: Error installing psych:
ERROR: Failed to build gem native extension.
current directory: /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2/ext/psych
/root/.rbenv/versions/3.1.3/bin/ruby -I /root/.rbenv/versions/3.1.3/lib/ruby/3.1.0 extconf.rb
checking for yaml.h... no
yaml.h not found
extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/root/.rbenv/versions/3.1.3/bin/$(RUBY_BASE_NAME)
--with-libyaml-source-dir
--without-libyaml-source-dir
--with-yaml-0.1-dir
--without-yaml-0.1-dir
--with-yaml-0.1-include
--without-yaml-0.1-include=${yaml-0.1-dir}/include
--with-yaml-0.1-lib
--without-yaml-0.1-lib=${yaml-0.1-dir}/lib
--with-yaml-0.1-config
--without-yaml-0.1-config
--with-pkg-config
--without-pkg-config
--with-libyaml-dir
--with-libyaml-include
--without-libyaml-include=${libyaml-dir}/include
--with-libyaml-lib
--without-libyaml-lib=${libyaml-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2 for inspection.
Results logged to /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/gem_make.out
Any help is super appreciated! Thanks

Related

Cannot install uchardet gem on Mac OS catalina

Recently I got the following errors when I tried to install the uchardet GEM in MacOS catalina,Even I specific the ICU version and lib, it still doesn't work, anyone have ideas?
Installing uchardet 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0/ext
/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/ruby -I /Users/xxx/.rvm/rubies/ruby-2.6.4/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200420-38494-q9y0cf.rb extconf.rb
Could not find ICU libraries and/or development tools. Try installing "icu-devtools" or "icu" package.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/$(RUBY_BASE_NAME)
extconf failed, exit code 1
Gem files will remain installed in /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0 for inspection.
Results logged to /Users/xxx/.rvm/gems/ruby-2.6.4/extensions/x86_64-darwin-19/2.6.0/uchardet-0.2.0/gem_make.out
I was able to reproduce this on my mac:
I fixed this error by re-installing and re-linking icu4c
brew install icu4c
brew link icu4c --force # if it shows you an error and tells you to add the path manually add them
restarted my terminal then re-installed the gem (i also tried this)
you will know it's working when you have which icu-config working https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6
however now i have another error uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found i do think the gems needs better configuration around this

Configuring Fog to install in Ruby on Rails project

I'm learning ruby on rails and have had my project hosted on c9.io. In the process of migrating over to Amazon AWS Cloud9 I'm having to reinstall my gems to my project. I am getting a config error while trying to build gem native extensions.
I'm not actually sure how to configure this gem before I enter 'gem install fog' into the command line. I've tried searching on the Fog website but I can't find the info on their page.
The error is:
Building native extensions. This could take a while...
ERROR: Error installing fog:
ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.rvm/gems/ruby-2.3.4/gems/ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c
/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/ruby -r ./siteconf20190515-17400-2yzzer.rb extconf.rb
checking for xml2-config... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/ubuntu/.rvm/rubies/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
--with-libxml2-config
--without-libxml2-config
--with-pkg-config
--without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ubuntu/.rvm/gems/ruby-2.3.4/extensions/x86_64-linux/2.3.0/ovirt-engine-sdk-4.3.0/mkmf.log
extconf failed, exit code 1
The mkmf.log says:
find_executable: checking for xml2-config... -------------------- no
--------------------
"pkg-config --exists libxml2"
package configuration for libxml2 is not found
I just don't know how to translate this log message into my codebase so I can install fog and continue working on my app.
Instead of
gem 'fog'
Use
gem 'fog-aws'
In your gem file and it should work.
Try installing xml2 development package:
apt-get install libxml2-dev
This should work! (You might need to re-install Ruby after that.)

installing gem puma on windows error

My first step when trying to install the gem puma is to enter gem install puma --version 2.12.3 into my command prompt. Then this error appears. I don't know what to make of it.
C:\Users>gem install puma --version 2.12.3
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150809-8352-14jkju1.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/puma-2
.12.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/puma-2.12.3/gem_make.out
Once I receive this , I follow these instructions https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
And I receive this error:
C:\Users>gem install puma -- --with-opt- dir=c:\
openssl
ERROR: Loading command: install (LoadError)
127: The specified procedure could not be found. - C:/Ruby22-x64/lib/r
uby/2.2.0/x64-mingw32/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Side note: here is the mkmf.log
mkmf.log
Please Help! thanks!
I think I have found answer for your question. Here the link
You must download OpenSSL libraries. There are two types OpenSSL libraries, one for 32bit other for 64bit.
After you installed them run gem install puma -- --with-opt-dir=D:\openssl
--with-opt-dir=D:\openssl is folder direction where you have downloaded libs.
Some tutorials have links to openssl which is for 32bit computers. I realized this after several failures. Then I have downloaded 64 bit version.

Rails, heroku installing puma on different disk gives error

I created free account on heroku. Now I am trying this getting started. My DevKit Ruby and openssl are placed inside my D:\ disk, not C:\, beacuse there is reason why I can't use C:\ disk. All files directories are placed in my path.
I have tried to install puma gem by this method, only defference is that disk name is D:\.
When I run gem install puma -- --with-opt-dir=D:\openssl it throws me an long error:
D:\>gem install puma -- --with-opt-dir=D:\openssl
Building native extensions with: '--with-opt-dir=D:\openssl'
This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
D:/Ruby21-x64/bin/ruby.exe -r ./siteconf20150406-5096-1vz5x1.rb extconf.rb -
-with-opt-dir=D:\openssl
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=D:/Ruby21-x64/bin/ruby
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in D:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/puma-2
.11.1 for inspection.
Results logged to D:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0
/puma-2.11.1/gem_make.out
UPDATE
I have copied my libeay32.dll and ssleay32.dll inside of my D:\openssl\bin to D:\Ruby21-x64\bin. It said me that it already has these files, so I replaced them.
When I run gem install puma -- --with-opt-dir=D:\openssl it still throws me an error.
I have found solution.
Heroku site in this link gives OpenSSL ONLY FOR x86. If you have x64 you need to download it from there.
I hope in future Heroku will provide x64 ssl links in their tutorials.

"extconf.rb failed" message while installing Rails

Newbie here. I've searched for other similar questions on the site but still wasn't able to solve the problem. I've installed Ruby 2.0.0 and RubyGem 2.0.3, but when I'm trying to install Rails 4.0.0 I got:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10 for inspection.
Results logged to /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10/ext/gem_make.out
I tried to install Rails by
gem install rails --version 4.0.0
I'm not sure if there's something wrong with the set up or if I still need to install something. Thanks in advance for your help.
It seems you're using OSX.
This error happens when you can't compile some extensions, in this case due to the lack of a compiler ("You have to install development tools first"). Open App Store, download XCode and, after installing it, click on "XCode" on the menu, go to Preferences -> Downloads -> Components and download "Command Line Tools".

Resources