I am on osx 10.6.7 trying to run bundle install on a new rails 3.0.7 app and it keeps failing when trying to build the pg gem. It keeps telling me that I have need the developer tools. But as far as I can tell I have the developer tools installed.
Here is the output of xcodebuild -version
Xcode 3.2.6
Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518
Here is the output of the failed pg gem build
/Users/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config
Using config values from /Library/PostgreSQL/8.4/bin/pg_config
checking for libpq-fe.h... *** 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/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
/Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
from extconf.rb:31:in `<main>'
Gem files will remain installed in /Users/bm/.rvm/gems/ruby-1.9.2-head#rc_search/gems/pg-0.11.0 for inspection.
Results logged to /Users/bm/.rvm/gems/ruby-1.9.2-head#rc_search/gems/pg-0.11.0/ext/gem_make.out
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `block in run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/bin/bundle:13:in `<top (required)>'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/bin/bundle:19:in `load'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/bin/bundle:19:in `<main>'
Any help would be immensely appreciated. FYI I also tried building the app with a mysql and essentially got the same stack. So I'm pretty sure I'm missing some sort of developer build tools, but I just don't know which ones. :(
I had the exact same problem when running bundle install in a Rails app. I installed homebrew and then ran
brew install postgresql.
That finally installed postgres correctly and the issue was fixed for me.
export ARCHFLAGS='-arch x86_64'
export PATH=/Library/PostgreSQL/9.1/bin:${PATH}
gem install pg
If you are using the PostgreSQL app on osx, you may need to change path the following (as the location of the binaries and config files changes) instead of the path shown in lesyk's answer:
export PATH=/Applications/Postgres.app/Contents/MacOS/bin:${PATH}
What worked for me was Zag Zag's comment:
~/projects/foo$ env ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.11.0
1 gem installed
Building YARD (yri) index for pg-0.11.0...
~/projects/foo$ bundle
...
Using pg (0.11.0)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I had the same issue. For me the fix was:
sudo ln -s gcc /usr/bin/gcc-4.2
I also ran into this issue, for me the answer was updating RVM of all things.
rvm get head
rvm install 1.9.2
I'm on the same OSX and XCode version as you are: bundle install with pg 0.11.0 works fine to me.
However, I found this article that might be able to help you
fixing-the-you-have-to-install-development-tools-first-error-with-nokogiri
If you're using rvm, you can try:
rvm update head
rvm --force install
1.9.2 gem install bundle
Here my stack:
[ 08:36:26 ] > bundle install
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system:
Using rake (0.8.7)
Using abstract (1.0.0)
Installing activesupport (3.0.7)
Installing builder (2.1.2)
Installing i18n (0.5.0)
Installing activemodel (3.0.7)
Using erubis (2.6.6)
Using rack (1.2.2)
Installing rack-mount (0.6.14)
Installing rack-test (0.5.7)
Installing tzinfo (0.3.27)
Installing actionpack (3.0.7)
Using mime-types (1.16)
Installing polyglot (0.3.1)
Installing treetop (1.4.9)
Installing mail (2.2.19)
Installing actionmailer (3.0.7)
Installing arel (2.0.9)
Installing activerecord (3.0.7)
Installing activeresource (3.0.7)
Using bundler (1.0.10)
Installing pg (0.11.0) with native extensions
Using thor (0.14.6)
Installing railties (3.0.7)
Installing rails (3.0.7)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
[ ronda#MacBook ~/Projects/rails_projects/first_app ]
[ 08:42:57 ] > rails server
=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-04-27 20:45:27] INFO WEBrick 1.3.1
[2011-04-27 20:45:27] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10]
[2011-04-27 20:45:27] INFO WEBrick::HTTPServer#start: pid=4757 port=3000
The simple solution:
run brew install postgresql
install the gem with sudo permissions: like so:
sudo gem install pg -v '0.17.1'
I was stuck on my bundle install for 3 days. Tried Everything like adding env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
I was able to see pg gem getting installed after this command but still it was not installing from bundle install, which was a pain because I dint know what to write in Gemfile except gem 'pg'
The thing which finally worked for me was to find that my pg_config was in /Library/PostgreSQL/9.3/bin/pg_config and by default the Gemfile bundle install looks in /usr/local/bin/pg_config
I just ran the following command and magic happened. bundle config build.pg --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
Some correction. For those who have installed postgres using homebrew.
1) write the following line in your ~/.bash_profile
export ARCHFLAGS="-arch x86_64"
2) restart console
3) execute following command
bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config (this has to be your pg config address, can differ for each depending on versions of postgres)
4) Install pg once locally by running this command
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
5) bundle install
Related
I'm following this tutorial on ruby on rails(https://www.youtube.com/watch?v=fmyvWz5TUWg), and at 22:16 he creates a new project with "rails new friends". When I tried to do that, some files are created then the following errors occur below:
Fetching puma 5.6.2
Installing bindex 0.8.1 with native extensions
Installing sqlite3 1.4.2 with native extensions
Installing msgpack 1.4.5 with native extensions
Installing puma 5.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bindex-0.8.1/ext/skiptrace
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 -r
./siteconf20220311-6336-mx8y4n.rb extconf.rb
creating Makefile
current directory:
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bindex-0.8.1/ext/skiptrace
make DESTDIR\= clean
bash.exe: warning: could not find /tmp, please create!
current directory:
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bindex-0.8.1/ext/skiptrace
make DESTDIR\=
generating cruby-x64-mingw-ucrt.def
bash.exe: warning: could not find /tmp, please create!
compiling cruby.c
make: gcc: No such file or directory
make: *** [Makefile:246: cruby.o] エラー 127
make failed, exit code 2
Gem files will remain installed in
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bindex-0.8.1 for inspection.
Results logged to
C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/bindex-0.8.1/gem_make.out
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:44:in `block in make'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in `each'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:36:in `make'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in `block in
build'
C:/Ruby31-x64/lib/ruby/3.1.0/tempfile.rb:317:in `open'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in
build_extensions'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/installer.rb:853:in `build_extensions'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/rubygems_gem_installer.rb:28:in `install'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/source/rubygems.rb:204:in `install'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:54:in
`install'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:186:in
`do_install'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/worker.rb:62:in `apply_func'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/worker.rb:57:in `block in process_queue'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/worker.rb:54:in `loop'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/worker.rb:54:in `process_queue'
C:/Ruby31-x64/lib/ruby/3.1.0/bundler/worker.rb:91:in `block (2 levels) in
create_threads'
An error occurred while installing bindex (0.8.1), and Bundler cannot continue.
In Gemfile:
web-console was resolved to 4.2.0, which depends on
bindex
run bundle binstubs bundler
Could not find gem 'sqlite3 (~> 1.4)' in locally installed gems.
rails importmap:install
Could not find gem 'sqlite3 (~> 1.4)' in locally installed gems.
Run `bundle install` to install missing gems.
rails turbo:install stimulus:install
Could not find gem 'sqlite3 (~> 1.4)' in locally installed gems.
Run `bundle install` to install missing gems.
I have tried:
$ bundle config build.puma --with-cflags="-Wno-error=implicit-function-declaration"
and
gem install puma -v '4.3.0' -- --with-ldflags=-L/usr/local/opt/openssl#1.1/lib --with-cppflags=-I/usr/local/opt/openssl#1.1/include --with-cflags="-Wno-error=implicit-function-declaration"
and still the same error occurs!
Any suggestions on what I should do or how I can fix this?
Try running this:
bundle config set --global build.puma --with-cflags=-fms-extensions
& then run bundle install again
My near term goal is to continue running some tutorials from RailsApp. I had previously had no issues running rails and writing apps and doing some older tutorials. A new one came out that used a template file for thee startup app. I needed to upgrade my ruby & rails versions for this, but it still would not work (question here: Error with RailsApps starter app for rails-devise-roles tutorial) so I went ahead and upgraded mavericks.
My question is how can I get the rails to create a new app and run ? i can't develop anything now. I don't know how ot revert to older versions of ruby (maybe one that does not use sqlite3?) [<
I have googled & stack overflow searched similar problems and none of the solutions seem to work for me so far.
Basic info:
$which ruby
/Users/suzanne/.rvm/rubies/ruby-2.1.2/bin/ruby
$ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
I have also opened XCode, updated libraries requested after opening. Version listed on splash page is Version 5.1.1 (5B1008)
Now I have done the following steps to test rails and get a basic new app working
mkdir myapp
cd myapp
rvm use ruby-2.1.2#myapp --ruby-version --create
gem install rails
rails new .
and at this point I get this error:
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
XCode is installed, gcc is installed, sqlite3 is installed.
$ whereis sqlite3
/usr/bin/sqlite3
$bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.5
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.5
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.5
Using activemodel 4.1.5
Using arel 5.0.1.20140414130214
Using activerecord 4.1.5
Using bundler 1.7.2
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.5
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.2
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.1.5
Using rdoc 4.1.1
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/suzanne/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for sqlite3.h... *** 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/suzanne/.rvm/rubies/ruby-2.1.2/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
--enable-local
--disable-local
/Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:35:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9/gem_make.out
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
$ gem install sqlite3 -v '1.3.9'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/suzanne/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for sqlite3.h... *** 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/suzanne/.rvm/rubies/ruby-2.1.2/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
--enable-local
--disable-local
/Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:35:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9/gem_make.out
There was a change in Mavericks that means you have to install the command line tools.
Type in a terminal window
xcode-select --install
You should then be prompted to install the command line tools
Once that is done, you should be able to build your gems
Try gem install sqlite3 -- --with-sqlite3-dir=/opt/local and then run bundle install again.
If that doesn't work, I think you just need to install sqlite3. If you have Homebrew, this should work:
brew install sqlite3
Had the same problem running Rails 4.1.5 on CentOS 6.5.
I fixed it by:
Installing the sqlite dev library (On CentOS it's $ yum install -y sqlite-devel); and
Installing the sqlite3 gem with gem install sqlite3.
I was able to create a new rails project afterward.
got an error while trying to install devise gem. Added gem "devise", "~> 3.2.2" to my Gemlist and went into terminal to do the following:
Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for ruby/util.h... *** 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/ruby-2.0.0-p353/bin/ruby
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
Am new to programming and Ruby on Rails so kindly assist. Thanks!
managed to solve this. I had upgraded to OS Mavericks recently and problem came up.
Have tried gem install bcrypt-ruby -v '3.1.2' in terminal but encountered same problem.
Thereafter, went to install Xcode on App Store as running Xcode-select --install in terminal failed as well (program can't be found).
Thus I chanced upon this thread and followed advice to run sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2 in terminal.
Thread: gem install pg doesn't work on OSX Lion
Thereafter I ran gem install bcrypt-ruby -v '3.1.2' and bundle install in terminal and all good for now. Hope this works. Actually I don't know what I am doing but hopefully it works. Can someone enlighten me what I am actually doing?
Ran into this issue after updating OS X Mavericks to 10.9.5 which also updates Xcode (Version 6.0.1 (6A317)).
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/e/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: /usr/bin/c++ (c++ version )
extconf failed, exit code 1
Gem files will remain installed in /Users/e/.rvm/gems/ruby-2.1.1/gems/libv8-3.16.14.7 for inspection.
Results logged to /Users/e/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/libv8-3.16.14.7/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
To resolve: Must accept and finalise install of Xcode in order for bundle update to complete.
After finalising install of Xcode, bundle update completed without issue.
i ran bundle inside a ror project which resulted in following error.
I am unable to understand what is missing.
[root#kracekumar canvas-lms]# bundle
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Installing activesupport (2.3.11)
Using rack (1.1.0)
Installing actionpack (2.3.11)
Installing actionmailer (2.3.11)
Installing activerecord (2.3.11)
Installing activeresource (2.3.11)
Installing authlogic (2.1.3)
Using builder (2.1.2)
Using mime-types (1.16)
Installing xml-simple (1.0.12)
Installing aws-s3 (0.6.2)
Installing bluecloth (2.0.10) with native extensions
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:481:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/bluecloth-2.0.10 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/bluecloth-2.0.10/ext/gem_make.out
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
[root#kracekumar canvas-lms]#
For Red Hat systems, you can install the pre-requisites like this:
sudo yum -y install make gcc ruby-devel
and it should correctly install the dependencies you need for a native gem install.
This assumes you have Gems already installed, if not, install that as well:
sudo yum -y install rubygems
(Tested on an Amazon EC2 instance, which uses yum.)
It looks like you're probably using Ubuntu. Make sure to install the ruby-dev package for the Ruby headers.
sudo apt-get install ruby-dev
Alternatively, you may look into using RVM to handle Ruby/RubyGems instead.
For your ubuntu you need to install:
ruby developer packages
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8
sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby
I'm running bundle install on my staging environment on my Ubuntu machine. It keeps failing trying to install json 1.4.6 with the native extensions.
Using bundler (1.0.7)
Installing thor (0.14.6)
Installing railties (3.0.3)
Installing rails (3.0.3)
Installing geokit-rails3 (0.1.2)
Installing json (1.4.6) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /u/apps/uat.nicetripper.com/shared/bundle/ruby/1.8/gems/json-1.4.6 for inspection.
Results logged to /u/apps/example.com/shared/bundle/ruby/1.8/gems/json-1.4.6/ext/json/ext/generator/gem_make.out
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions'
from /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:198:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
I already have the json gem (1.4.6) gem installed on this machine and it installed with native extensions fine.
root#ve:/code# gem install json
Building native extensions. This could take a while...
Successfully installed json-1.4.6
1 gem installed
I don't understand why bundler is having such a problem with this. I'm running bundler 1.0.7.
Please help because json 1.4.6 has to be included as a dependency for another vital gem.
It's very possible that the Ubuntu provided Ruby or RubyGems is broken. I really recommend you install Ruby using RVM, as described in this post: Ubuntu, Ruby, RVM, Rails, and You.
If you still have trouble with the json gem even after using rvm, it'll likely be much easier to debug as you'll be using something closer to what most other Rubyists do.
I had the same issue as Simon in Ubuntu 12.04 with stock ruby 1.8. I was trying to install Redmine and Bundler (sudo bundle install) kept failed withthe same error when building the json gem. sudo gem install json worked just fine, so I did that and then installed the rest of the app's requirements with Bundler. Hope this helps someone.