Can't install therubyracer in JRuby - ruby

I've installed RVM and then Jruby, this the version that i get when i type: jruby -v:
jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) Client VM 1.7.0_02) [linux-i386-java]
The problem is that I can't install therubyracer gem, i get this when i try to install by jruby -S gem install therubyracer:
/usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very we$
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
Checking for Python...Unable to build libv8: Python 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=/usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby
I also tried with --1.9 parameter, to force to use another ruby version, but it fails anyway. Even I tried to install libv8, but i get the same error above.
Any ideas?
I have CentOS 5.7

You want the Ruby Rhino.

Just to clarify, in your Gemfile it's:
gem 'therubyrhino'
followed on the command line with:
jruby -S bundle install

I've had the same problem, but defining therubyrhino in the Gemfile didn't solve my problem, bundler kept trying to install libv8.
That happened because I defined twitter-bootstrap-rails gem in the Gemfile, and it depends on the less gem (that depends on therubyracer), so I changed the less gem to use the static branch that not depends on less (as suggested on the issue https://github.com/seyhunak/twitter-bootstrap-rails/issues/22):
gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"

Related

Can't handle 1.9.x error when trying to install linecache with Ruby 2.1.1

I am trying to install linecache with RVM on Ruby 2.1.1.
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
I run bundle install
$ bundle install
It blows saying it isn't compatible with 1.9.x when I run bundle install:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/g/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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/g/.rvm/rubies/ruby-2.1.2/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/g/.rvm/gems/ruby-2.1.2/gems/linecache-0.46
for inspection.
Results logged to /home/g/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0
/linecache-0.46/gem_make.out
An error occurred while installing linecache (0.46), and Bundler cannot continue.
Make sure that `gem install linecache -v '0.46'` succeeds before bundling.
Any ideas whats happening here?
Linecache hasn't been updated in 3 years, the last update was bringing it up to version 1.9.3. Unless you're pulling it from someone else's fork, since you're using 2.1.1 the gem won't work. Most likely the error message hasn't been updated so it just tells you it's invalid for 1.9.x since it doesn't know about any newer versions.

intalling linecache-0.46 gem(I am using rbenv)

While bundle install the error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/launchpad/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
Can't handle 1.9.x yet
* 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/launchpad/.rbenv/versions/1.9.3-p448/bin/ruby
Gem files will remain installed in /home/launchpad/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/linecache-0.46 for inspection.
Results logged to /home/launchpad/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/linecache-0.46/ext/gem_make.out
An error occurred while installing linecache (0.46), and Bundler cannot continue.
Make sure that gem install linecache -v '0.46' succeeds before bundling.
You are seeing the error "Can't handle 1.9.x yet" because the linecache gem is not compatible with Ruby 1.9.x. It looks like you are using Ruby 1.9.3-p44.
There is another gem called linecache19 that you can try that is compatible with 1.9.x.
Alternatively, you can:
Use an older version of Ruby via rbenv
Eliminate whatever gem you are trying to use that requires this gem (e.g. ruby-debug)
For more information, look at this question

Cant install rails 4.0 using rubyinstaller. *** extconf.rb failed ***

I am trying to install ruby on rails (v4.0) using ruby installer. It is throwing me this error. I am brand new to RoR and some websites told me to install devkit. I have done that. I ran gem install thin
C:\Users\shashid\Downloads>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/RubyRails/bin/ruby.exe 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
--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:/RubyRails/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}/
C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to gene
rate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-
1.1.10 for inspection.
Results logged to C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-1.1.10/ext/gem_ma
ke.out
Thank you in advance for your help
You need to install Ruby DevKit if on windows, get it from: http://rubyinstaller.org/downloads/ (scroll down a little).
Same story here deleting ruby and installing:
Ruby 2.0.0-p247
DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
from http://rubyinstaller.org/downloads/ solved the problem.
Try to use railsinstaller from http://railsinstaller.org/
it will install follwing
Ruby 1.9.3-p392
Rails 4
Bundler
Git
Sqlite
TinyTDS
SQL Server Support
DevKit
The same can happen when you try to combine 32-bit Ruby and 64-bit DevKit.
The solution is to use same-bit versions.
For instance current versions:
rubyinstaller-2.0.0-p247-x64.exe
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

bundle install doesn't work on with RVM

I have a problem installing my bundle.
These were my last steps:
git clone http:...
git checkout -b daniel
bundle install
The error I got was:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that `gem install therubyracer -v '0.11.0'`
succeeds before bundling.
When I tried to run gem install therubyracer -v '0.11.0' I got:
Building native extensions. This could take a while... ERROR: Error
installing therubyracer: ERROR: Failed to build gem native extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
I am working on Mac OS 10.7.5. Xcode and its command line tools and Rails are up to date.
SQLite 3 is also installed.
Can anyone help me?
EDIT:
I also tried to delete the repository and to clone it again, with the same errors.
EDIT:
Is the installation path of Rails and Sqlite3 correct?
daniel:~
daniel$ sudo gem update --system Latest version currently
installed. Aborting.
daniel:~
daniel$ sudo gem install rails
Fetching:
rails-3.2.11.gem (100%) Successfully installed
rails-3.2.11 1 gem installed
Installing ri documentation for rails-3.2.11...
Installing RDoc documentation for rails-3.2.11...
daniel:~
daniel$ sudo gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.7 1 gem installed
Installing ri documentation for sqlite3-1.3.7...
Installing RDoc documentation for sqlite3-1.3.7...
daniel:~
daniel$ which ruby irb gem rake
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/irb
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/gem
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/bin/rake
At least one problem is that you are running RVM, but used sudo to install gems on your system.
Read "RVM and RubyGems", especially the part that says:
"DO NOT use sudo..."
RVM creates a sandbox for you, the user, in your own user-space on a machine, that allows you to manage it without needing to be the system administrator. In other words, that means you don't have to use sudo for any RVM or gems management.
If you do use sudo, you temporarily cease being you, the user, and become the administrator, with administrator privileges and the administrator's environment, which does NOT include the RVM sandbox in your /Users/daniel/.rvm/rubies/ruby-1.9.3-p286 path. Knowledge of the sandbox is carried by the PATH in your environment, which the root on your machine doesn't use. Gems installed inside that sudo sub-shell get installed into the location that the administrator account knows about, which is inside the System Ruby installation, which is why your RVM sandboxed Ruby doesn't see them: There is no crossover between the System's Ruby and your RVM-controlled RUby. That's the whole idea of a sandbox: separation of the elements and resources to avoid contamination.
You could have figured this all out by looking at the output of:
which ruby irb gem rake
The path for all of them is pointing to your sandbox:
/Users/daniel/.rvm/rubies
On a Mac OS system, that command should have reported:
/usr/bin/ruby
/usr/bin/irb
/usr/bin/gem
/usr/bin/rake
Reinstall Rails and the SQLite gem using:
gem install rails sqlite3
and see how your bundle behaves.
And, by the way, do NOT use sudo to deliberately try to manage/delete the System installed Ruby. That was installed by Apple for their own purposes, to enable software they installed. It's OK to take advantage of its existence, but it's there for their use. Use a RVM-managed Ruby for your own purposes.

How can install sqlite-ruby on linux when sqlite3 is not in /usr/local?

I am trying to install sqlite3 and sqlite-ruby (ruby 1.8.6) on a linux box where I do not have root.
I downloaded the sqlite3 source, binaries, and shared library and placed them all in a directory called sqlite3
I then try to install sqlite-ruby using
gem install sqlite-ruby --with-sqlite-dir=the_path_sqlite/sqlite3
but I keep getting the error...
checking for main() in -lsqlite... no
checking for sqlite.h... 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=/data/scratch/bettbra/common/packages/ruby-1.8.6/bin/ruby
--with-sqlite-dir
--with-sqlite-include
--without-sqlite-include=${sqlite-dir}/include
--with-sqlite-lib
--without-sqlite-lib=${sqlite-dir}/lib
--with-sqlitelib
--without-sqlitelib
You specify where the development files (headers & lib) are using the following syntax:
gem install sqlite3 -- --with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib
Notice the -- that mark the end of gem options. After them, the options are passed to the extension compiling process.
However, I second Reuben's advice; you should really consider using RVM. It is a blessing for this kind of situations AND to smooth your migration to Ruby 1.9.
i'm using ubuntu (debain type linux). i managed to resolve it the following way:
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
Can you install RVM (Ruby Version Manager) ?
https://rvm.io/rvm/install/
With RVM you install gems etc. as a user without sudo/root privileges.

Resources