json gem won't install on Windows - ruby-on-rails-3

Here is the error I keep getting. I installed DevKit and followed all the instructions.
gem install json -v '1.6.3'
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:/Program Files/Ruby/Ruby192/bin/ruby.exe" extconf.rb
creating Makefile
make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
C:/Program Files/Ruby/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_parser'" > par
ser-i386-mingw32.def
/bin/sh: C:/Program: No such file or directory
make: *** [parser-i386-mingw32.def] Error 127
Gem files will remain installed in C:/Program Files/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.3 for inspection.
Results logged to C:/Program Files/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
Does anyone have a solution to this?

Just ran into this as well. Via Installing dm-types on Windows. (Win7 x64): this fixed it:
It looks the the spaces in the path for ruby are screwing up the makefile. Maybe try creating a symlink on Windows temporarily, like:
mklink /d c:\ruby "C:\Program Files (x86)\Ruby\Ruby193"
and then try installing with c:\ruby\bin\ruby.exe. You can delete the symlink after installing.

Related

How to compile a project that uses protobuf in Xcode?

I want to compile a project that uses protobuf.
xcode version: 9.3.1 macOS version: 10.13.6
Compile error:
'google/protobuf/stubs/common.h' file not found
I read in some sites that I have to install protobuf
$ brew install protobuf
// installed version: protobuf 3.6.1.3
There is a directory in the project, called makefile containing these files:
Makefile_ios compile_ios_protobuf_ssd.sh
build_all_ios_ssd.sh compile_ios_tensorflow_s.sh
build_tflib_ssd.sh compile_nsync_ssd.sh
when I run these scripts they have error. like
$ ./compile_ios_protobuf_ssd.sh
// ./compile_ios_protobuf_ssd.sh: line 25: ./build_helper.subr: No such file or directory
./build_all_ios_ssd.sh
make: tensorflow/contrib/makefile/Makefile_ios: No such file or directory
make: *** No rule to make target `tensorflow/contrib/makefile/Makefile_ios'. Stop.
Do I have to install something, or this project has problem?

cannot install rmagick with Windows 10 / Ruby 2.x / rails 3.x

I am trying to install Rmagick on a Win 10 machine for developing in the Ruby 2/rails 3 environment.
I've tried following various suggestions from different posts but have not had a success.
My current configuration is
Windows 10 64 bit laptop.
Installed ImageMagick-6.9.8-9-Q8-x86-dll.exe in C:\Program Files (x86)\ImageMagick-6.9.8-Q8
Environment variable CLASSPATH C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib C:\Program Files (x86)\ImageMagick-6.9.8-Q8\include
Env Variable CPATH C:\Program Files (x86)\ImageMagick-6.9.8-Q8
Env Variable LIBRARY_PATH C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib
NOTE - the above env variables are NOT in the system variables section they are in the user variables.
Command run in the rails project folder root: gem install rmagick -v '2.16.0' --platform=ruby -- --with-opt-lib=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib --with-opt-include=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\include
Response/error:
C:\Users\cmendella\Documents\Projects\intranet>gem install rmagick -v '2.16.0' --platform=ruby -- --with-opt-lib=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib --with-opt-include=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\include
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-lib=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib --with-opt-include=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\include'
This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/ext/RMagick
C:/RailsInstaller/Ruby2.3.0/bin/ruby.exe -r ./siteconf20170606-10484-1nvf2n8.rb extconf.rb --with-opt-lib=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\lib --with-opt-include=C:\Program Files (x86)\ImageMagick-6.9.8-Q8\include
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby2.3.0/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENOENT)
from extconf.rb:141:in `configure_compile_options'
from extconf.rb:16:in `initialize'
from extconf.rb:548:in `new'
from extconf.rb:548:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/rmagick-2.16.0/gem_make.out

Unable to install therubyracer on clean install of Yosemite and clean version of ruby

There are many people with similar issues and I've been one of them in the past on other machines and none of the solutions out there appear to work -- I also appear to have different error than others who have similar problems:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -r ./siteconf20150412-25981-y7cvt6.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
In file included from ./rr.h:6:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__bit_reference:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:628:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:604:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found
#include <__debug>
^
1 error generated.
make: *** [accessor.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/ecnalyr/.rvm/gems/ruby-2.0.0-p353#canopy/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/ecnalyr/.rvm/gems/ruby-2.0.0-p353#canopy/extensions/x86_64-darwin-14/2.0.0/therubyracer-0.12.2/gem_make.out
When running:
gem install therubyracer -v '0.12.2'
or simply
bundle install
with therubyracer included in my gemfile.
I'm running Yosemite 10.10.3, Ruby 2.0.0-p353, I have uninstalled everything and tried the gem install libv8 -- --with-system-v8 solution that comes up frequently with these kind of problems, but have found no resolution.
Creating a temporary file '__debug' solved this issue for me.
Run this command in terminal:
echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null
I was able to solve this by re-installing Command Line Tools for XCode 6.2 (instead of those for XCode 6.3).
There's more discussion in Stack Overflow 29529455.

Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0

The command rails server throws this error.
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load
such file -- mysql2/2.0/mysql2 (LoadError)
I use Ruby 2.0.0 from RubyInstaller on Windows XP box.
I figured out what is the problem but I don't know how to solve it. The problem is that there is no any 2.0/ directory in the mysql2-0.3.11-x86-mingw32 gem. This is the gem that rails installs as its dependency from Gemfile:
GEM
remote: https://rubygems.org/
specs:
... many gems here
mysql2 (0.3.11-x86-mingw32)
... many gems here
DEPENDENCIES
...
mysql2
...
This is what is in that mysql2.rb file:
# C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\mysql2.rb
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2" # <<-- this is that #2 line that throws an error
It is obvious that it takes the current Ruby version number and uses it as the path segment to reach some mysql2 file. In fact it is mysql2.so file. As I use Ruby 2.0.0 the path segment is 2.0:
mysql2/2.0/mysql2
Ok, now lets see how that directory of mysql2-0.3.11-x86-mingw32 gem looks like:
dir: C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\
No any 2.0/ directory.
I know the issue about libmysql.dll. I have it in my C:\Ruby200\bin. It doesn't help.
I read this answer https://stackoverflow.com/a/5368767/1114926 from the creator of RubyInstaller. I tried but it didn't help. It works for Ruby 1.9.3 because there is 1.9/ directory. But it doesn't work for Ruby 2.0.0.
How to solve it?
UPD 1:
Thank you for your answer. I've tried. Unfortunately I have ERROR: Failed to build gem native extension. error:
C:\>gem install mysql2 --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby200/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.
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:/Ruby200/bin/ruby
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (Runtim
eError)
You have to install development tools first.
... other code follows here...
It says:
You have to install development tools first.
But I have full DevKit installed, RubyInstaller installs it. Can't understand what else does it need.
I've already posted an issue to mysql2 GitHub page https://github.com/brianmario/mysql2/issues/364. No answers yet.
Had the absolutely same issue on Windows 7 x64 with Ruby 2.0.0 and DevKit 4.7.
The following steps helped me.
gem uninstall mysql2
Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip
Extract it to C:\connector-6.0.2
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\connector-6.0.2"'
Or even shorter:
gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"
uninstall mysql2-0.3.11-x86-mingw32, gems compiled before Ruby200 won't work. You have to compile it yourself.
If you run gem uninstall mysql2 and there is a non compiled version listed then just uninstall mysql2-0.3.11-x86-mingw32 - the compiled version else...
Installation
gem install mysql2 --platform=ruby. that would work.
Follow this guide on installing devkit http://rubyonwindowsguides.github.com/book/ch02-04.html.
Then try again.
Exactly the same behavior when I try to install Redmine on windows XP
when I try to do the "rake generate_secret_token", I got "cannot load
such file -- mysql2/2.0/mysql2 (LoadError)"
and when I try to re build mysql2 using --platform=ruby, I got the
same message as you green.
for the moment, I am stucked there ... but if anybody has anything to allow me to move forward, it will be very welcome.
I will keep informed as well
antoine
I almost done the same what #odiszapc described. Uninstall old gem, download mysql-connector-c-noinstall, unzip, but finally I used this command to build native gem:
gem install mysql2 --platform=ruby -- --with-opt-dir=/c/connector-6.0.2
(If you use git-bash then you can use unix style directory syntax.)
Copy paste from that link: https://github.com/brianmario/mysql2/issues/359. It worked for me.
If after installing the gem, you get an error:
"The specified module could not be found.
C:/Devel/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/lib/mysql2/mysql2.so"
That can be fixed by copying libmysql.dll to Ruby's bin folder.

Identify error Paperclip and Imagemagick

I recently upgraded to osx 10.8 (Mtn Lion) and now I am having problems with Imagemagick. I get the following error when I try to upload a file:
Command :: identify -format %wx%h '/var/folders/nd/1cw0mqzj0nb3jv8psz_ht9cr0000gn/T/2011Spring20120803-530-2nr1jn.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /var/folders/nd/1cw0mqzj0nb3jv8psz_ht9cr0000gn/T/2011Spring20120803-530-2nr1jn.jpg is not recognized by the 'identify' command.>
Command :: identify -format %wx%h '/var/folders/nd/1cw0mqzj0nb3jv8psz_ht9cr0000gn/T/2011Spring20120803-530-2nr1jn.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /var/folders/nd/1cw0mqzj0nb3jv8psz_ht9cr0000gn/T/2011Spring20120803-530-2nr1jn.jpg is not recognized by the 'identify' command.>
I uninstalled / reinstalled homebrew and imagemagick. I even added the rmagick gem (which I didn't need before) but still get the above error.
brew install imagemagick
Error: imagemagick-6.7.7-6 already installed
Here is brew doctor output:
brew doctor
Warning: Setting DYLD_LIBRARY_PATH can break dynamic linking.
You should probably unset it.
Warning: You have uncommitted modifications to Homebrew's core.
Unless you know what you are doing, you should run:
cd /usr/local && git reset --hard
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
xml2-config
xmlcatalog
xmllint
xslt-config
xsltproc
Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.
I even added the following to my config/environments/development.rb file
Paperclip.options[:command_path] = "/usr/local/bin"
I uninstalled Imagemagick again and reinstalled it. Now I get the following link errors.
==> Installing imagemagick dependency: jpeg
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
==> Downloading http://www.ijg.org/files/jpegsrc.v8d.tar.gz
Already downloaded: /Library/Caches/Homebrew/jpeg-8d.tar.gz
==> ./configure --prefix=/usr/local/Cellar/jpeg/8d
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link jpeg'
==> Summary
/usr/local/Cellar/jpeg/8d: 18 files, 1.3M, built in 16 seconds
==> Installing imagemagick dependency: libtiff
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
==> Downloading http://download.osgeo.org/libtiff/tiff-4.0.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/libtiff-4.0.2.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libtiff/4.0.2
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link libtiff'
==> Summary
/usr/local/Cellar/libtiff/4.0.2: 241 files, 3.6M, built in 24 seconds
Error: You must `brew link jpeg' before little-cms can be installed
When I type brew link jpeg
Error: No such file or directory - /usr/local/Cellar/jpeg/8c
When I type brew link libtiff
Error: No such file or directory - /usr/local/Cellar/libtiff/3.9.5
So in summary the links are looking for older versions of jpeg (8c instead of 8d) and libtiff (3.9.5 instead of 4.0.2)
Any ideas on how to fix this?
I was able to finally fix it with 2 commands. Simple symbolic link, seems pretty hackish...
jpeg fix
cd /usr/local/Cellar/jpeg
ln -s 8d 8c
libtiff fix
/usr/local/Cellar/libtiff
ln -s 4.0.2 3.9.5