Unable to install therubyracer on clean install of Yosemite and clean version of ruby - osx-yosemite

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.

Related

Install puma on ubuntu (rubinius 2.1.1)

I am trying to install puma on ubuntu 12.04 with rubinius 2.1.1 and I am getting to following error:
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
/home/meir/.rvm/rubies/rbx-2.1.1/bin/rbx extconf.rb
creating Makefile
make "DESTDIR="
compiling io_buffer.c
compiling http11_parser.c
compiling puma_http11.c
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
/home/meir/.rvm/rubies/rbx-2.1.1/vm/include/capi/ruby/backward/rubyio.h:1:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
linking shared-object puma/puma_http11.so
make: clang: Command not found
make: *** [puma_http11.so] Error 127
I tried to re-install the rvm, rbx, and the following libraries: libcurl4-openssl-dev, openssl, libgnutls-openssl27.
But i get the same error.
ruby -v
rubinius 2.1.1 (2.1.0 be67ed17 2013-10-18 JI) [x86_64-linux-gnu]
thanks.
I found the solution, because the ubuntu installation was 64 bit, so the libssl-dev was 64 bit, and puma gem on rubinius can't work with 64 bit openssl native extensions, so, I created another virtual machine with ubuntu 32 bit and everything works just fine.
Thanks anyway...

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

json gem won't install on Windows

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.

Anyone having issues installing bson_ext gem in OSX lion

OSX Lion, Xcode 4.2, GCC 4.2
I get the following error installing bson_ext 1.4.1
Building native extensions. This could take a while...
ERROR: Error installing bson_ext:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for asprintf()... *** 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 just ran into this. You should look in the mkmf.log file. Chances are, it's looking for GCC in the wrong place. I had to:
cd /usr/bin
sudo ln -s i686-apple-darwin11-llvm-gcc-4.2 i686-apple-darwin11-gcc-4.2.1
And all was well.
The accepted answer did not work for me. But this did.
I am using:
OS X 10.8.2
Xcode 4.6 (with command line tools)
bson_ext 1.8.2
cd /usr/bin && sudo ln -s ./gcc gcc-4.2
$ gem install bson_ext -v 1.8.2
Building native extensions. This could take a while...
Successfully installed bson_ext-1.8.2
1 gem installed
Installing ri documentation for bson_ext-1.8.2...
Installing RDoc documentation for bson_ext-1.8.2...
So re-installing OSX lion fixed the problem. I guess uninstalling xcode 4.1 in the first place messed up my developer tools installation.
Thanks for the help.
I don't use XCode for anything but the developer tool binaries so I just uninstalled XCode:
sudo /Developer/Library/uninstall-devtools –mode=all
And then installed this:
https://github.com/kennethreitz/osx-gcc-installer
Fixed the problem right up and I saved some HD space to boot.