sqlite3-ruby install error on Ubuntu

2020-01-25 12:23发布

I have the following error during sqlite3-ruby install:

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.

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/ruby1.8
    --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/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out

sqlite3.h is located in /usr/include/

sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include

doesn't work


ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-sqlite3-include=/usr/include

Ubuntu 10.04

19条回答
太酷不给撩
2楼-- · 2020-01-25 12:31

Not --without-sqlite3-include=/usr/include, but --with-sqlite3-include=/usr/include.

查看更多
做个烂人
3楼-- · 2020-01-25 12:31

This is the exact same problem I had a few weeks ago. I found out I needed to download the most recent headers/libraries from the SQLite Download Page. Try it out, hope this helps!

查看更多
ゆ 、 Hurt°
4楼-- · 2020-01-25 12:31

You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … , if it does not help then restart your computer. install RVM: \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanat

查看更多
闹够了就滚
5楼-- · 2020-01-25 12:32

If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:

sudo apt-get install libxslt-dev libxml2-dev

OR You can check with these commands:

This command will prepare for you two packages : sqllite3 and libsqlite3-dev

sudo apt-get install sqlite3 libsqlite3-dev

-Now,install sqlite gem

 [sudo] gem install sqlite3-ruby

-using Ubuntu doesn't need sudo.

Goodluck! Note: i'm using Ubuntu 10.10 and it's working.

查看更多
Bombasti
6楼-- · 2020-01-25 12:39

You just need a -- in there.

sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include

That specifies that the option is not to gem directly, but the specific gem.

查看更多
家丑人穷心不美
7楼-- · 2020-01-25 12:41

Had this same problem and the following worked for me:

compile sqlite3 as static library, install somewhere in your home directory and then provide that option for the gem install process.

Go to the download page and grab the source. Most recent version at this time is http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz

tar -xf on the file or do whatever you normally do to uncompress; enter directory

./configure --disable-shared --enable-static --prefix=/some/path/in/my/home

compile, install, and when you're installing the gem...

gem install sqlite3-ruby -- --with-sqlite3-dir=/some/path/in/my/home

查看更多
登录 后发表回答