I'm trying to get the sqlite3-ruby gem (version 1.3.4) installed on my account (CentOS on shared hosting, so I need to install this without root) and the version of sqlite installed is not new enough for more recent versions of sqlite3-ruby, so I need to compile the libraries under my account. The version of sqlite I'm using is 1.7.0 as I found there were issues with the more recent versions.
我试图让sqlite3-ruby宝石(1.3.4版)安装在我的帐户(CentOS共享主机,所以我需要安装这个没有根)和sqlite的版本安装不够新sqlite3-ruby最近的版本,所以我需要编译库在我的帐户。我使用的sqlite版本是1.7.0,因为我发现最近的版本有问题。
I've gone ahead and done this already - I downloaded sqlite-3.7.0.tar.gz and installed it as follows:
我已经做过了,我已经下载了sqlite-3.7.0.tar。gz,安装如下:
./configure –prefix=$HOME
make && make install
Then went to my rails 3 application and ran the following:
然后转到我的rails 3应用程序并运行以下内容:
bundle config build.sqlite3-ruby “--with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib”
Then:
然后:
bundle install --path vendor/bundle
However, I get the following and my bundle fails to fully install:
但是,我收到以下信息,我的bundle没有完全安装:
Installing sqlite3 (1.3.4) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
checking for sqlite3_backup_init()... no
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c sqlite3.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c exception.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c backup.c
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c database.c
database.c: In function 'initialize':
database.c:47: error: 'SQLITE_OPEN_READWRITE' undeclared (first use in this function)
database.c:47: error: (Each undeclared identifier is reported only once
database.c:47: error: for each function it appears in.)
database.c:47: error: 'SQLITE_OPEN_CREATE' undeclared (first use in this function)
database.c:72: error: 'SQLITE_OPEN_READONLY' undeclared (first use in this function)
database.c: In function 'set_sqlite3_func_result':
database.c:278: error: 'sqlite3_int64' undeclared (first use in this function)
make: *** [database.o] Error 1
Any ideas? This used to work, but with more recent versions of sqlite3-ruby it seems like it's a no go anymore.
什么好主意吗?这曾经起作用,但随着sqlite3-ruby的最新版本,它似乎不再流行了。
Here's some additional info:
这里有一些额外的信息:
rails -v
Rails 3.0.9
gem -v
1.7.2
.bash_profile:
PATH=$HOME/bin:$PATH
GEM_HOME=$HOME/gems
GEM_PATH=$HOME/gems
export LD_LIBRARY_PATH=$HOME/lib
export USERNAME BASH_ENV PATH GEM_HOME GEM_PATH
which sqlite3
/home/striketh/bin/sqlite3
Edit:
编辑:
I went ahead and changed from sqlite3-ruby to sqlite3 in my Gemfile and ran the following:
我在Gemfile中从sqlite3-ruby改为sqlite3,并运行了以下代码:
bundle config build.sqlite3 “--with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib --with-sqlite3-dir=$HOME”
This error message got me:
这个错误信息让我想到:
make
gcc -I. -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_BACKUP_INIT -I/home/striketh”/include -fPIC -g -O2 -fPIC -c sqlite3.c
In file included from ./sqlite3_ruby.h:42,
from sqlite3.c:1:
./backup.h:7: error: expected specifier-qualifier-list before 'sqlite3_backup'
make: *** [sqlite3.o] Error 1
Any other ideas?
任何其他想法?
5 个解决方案
#1
13
Here's the solution, which I've verified works.
这是我验证过的解决方案。
.bash_profile setup:
. bash_profile设置:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$HOME/bin:$PATH
GEM_HOME=$HOME/gems
GEM_PATH=$HOME/gems
export LD_LIBRARY_PATH=$HOME/lib
export USERNAME BASH_ENV PATH GEM_HOME GEM_PATH
Then run:
然后运行:
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar -zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
./configure --prefix=$HOME
make && make install
cd $RAILS_APP_DIR
vi Gemfile
Make sure a line similar to this is in the Gemfile: gem 'sqlite3', "1.3.4"
确保在Gemfile中有一条类似的线:gem 'sqlite3', "1.3.4"
bundle config build.sqlite3 --with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib --with-sqlite3-dir=$HOME/bin
bundle install --path vendor/bundle
#2
11
On Ubuntu:
在Ubuntu上:
sudo apt-get install libsqlite3-dev
Then bundle install will work.
然后捆绑安装将会工作。
#3
6
Install "sqlite-devel" package to build native extensions of "sqlite3" gem on RH-based systems.
安装“sqlite-devel”包,以便在基于rhon的系统上构建“sqlite3”gem的本地扩展。
On Debian-based systems install "libsqlite3-dev" package.
在基于debian的系统上安装“libsqlite3-dev”包。
#4
2
On CentOS, you can use yum (verified works)
在CentOS上,您可以使用yum(已验证作品)
yum install sqlite sqlite-devel
gem install sqlite3
#5
1
gem sqlite3 requires sqlite 3.6.16+. CentOS has v3.3.6
gem sqlite3需要sqlite 3.6.16+。CentOS已经v3.3.6
So, CentOS user needs to:
所以CentOS用户需要:
wget "http://www.sqlite.org/sqlite-autoconf-3071000.tar.gz"
then, unpack and:
然后,解压缩和:
cd sqlite-autoconf-3071000
./configure --prefix=/usr/local/sqlite-3.7
make
make && install
then try gem install sqlite3
AGAIN.
然后再试试gem安装sqlite3。
#1
13
Here's the solution, which I've verified works.
这是我验证过的解决方案。
.bash_profile setup:
. bash_profile设置:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$HOME/bin:$PATH
GEM_HOME=$HOME/gems
GEM_PATH=$HOME/gems
export LD_LIBRARY_PATH=$HOME/lib
export USERNAME BASH_ENV PATH GEM_HOME GEM_PATH
Then run:
然后运行:
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar -zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
./configure --prefix=$HOME
make && make install
cd $RAILS_APP_DIR
vi Gemfile
Make sure a line similar to this is in the Gemfile: gem 'sqlite3', "1.3.4"
确保在Gemfile中有一条类似的线:gem 'sqlite3', "1.3.4"
bundle config build.sqlite3 --with-sqlite3-include=$HOME/include --with-sqlite3-lib=$HOME/lib --with-sqlite3-dir=$HOME/bin
bundle install --path vendor/bundle
#2
11
On Ubuntu:
在Ubuntu上:
sudo apt-get install libsqlite3-dev
Then bundle install will work.
然后捆绑安装将会工作。
#3
6
Install "sqlite-devel" package to build native extensions of "sqlite3" gem on RH-based systems.
安装“sqlite-devel”包,以便在基于rhon的系统上构建“sqlite3”gem的本地扩展。
On Debian-based systems install "libsqlite3-dev" package.
在基于debian的系统上安装“libsqlite3-dev”包。
#4
2
On CentOS, you can use yum (verified works)
在CentOS上,您可以使用yum(已验证作品)
yum install sqlite sqlite-devel
gem install sqlite3
#5
1
gem sqlite3 requires sqlite 3.6.16+. CentOS has v3.3.6
gem sqlite3需要sqlite 3.6.16+。CentOS已经v3.3.6
So, CentOS user needs to:
所以CentOS用户需要:
wget "http://www.sqlite.org/sqlite-autoconf-3071000.tar.gz"
then, unpack and:
然后,解压缩和:
cd sqlite-autoconf-3071000
./configure --prefix=/usr/local/sqlite-3.7
make
make && install
then try gem install sqlite3
AGAIN.
然后再试试gem安装sqlite3。