在我的Ubuntu 12.04.4 LTS上安装sqlite
,libsqlite0-dev
和libsqlite3-dev
(以及ruby1.9.3
)之后,我做了:
sudo gem install sqlite-ruby
这是我得到的日志:
Building native extensions. This could take a while...
ERROR: Error installing sqlite-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lsqlite... yes
checking for sqlite.h... yes
checking for sqlite_open() in -lsqlite... yes
creating Makefile
make
compiling sqlite-api.c
sqlite-api.c: In function 'static_api_open':
sqlite-api.c:273:15: warning: assignment makes pointer from integer without a cast [enabled by default]
sqlite-api.c: In function 'static_api_compile':
sqlite-api.c:335:28: warning: passing argument 2 of 'sqlite_compile' makes pointer from integer without a cast [enabled by default]
/usr/include/sqlite.h:657:5: note: expected 'const char *' but argument is of type 'int'
sqlite-api.c: In function 'static_api_complete':
sqlite-api.c:548:3: warning: passing argument 1 of 'sqlite_complete' makes pointer from integer without a cast [enabled by default]
/usr/include/sqlite.h:260:5: note: expected 'const char *' but argument is of type 'int'
sqlite-api.c: In function 'static_api_set_result':
sqlite-api.c:783:24: error: 'struct RString' has no member named 'ptr'
sqlite-api.c:784:24: error: 'struct RString' has no member named 'len'
sqlite-api.c: In function 'static_api_set_result_error':
sqlite-api.c:820:53: error: 'struct RString' has no member named 'ptr'
sqlite-api.c:821:20: error: 'struct RString' has no member named 'len'
sqlite-api.c: In function 'static_raise_db_error':
sqlite-api.c:1181:3: warning: format not a string literal and no format arguments [-Wformat-security]
make: *** [sqlite-api.o] Error 1
Gem files will remain installed in /var/lib/gems/1.9.1/gems/sqlite-ruby-2.2.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/sqlite-ruby-2.2.3/ext/gem_make.out
有人可以帮我安装那个lib吗? (我的主要问题是将Trac项目迁移到Redmine following that documentation)
答案 0 :(得分:0)
感谢Graeme McLean's comment my question,http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/,https://www.ruby-forum.com/topic/4405578和http://guides.rubygems.org/make-your-own-gem/,我设法修补了sqlite-ruby
gem,构建并安装它:
gem fetch sqlite-ruby
gem unpack sqlite-ruby-2.2.3.gem
cd sqlite-ruby-2.2.3/
sed -i 's/RSTRING(\(.*\))->ptr/RSTRING_PTR(\1)/g' ext/sqlite-api.c
sed -i 's/RSTRING(\(.*\))->len/RSTRING_LEN(\1)/g' ext/sqlite-api.c
gem unpack --spec ../sqlite-ruby-2.2.3.gem
sed -i 's/version: 2.2.3/version: 2.2.3.patched/' sqlite-ruby-2.2.3.gemspec
cat >> sqlite-ruby-2.2.3.gemspec <<EOF
cert_chain: []
licenses: []
required_rubygems_version: !ruby/object:Gem::Version::Requirement
requirements:
-
- ">="
- !ruby/object:Gem::Version
version: 1.8.0
version:
EOF
gem build sqlite-ruby-2.2.3.gemspec
sudo gem install sqlite-ruby --local