I'm failing to install Rails.
Background: My (brand new) system = Ubuntu 18.04, Ruby 2.6.0, latest rvm and bundler installed and updated. The first thing I did after installing Ruby was to do sudo apt install ruby-railties and sudo apt install rails...I don't know why I didn't use gem install. After that, I never have successfully executed rails new but I did once partially execute it, but it failed and that's when I started down the rabbit hole.
When I type rails -v I get this:
Traceback (most recent call last):
4: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `<main>'
3: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `eval'
2: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/rails:23:in `<main>'
1: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
When I try to execute gem install rails, I get this:
Successfully installed concurrent-ruby-1.1.4
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
Successfully installed i18n-1.5.2
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.5
Successfully installed activesupport-5.2.2
Successfully installed rack-2.0.6
Successfully installed rack-test-1.1.0
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/globewalldesk/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1/ext/nokogiri
/usr/share/rvm/rubies/ruby-2.6.0/bin/ruby -I /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0 -r ./siteconf20190116-22693-tbjpnz.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
*** 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/share/rvm/rubies/ruby-2.6.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': mini_portile2 is not part of the bundle. Add it to your Gemfile. (Gem::LoadError)
from extconf.rb:469:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/globewalldesk/.rvm/gems/ruby-2.6.0/extensions/x86_64-linux/2.6.0/nokogiri-1.10.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/globewalldesk/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1 for inspection.
Results logged to /home/globewalldesk/.rvm/gems/ruby-2.6.0/extensions/x86_64-linux/2.6.0/nokogiri-1.10.1/gem_make.out
I've looked through installation instructions and many similar questions here and elsewhere, and tried a bunch of stuff, and nothing seems to work.
I get a similar error message when I try gem install nokogiri.
Help!
UPDATE: Here is the mkmf.log file:
"gcc -o conftest -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC conftest.c -L. -L/usr/share/rvm/rubies/ruby-2.6.0/lib -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.6.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.6.0/lib -L/usr/share/rvm/rubies/ruby-2.6.0/lib -lruby -lm -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
UPDATE 2: Taking Javier's advice, I looked at the docs for installing Nokogiri and found the command gem install nokogiri -- --use-system-libraries, which worked. Then I did the same for rails and railties.
Now I'm getting a different error message when I try to run rails new:
Traceback (most recent call last):
2: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/rails:23:in `<main>'
1: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
O
UPDATE 3:
I accepted Javier's answer. I've been working with a fresh install (attempt), so it doesn't matter if I just start completely fresh. I don't know what ultimately screwed up my system (maybe because I copied an old .bashrc file from a different system without first removing the rvm lines?), but completely uninstalling all Ruby, Rails, other gems, and rvm, and reinstalling should fix the problem.
UPDATE THE LAST:
It took quite a bit to completely uninstall Ruby, Rails, and especially RVM. I didn’t realize how important the Bash profile scripts are, or that the lines about RVM need to be thoroughly removed from them, or how important the state of certain environment variables set by RVM are. I think the main reason I was having trouble installing Rails was simply about I had copied RVM settings from my old bash profiles. I should have removed them.
Everything is working as expected now.
Here are the docs to install nokogiri https://nokogiri.org/tutorials/installing_nokogiri.html, there is a note for rvm:
Note for RVM users: you may require libgmp, consider running sudo
apt-get install libgmp-dev.
Remove ruby with rvm https://rvm.io/rubies/removing
rvm remove 2.6.0
Install
Ruby
rvm install 2.6.0
Rails
gem install rails
For a existing project
bundle install
Related
On Windows 10 64bit
Using Railsinstaller I installed the bundler necessary to build my App.
After the installation I checked the versions of:
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
$ rails -v
Rails 5.2.2
$ gem -v
2.5.2
$ bundler -v
Bundler version 2.0.1
$ sqlite3 --version
3.8.7.2 2014-11-18 20:57:56 2ab564bf9655b7c7b97ab85cafc8a48329b27f93
Then I started rails new my_app_name which ended with these errors:
mkmf.log
package configuration for sqlite3 is not found
find_header: checking for sqlite3.h... -------------------- no
"gcc -o conftest.exe -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0/i386-mingw32 -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0/ruby/backward -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat conftest.c -L. -LC:/RailsInstaller/Ruby2.3.3/lib -L. -lmsvcrt-ruby230 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */
"gcc -E -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0/i386-mingw32 -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0/ruby/backward -IC:/RailsInstaller/Ruby2.3.3/include/ruby-2.3.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat conftest.c -o conftest.i"
conftest.c:5:21: fatal error: sqlite3.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/* end */
--------------------
And gem_make.out
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190214-3564-1lpwzs0.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
I am total beginner with Ruby and this is my first attempt to create app so I can experiment. It seems to me that the problem is related with the Sqlite3 version. I tried to update it via gem and bundle but I got error again.
I have got the same issue and these are the two solutions I found.
1* After the bundle install fail to enter on the project folder and modify the Gemfile
gem 'sqlite3', '1.3.11'
this line change it by some of these 3 below
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby", branch: "add-gemspec"
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
It only works if you've installed first Ruby Devkit or RubyInstaller and later Rails Installer, otherwise Rails Installer Ruby folder will be choosed by system as "ruby folder"
2* you'll have to uninstall RailsInstaller and remove the remaining folder(if you don't remove manually the folder after uninstaller ends, when you execute gem command it'll says "RailsInstaller/Ruby2.3.3/bin" folder not found)
Ok, after it install rails by command line
gem install rails
And install by command line MinGW
C:\Sites>ridk exec pacman -S mingw-w64-x86_64-dlfcn
Download the gem file from https://rubygems.org/ and save it locally and install from file
gem install --local C:\sqlite3-1.4.0.gem
This second solution works globally so you've to run it only once and the next time you execute rails new blog the issue with sqlite won't appear again. Just make sure to execute it on the Sites folder not inside any project or it'll work only for that project.
If any of these works for you please feel free to try one of the methods I mention here https://mycodeissuesandfixes.blogspot.com/2019/02/ruby-on-rails-issue-about-sqlite-3-gem.html , I've tried to find a solution for more than a week to this.
Good Luck!! Hope it helps you
FROM ruby:2.5.1-slim or ruby-2.5.1-alpine throws the following error, how I do use a smaller footprint for ruby as it doesn't seem to be using any of the above options which I would prefer to use. This error happens while running the bundle install command
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/gems/nokogiri-1.8.4/ext/nokogiri
/usr/local/bin/ruby -r ./siteconf20180828-6-l5tj3e.rb extconf.rb
checking if the C compiler accepts ... *** 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/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/local/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to
generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /usr/local/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /usr/local/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/local/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:410:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/usr/local/bundle/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/bundle/gems/nokogiri-1.8.4 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/gem_make.out
An error occurred while installing nokogiri (1.8.4), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.4' --source 'http://rubygems.org/'`
succeeds before bundling.
In Gemfile:
rails was resolved to 5.2.1, which depends on
actioncable was resolved to 5.2.1, which depends on
actionpack was resolved to 5.2.1, which depends on
actionview was resolved to 5.2.1, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
The command '/bin/sh -c bundle install --without development test' returned a non-zero code: 5
First of all, try to run gem install nokogiri manually and check the log as suggested in the output above:
...
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/usr/local/bundle/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/mkmf.log
...
I recently had a problem while installing the nokogiri gem too. So I opened my mkmf.log file and found the reason of the problem there (the stdio.h library was missing out of the distribution):
"gcc -o conftest -I/usr/local/include/ruby-2.5.0/x86_64-linux-musl -I/usr/local/include/ruby-2.5.0/ruby/backward -I/usr/local/include/ruby-2.5.0 -I. -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wduplicated-cond -Wno-maybe-uninitialized -fPIC conftest.c -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby -lpthread -ldl -lcrypt -lm -lc "
In file included from /usr/local/include/ruby-2.5.0/ruby/ruby.h:29:0,
from /usr/local/include/ruby-2.5.0/ruby.h:33,
from conftest.c:1:
/usr/local/include/ruby-2.5.0/ruby/defines.h:112:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
The problem was solved by installing the libc-dev package for me.
So. To solve your problem you should iteratively run gem install nokogiri command, check mkmf.log file after each failure and fix missing dependencies until the package is installed.
BTW here's my final list of dependencies which was enough to install Rails in Alpine:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk add --update-cache postgresql-client nodejs \
libffi-dev readline sqlite build-base postgresql-dev \
libc-dev linux-headers libxml2-dev libxslt-dev readline-dev gcc libc-dev \
&& rm -rf /var/cache/apk/*
try this:
run sudo gem install nokogiri. It will install the latest version of nokogiri.
Then update the version of nokogiri in your Gemfile.lock file to the latest version of nokogiri you juste installed.
And finally run bundle install. Maybe it'll help. Worked for me.
I'm trying to set up a RoR environment under RVM on Mac OS X Yosemite 10.10.5 on my macbook pro.
The ruby version that I need to install is 1.9.3-p194 because it's required for my software development project.
So far, I have the following software installed on my Macbook:
RVM
ruby 1.9.3-p194
xcode v6.4 and the respective version of command line tools
Mac OS X version: 10.10.5 Yosemite
It seems I'm running into a problem that the ffi gem (an independency of my project) cannot be built successfully.
I get the following error whenever I try to install the gem via the command "gem install ffi -v '1.9.3'"
MacBook-Pro:demo-project apple$ gem install ffi -v '1.9.3'
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/Users/apple/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -r ./siteconf20160428-1898-idt325.rb extconf.rb
checking for ffi_call() in -lffi... *** 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
--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/apple/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
--with-ffilib
--without-ffilib
/Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
from extconf.rb:20:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/apple/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.9.3 for inspection.
Results logged to /Users/apple/.rvm/gems/ruby-1.9.3-p194/extensions/x86_64-darwin-14/1.9.1/ffi-1.9.3/gem_make.out
I said I have the xcode command line tools installed, but notice from the given error below that it gave me a hint "You have to install development tools first".
Didn't I have it installed already? I was asking myself out of curiousity.
Then I googled and found out the way how to check if I have xcode command line tools installed. Then I launched the terminal and issued that command as illustrated below, and the result did confirm that the piece of software was already installed.
MacBook-Pro:demo-project apple$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
Here is also my gcc version:
MacBook-Pro:demo-project apple$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
I have searched all over the web and tried many solutions, but, unfortunately, without success.
Any advice would be very much appreciated to get this to work.
Updated:
My mkmf.log
package configuration for libffi
cflags: -I/usr/local/Cellar/libffi/3.0.13/lib/libffi-3.0.13/include
ldflags: -L/usr/local/Cellar/libffi/3.0.13/lib
libs: -lffi
"/usr/local/bin/gcc-4.9 -o conftest -I/Users/apple/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin14.5.0 -I/Users/apple/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/Users/apple/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/usr/local/opt/libyaml/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -I/usr/local/Cellar/libffi/3.0.13/lib/libffi-3.0.13/include conftest.c -L. -L/Users/apple/.rvm/rubies/ruby-1.9.3-p194/lib -L/usr/local/opt/libyaml/lib -L. -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L/usr/local/Cellar/libffi/3.0.13/lib -lffi -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
I'm trying to install rails 2.0.0 on my computer. I already have already installed ruby on my computer, running the
ruby -v
command returns
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]
Now, I'm trying to install rails 2.0.0 by running
gem install rails
However, I am running into an error:
C:/Ruby200-x64/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:/Ruby200-x64/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:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:515:in `try_link0'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:813:in `try_run'
from extconf.rb:24:in `<main>'
4th line up says I need to install development tools, so I downloaded the dev kit from http://rubyinstaller.org/downloads/ for my 64 bit windows, and ran the following commands without issue:
ruby dk.rb init
ruby dk.rb install
However, I still got the same error after running gem rails install... .am I installing the wrong development tools or something? I'm not sure what's going wrong
Additionally I'm using pik to control my ruby version, if that information is relevant.
Note: I checked out another possible solution that said that my userfolder had spaces in it, causing the install to go wonky, but my user account doesn't have spaces in it, so that didn't help.
*edit: the mkmf file with more info:
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -march=native conftest.c -L. -LC:/Ruby200-x64/lib -L. -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */
And, yes, another question of a similar type but non of the postings have helped my situation. Been trying to solve this one for two days.
When I type 'rails new app' or run 'bundle install' in an existing app, I get:
Errno::EPERM: Operation not permitted - /Users/pb/.rvm/gems/ruby-1.9.2-p290/gems/json- 1.6.5/.gitignore
An error occured while installing json (1.6.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.5'` succeeds before bundling.
When I type any rails command in an existing project, I get:
Could not find json-1.6.5 in any of the sources
Run `bundle install` to install missing gems.
When I type sudo gem install json -v '1.6.5' I get:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/pb/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/Users/pb/.rvm/rubies/ruby-1.9.2-p290/include/ruby
-1.9.1/x86_64-darwin10.8.0 -I/Users/pb/.rvm/rubies/ruby
-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/pb/.rvm/rubies/ruby-1.9.2 p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SO
URCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -o parser.o -c parser.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [parser.o] Error 1
I've tried all the following:
Uninstall gem json (this tells me json is not installed)
sudo gem update rails
I've also installed the latest xCode - 4.2.1.
Any advice as to solve my problem would be greatly appreciated!
Soooo, I just had the same problem with a much later version... turned out it was because I was in BYOBU. Exiting byobu and just working from the raw terminal fixed it... don't ask me how.
One possible reason for this happen is that you are using rails 3.2 and the application is rails 3.1.
execute bundle install and try to run it again.