I've install Ruby 2, Rails 4 and MySQL (with homebrew).
I tried to install the gem "mysql2" but i got this message :
gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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=/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
Can you help me ?
For some reason, install mysql via homebrew was broken. You have to manually edit the mysql_config.
The mysql_config file of homebrew stay in /usr/local/Cellar/mysql/5.6.12/bin,
Open it with sudo, around line 120, find these lines:
cflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
And remote -Wno-null-conversion -Wno-unused-private-filed in both line like this:
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
Save the file and execute brew install mysql again and it should work.
Check this blog post.
Check the compatibility of Rails and mysql version you are installing.
With me I was starting Rails 4.1.15 with Mysql 8.0 which didn't work and I came across similar errors.
Then i installed
brew install mysql56
Before this uninstall mysql if you have already installed one using -
brew uninstall mysql
brew cleanup
Now create a new rails project by specifying database to be used as mysql
rails new <PROJECT_NAME> -d mysql
This will create a new rails 4 project with compatible mysql
After this you can always configure the database.yml file for further details
Related
I am attempting to install the Nokogiri gem for use with Ruby on Rails, but I cannot get it to build no matter which packages I install. I am running Ubuntu 20.04.
I have installed all the packages from this guide on the Nokogiri website (https://nokogiri.org/tutorials/installing_nokogiri.html):
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
I am using RVM, so I have also installed the libgmp-dev package, which the above tutorial also recommends.
While searching for other solutions, I have also installed the following packages:
sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
Ruby Version: 2.7.1
RVM Version: 1.29.10
Gem Version: 3.1.2
gem_make.out
current directory: /home/dan/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
/usr/share/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20200924-8532-1t7wwwh.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/share/rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `block in try_compile'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:544:in `with_werror'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:655:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/dan/.rvm/gems/ruby-2.7.1/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/mkmf.log
extconf failed, exit code 1
mkmf.log
"gcc -o conftest -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -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.7.1/lib -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.7.1/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lm -lc "
gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
Any help would be much appreciated.
You have to do a full compile of Ruby 2.7.x in order to get nokogiri 1.10.10 to install on Ubuntu 20.04.
For a clean install run:
rvm install 2.7 --disable-binary
To reinstall your existing ruby version use:
rvm reinstall 2.7 --disable-binary
Ubuntu 20.04. Ruby 2.7.1.
Changing rvm to rbenv was fixed this error.
I reinstalled Ubuntu 20.04 fresh along with Ruby etc, and it worked. I don't know what went wrong, and I don't know if any of the solutions below will work.
I add the same problem. On this environment :
ubuntu 20.04 LTS
ruby 2.7.0
gem 3.1.2
bundler 2.1.4,
the steps described here https://mrtan.me/post/34.html/ worked for me :
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
bundle
Can confirm. Going to rbenv worked for me as well.
I'm following the "Jekyll on Debian" directions step-by-step for installing Jekyll on my Debian 10.1:
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler
but it doesn't work. Here is the output:
$ gem install jekyll bundler
Building native extensions. This could take a while...
/usr/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/mark/gems/bin in PATH, mode 040777
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7/ext
/usr/bin/ruby2.5 -r ./siteconf20200102-7165-18dxplz.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=/usr/bin/$(RUBY_BASE_NAME)2.5
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
/usr/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/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /usr/lib/ruby/2.5.0/mkmf.rb:661:in `try_ldflags'
from /usr/lib/ruby/2.5.0/mkmf.rb:1821:in `pkg_config'
from extconf.rb:65:in `pkg_config_wrapper'
from extconf.rb:92:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7 for inspection.
Results logged to /srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/gem_make.out
Successfully installed bundler-2.1.3
Parsing documentation for bundler-2.1.3
Done installing documentation for bundler after 19 seconds
1 gem installed
and here is the log file:
"gcc -o conftest -I/usr/include/i386-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -g -O2 -fdebug-prefix-map=/build/ruby2.5-qqUyFd/ruby2.5-2.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/i386-linux-gnu -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/lib/ruby/2.5.0/mkmf.rb:395: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/marcotrapanese/gems/bin in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"pkg-config --exists openssl"
| pkg-config --libs openssl
=> "-lssl -lcrypto\n"
The warning about the permissions on the gems/bin folder is weird, because it was created by the installer, not by me.
It says "You have to install development tools first", but I've already installed them. Furthermore the error message doesn't tell what it thinks is missing.
Why does following such a simple procedure fail?
Just updated to macOS Mojave, reinstalled mysql via brew & downloaded latest xcode 9.2 . While triying to setup a development enviroment for an old rails project, bundle crashes on installation of mysql2 gem. In the beggining i thought it was because latest mysql2 version, is not compatible with ruby 1.9 so i tried:
gem install mysql2 -v '0.3.17'
and i received:
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for ruby/thread.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
--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/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
/Users/me/.rvm/rubies/ruby-1.9.3-p125/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/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:intry_cpp'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in block in have_header'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:inblock in checking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:inchecking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in have_header'
from extconf.rb:9:in'
copy from /Users/me/.rvm/gems/ruby-1.9.3-p125#mailcatcher/gems/mysql2-0.2.18/ext/mysql2/mkmf.log:
"/usr/bin/gcc-4.2 -o conftest -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. -I/Users/me/.rvm/usr/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 -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib -L/Users/me/.rvm/usr/lib -L. -L/usr/local/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: int main() {return 0;}
/ end */
It sounds like you're either missing the XCode command line tools:
xcode-select --install
Or mySQL packages:
If you don't already have homebrew:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then to install mysql:
brew install mysql
I can't remember which solved this issue for me in the past but I'm sure it was one of them.
Cross linking my answer to almost this exact same question. I think it might just be not finding the correct config path
sudo gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
See the answer here
edit: formatting
I'm a complete Ruby newbie. I'm trying to load the sqlite3 module. Here's the
entirety of my script:
#!/usr/bin/ruby -w
require 'sqlite3'
Running that command results in this output:
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- sqlite3 (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./sqlite.rb:2:in `<main>'
The go-to page for this problem seems to be this page. However, none of the solutions there help.
The most popular solution is to edit sqlite3's gemspec file. I can only find
one file on my system that looks like a gemspec file for sqlite3. It has the following rather odd path:
/home/terry/.gem/specs/api.rubygems.org%443/quick/Marshal.4.8/sqlite3-1.3.13.gemspec
The contents of that file look like this (word wrapped for reading):
;;F;U; [[[I"~>;TU;[I" 3.15;T0I"jamis#37signals.com;TI"luislavena#gmail.com;TI"
aaron#tenderlovemaking.com;TI"Jamis Buck;TI"Luis Lavena;TI"Aaron Patterson;TI"▒
This module allows Ruby programs to interface with the SQLite3 database engine
(http://www.sqlite.org). You must have the SQLite engine installed in order
to build this module.
Note that this module is only compatible with SQLite 3.6.16 or newer.;TI"
2https://github.com/sparklemotion/sqlite3-ruby;TT#[I" BSD-3;T
That doesn't match with anything like the stackoverflow page's description.
So I'm lost.
Here are some of my system specifications:
Ubuntu Linux 16.04.1
# sqlite3 -version
3.11.0 2016-02-15 17:29:24 3d862f207e3adc00f78066799ac5a8c282430a5f
# ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Let me know if there is other information I should post. Any help is appreciated. Thanks!
-- update --
In response to Amadan's suggestion, I tried the suggested command and got this result:
# gem install sqlite3
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
So I tried it with sudo and got this:
# sudo gem install sqlite3
[sudo] password for terry:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20170308-16463-q46juc.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
I checked that log file and it just has the same error.
-- another update --
On #maxple's suggestion, I installed ruby2.3-dev. That seemed to go well:
# sudo apt-get install ruby2.3-dev
[sudo] password for terry:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgmp-dev libgmpxx4ldbl
Suggested packages:
gmp-doc libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev libgmpxx4ldbl ruby2.3-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,357 kB of archives.
After this operation, 6,493 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libgmpxx4ldbl amd64 2:6.1.0+dfsg-2 [8,948 B]
Get:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libgmp-dev amd64 2:6.1.0+dfsg-2 [314 kB]
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 ruby2.3-dev amd64 2.3.1-2~16.04 [1,034 kB]
Fetched 1,357 kB in 0s (3,228 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 125914 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a6.1.0+dfsg-2_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.1.0+dfsg-2) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a6.1.0+dfsg-2_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.1.0+dfsg-2) ...
Selecting previously unselected package ruby2.3-dev:amd64.
Preparing to unpack .../ruby2.3-dev_2.3.1-2~16.04_amd64.deb ...
Unpacking ruby2.3-dev:amd64 (2.3.1-2~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Setting up libgmpxx4ldbl:amd64 (2:6.1.0+dfsg-2) ...
Setting up libgmp-dev:amd64 (2:6.1.0+dfsg-2) ...
Setting up ruby2.3-dev:amd64 (2.3.1-2~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Then I attempted again to gem install sqlite3, and that didn't seem to go well:
# sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/usr/bin/ruby2.3 -r ./siteconf20170308-16984-tcxs0x.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
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_BASE_NAME)2.3
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--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:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
The log file mkmf.log has this:
package configuration for sqlite3 is not found
find_header: checking for sqlite3.h... -------------------- no
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -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 -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i"
conftest.c:3:21: fatal error: sqlite3.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <sqlite3.h>
/* end */
--------------------
Trying to get Rails up on ubuntu, and I’m having trouble installing sqlite3-ruby – it apparently can’t find sqlite3.h. All the references I can find to the error suggest the problem is either: sqlite3 headers aren’t installed, or make can’t find them. It looks to me like I’ve solved both those issues and I’m still seeing the same problem.
No real idea what’s going on here. Version mismatch, maybe? This is with ruby 1.8.7, sqlite 3.6.22-1, gem 1.3.5 and sqlite3-ruby 1.3.1 on ubuntu 10.04.1.
david#li88-188:~$ sudo apt-get install sqlite3
[...successful installation...]
Setting up sqlite3 (3.6.22-1) ...
david#li88-188:~$ sudo apt-get install libsqlite3-dev
[...successful installation...]
Setting up libsqlite3-dev (3.6.22-1) ...
david#li88-188:~$ sudo gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
*** 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.
[...configuration options etc....]
david#li88-188:~$ cat /var/lib/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/mkmf.log
find_header: checking for sqlite3.h... -------------------- no
"gcc -E -I. -I/usr/lib/ruby/1.8/i486-linux -I. -I/usr/local/include -I/opt/local/include -I/usr/include -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -g -g -O2 -fPIC -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <sqlite3.h>
/* end */
--------------------
Note that /usr/include is in the list of arguments.
david#li88-188:~$ ls -l /usr/include/sqlite3.h
-rw-r--r-- 1 root root 268351 2010-02-08 03:59 /usr/include/sqlite3.h
And note that the file is there.
In my case I had to install libsqlite3-dev
sudo apt-get install libsqlite3-dev
Never mind. gcc itself wasn't installed, as I discovered when I tried to install another gem with better error messages.
https://help.ubuntu.com/community/RubyOnRails here is a basic tutorial for setting up RoR development environment for Ubuntu with each step of the way explained. Good luck!