Question

After installing sqlite, libsqlite0-dev and libsqlite3-dev (and ruby1.9.3 of course) on my Ubuntu 12.04.4 LTS, I do :

sudo gem install sqlite-ruby

And here is the log I got :

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

Can somebody help me on installing that lib ? (my main problem is to migrate a Trac project to a Redmine following that documentation)

Was it helpful?

Solution

Thanks to Graeme McLean's comment my question, http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/, https://www.ruby-forum.com/topic/4405578 and http://guides.rubygems.org/make-your-own-gem/, I managed to patch the sqlite-ruby gem, build it and install it :

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top