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.
Related
I'm trying to set up and run the Extreme Startup coding dojo on my Windows machine.
When I reach the bundle install step, I get this error message:
$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Installing builder 3.2.2
Installing nokogiri 1.4.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150826-3512-ilnke5.rb 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)
extconf failed, exit code 1
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.4.5 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/nokogiri-1.4.5/gem_make.out
An error occurred while installing nokogiri (1.4.5), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.4.5'` succeeds before bundling.
According to the documentation for Nokogiri, it just ought to work, and in a sense, it does, because if I issue the command gem install nokogiri, it does work, but installs nokogiri-1.6.6.2-x64-mingw32.
As I understand the error message from bundle install, it specifically wants version 1.4.5. At least, even with nokogiri-1.6.6.2-x64-mingw32 installed, bundle install still fails with the above error message.
This is likely to be a simple problem, but since I'm a novice ruby user, I could use some help.
I've already tried the suggestions from Error installing Nokogiri on bundle install but already installed, but none of them work.
This particular version of Nokogiri is listed in Gemfile.lock. You can remove that file, run bundle install again and see if it works.
This is more a workaround than a proper solution, but dependencies in Gemfile.lock are quite old so it would be a good thing to refresh them anyway.
We're using activerecord-sqlserver-adapter adapter for Rails 4 to talk to a SQL Server DB. This adapter requires the tiny_tds gem. In order to install tiny_tds, you need freetds installed on your system because it's used during the compiling for the gem.
On my system I have installed RVM and homebrew. I have brew install freetds and confirmed that it works by tsql -C and have actually connected to the SQL Server. From my understanding, that means freetds is "installed" on my machine and works.
However, everytime I do a gem install tiny_tds if complains about freetds is missing
I have tried several of the parameter options to "link" to the proper files, but nothing seems to work for me. I've already spent several hours googling and looking over the gem author's writings. Some other developers I'm working with have this functioning, but I'm setting up a new environment and for some reason can't get it working. They've already looked into it as well and are not sure what the issue is.
It seems that the installation of the tiny_tds gem just doesn't know that freetds is actually installed on the system.
On a sidenote, I've also looked at mini_portile and it didn't work properly either...since I've already spent several hours down the current path, I want to figure this out before I switch over to investigating mini_portile.
Here's the output of the install:
$ gem install tiny_tds
Building native extensions. This could take a while...
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... no
-----
freetds is missing.
-----
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--enable-lookup
--disable-lookup
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/
--with-iconvlib
--without-iconvlib
--with-sybdblib
--without-sybdblib
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/tiny_tds-0.6.2/ext/tiny_tds/gem_make.out
Finally resolved this. Forgot to install Ruby via RVM after I installed RVM, and this was causing all the issues.
If you get weird errors similar to the above, do a rvm list to see if you even have any Rubies installed, and then do a which ruby on your terminal (Mac) to see if you are indeed using the RVM Ruby.
You can pass the location of the freetds lib to the gem command like this:
gem install tiny_tds -- --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.2.21
I finally got libv8 installed on my windows with
gem install libv8 -- --with-system-v8
now when I am trying to install therubyracer I get
gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb --with-system-v8
checking for main() in -lpthread... no
checking for v8.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=C:/Ruby193/bin/ruby
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--without-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/
C:/Ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.16.14.3/ext/libv8/location.rb:50:in `configure': You hav
e chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.3 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
What I want to know is what this error message really means?
Also I looked this up https://github.com/cowboyd/libv8#bring-your-own-v8
How do I install headers for v8?
When I faced this problem I found that I didn't need those gems in development, because rails use to precompile your assets, so my solution was pretty simple,
Gemfile
gem "rails"
group :production do
gem 'therubyracer'
end
Then when you bundle run this command
$ bundle install --without production
Then smile to the life :D
On Mac you can try updating the v8 library with homebrew:
gem uninstall libv8
brew install v8
gem install therubyracer
Update: Sorry, didn't realize this was a Windows only question.
#Aalap
I ran into the same problem while setting up my Ruby on Rails web application on Windows 7 64-bit. I came across this solution. This is a bit old but solved the problem. This solution provides 'therubyracer' gem file and v8.dll libs to install. The instructions are pretty much clear on the link above.
I installed 'libv8' gem just like Periback's answer on SO and when I tried to install 'therubyracer' gem, it failed with same error as yours. Now my web application is running fine and my "gem list" command shows:
libv8 (3.11.8.13)
therubyracer (0.11.0beta1 x86-mingw32)
Hope this helps.
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
I'm running an instance built off ami-595a0a1c which is Amazon's customized Linux. I am trying to install the sqlite3 (or sqlite) gem and it's failing with the below error:
$ sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path
(the
location where your sqlite3 shared library is located).
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/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
Typically, this just means you need to install the development libraries and everything is cool. However, I have installed the sqlite-devel packages and still no dice. Since this is the Amazon Linux instance, I'd rather not add more repositories than the ones Amazon provides if possible. What can i do to get this thing to compile? Thanks for any insight!
From a brand new instance, here's what I've done:
$ sudo yum install rubygems ruby-devel
$ sudo gem update --system
$ sudo gem install rails
$ rails new app
$ cd app
$ rails server
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
$ sudo yum install sqlite-devel
$ sudo gem install sqlite (or sqlite3 -- same result)
See breakage above. And note - I do realize I can comment out the line in the gemfile to get rails to run but I actually need the gem. Thanks in advance!
Ran into this as well. Surprisingly the stock amazon linux doesn't have make or gcc installed.
sudo yum install gcc
sudo yum install make
$ sudo yum install libsqlite3-dev
Note the version 3.
Or if the package is available in your OS install libsqlite3-ruby