Can't install json (Ruby doesn't work) - json

windows 10. ruby 2.2.4. I've tried all the devkit stuff and whatever to fix this. I've looked stuff up for hours and hours with no success. When I try to bundle it doesn't install json. When I try to install json it says
"Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160303-4132-alefq2.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.3/gem_make.out"

I was facing the same problem. The Gemfile.lock in the repo I cloned had a json version older than the one I had already installed. I did not manage to uninstall the newer version, but I did replace the old version number in the Gemfile.lock with the new one and it seems to work now.

You should run the devkit installation scripts.
In particular, pay attention to devkitvars.bat.

Related

Installation using Jekyll fails on OS Mojave 10.14.5

I have an issue installing Jekyll, because ffi is not working:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.6.0 -r ./siteconf20190721-87601-s2b792.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_call_without_gvl()... yes
checking for ruby_native_thread_p()... yes
checking for ruby_thread_has_gvl_p()... yes
creating extconf.h
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1/ext/ffi_c
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1/ext/ffi_c
make "DESTDIR="
Configuring libffi
configure: error: in `/usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi-x86_64-darwin18':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
make: *** ["/usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.6.0/gems/ffi-1.11.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0/ffi-1.11.1/gem_make.out
It seems like ffi-1.11.1 is not working with jekyll. Has anyone been successful in installing jekyll? I'm using OS Mojave version 10.14.5.
Please check out this issue in the ffi repo and also this issue on Github which might be helpful, even if the error is slightly different this might be a trace to start for you.
Also, the solution and explanation provided in this issue looks very promising:
Finally I realised that I had a version of Xcode that was not updated because High Sierra is too older to support the lastest version (Thank you Apple...).
So I tried to enter the command gcc -v and I saw this line :
Apple LLVM version 8.0.0 (clang-800.0.38).
That was the problem ! Even If I installed the latest Xcode Command Line Developer Tools, the old gcc provided with Xcode was still used.
I entered the command xcode-select -s /Library/Developer/CommandLineTools/ and the command gcc -v displayed the new version :
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
High Sierra and Mojave might have the same issue with outdated xcode stuff here.

Installing gem json 2.2.0 failed - windows

I got an error trying to install gem json 2.2.0 to my project, so I look for many sites and tutorials but nothing help me with windows.
Please see the problem below:
Fetching json 2.2.0
Installing json 2.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
C:/Ruby24-x64/bin/ruby.exe -I C:/Ruby24-x64/lib/ruby/site_ruby/2.4.0 -r
./siteconf20190412-3460-119pn5l.rb extconf.rb
creating Makefile
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
make "DESTDIR=" clean
current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0/ext/json/ext/generator
make "DESTDIR="
make failedNo such file or directory - make "DESTDIR="
Gem files will remain installed in
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-2.2.0 for inspection.
Results logged to
C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/json-2.2.0/gem_make.out
An error occurred while installing json (2.2.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.2.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
calabash-android was resolved to 0.9.8, which depends on
luffa was resolved to 2.1.0, which depends on
json
For ubuntu the solution was: install libgmp3-dev.
For macOS the solution was: use XCode
But I found nothing for windows. Should be a solution to use RVM? If yes, how can I install it on Windows?
I really appreciate your help!

compiler cannot find libvideogfx

I am trying to install libde265 from source but one of its dependencies is giving me problems. I also installed this depedency from source but I converted it to an rpm package before completing installation.
When I look for the location of this library I get:
$ whereis libvideogfx
libvideogfx: /usr/local/lib/libvideogfx.la /usr/local/lib/libvideogfx.a /usr/local/lib/libvideogfx.so
The flags I have added to the ./configure command such as LIBS are not working and I don't know the root of the problem.

Why can't I install json -v '1.8.3' on Windows 10?

When trying to install this gem, I receive the following:
Temporarily enhancing path to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20161103-12844-13cqnmb.rb extconf.rb creating Makefile
make "DESTDIR=" clean
'make' is not recognized as an internal or external command, operable program, or batch file.
make "DESTDIR="
'make is not recognized as an internal or external command, operable program, or batch file.
make failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.3/gem_make.out
The gem_make.out file is not in that folder. This is the last gem I need to install. What do I need to do to resolve this?

Ruby mysql2 gem, cannot build on Windows 7

I come from OSX where Ruby runs super flawlessly 90% of the time. I haven't touched it in awhile though and happen to be working on a Windows 7 machine right now. I'm trying to run a simple Ruby on Rails project but I can't seem to get past any of my database setup.
I want to run on mysql but when I try to install the mysql2 gem (via bundle install or gem install mysql2) I get these errors:
Installing mysql2 (0.2.9) with native
extensions
C:/Ruby192/lib/ruby/site_ruby/1
.9.1/rubygems/installer.rb:533:in
`rescue in block in build_extensions':
ERROR: Failed to build gem native
extension.
(Gem::Installer::ExtensionBuildError)
C:/Ruby192/bin/ruby.exe extconf.rb checking for
rb_thread_blocking_region()... *
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.
I'm pretty much a complete newb when it comes to this kind of thing so if anyone has any advice, please help!
To install and compile extensions sometimes you need libraries and headers of the dependencies. In this case, you need MySQL headers and libraries to properly compile.
Assuming you downloaded Ruby from RubyInstaller and also installed the Development Kit and followed it's installation instructions, to successfuly install mysql2 gem I recommend you read this answer in our Troubleshooting page:
Download MySQL Connector/C
Extract into a path without spaces
When installing mysql2 gem, provide the additional options (gem install mysql2 -v 0.2.10 -- --with-mysql-include=... --with-mysql-lib...)
Provide for --with-mysql-include option the path to the include directory of MySQL Connector/C. The same for --with-mysql-lib but this time point to lib directory.
Don't forget to copy libmysql.dll to your Ruby bin directory.
Hope this helps.
The problem with native extensions on Windows is that there are two different compiler infrastructures: one based on MS VC and its Visual Studio and one based on MinGW (Minimalist GCC for Windows).
There are Ruby native extensions that can be compiled with any of them and other, that only support one. And since most of them come from some kind of Unix, chances are that mingw works better that MSVC.
So you may try to install mingw and use it to compile mysql gem - there is a special package called devkit, which contains a minimal necessary mingw installation which you just put inside your ruby installation.
I had a success compiling several native extensions using devkit: eventmachine, linecache, bson-ext to name a few. And within devkit you will feel much more are home :-) (coming from OSX)
If you have the devkit setup correct as #Tomasz mentions, please make sure you check the compatibility of mysql2 gem version with windows, I have experienced in the past for it to cause issues and had to go and install a previous version to get it working. Last I remember v0.2.6 was the version that supported windows.