# RVM, ruby 1.8.7 with sqlite3 troubles.



## Lorem-Ipsum (Feb 20, 2012)

Hi folks,

I'm having a lot of trouble with ruby 1.8.7 in rvm. I need that specific version to run a typo blog site and don't want to use the system version as I use conflicting rubygems.

Using the system version of ruby 1.8.7 all seems fine but when using rvm the gem sqlite3 causes errors.

When running either `# bundle install` or explicitly running `# gem install sqlite3` it fails with with:


```
Installing sqlite3 (1.3.5) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/username/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' 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=/home/username/.rvm/rubies/ruby-1.8.7-p357/bin/ruby
	--with-sqlite3-dir
	--without-sqlite3-dir
	--with-sqlite3-include=${sqlite3-dir}/include
	--with-sqlite3-lib
	--without-sqlite3-lib=${sqlite3-dir}/lib
	--enable-local
	--disable-local
	--with-sqlite3lib
	--without-sqlite3lib


Gem files will remain installed in /home/username/.rvm/gems/ruby-1.8.7-p357/gems/sqlite3-1.3.5 for inspection.
Results logged to /home/username/.rvm/gems/ruby-1.8.7-p357/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
```

I've tried exporting the sqlite3 path to /usr/local/include and I've tried the configuration option as an argument (which causes another error).

I've seen similar problems on other forums but most are at least a year old and their fixes don't work.

Any and all help much appreciated.


----------



## graudeejs (Feb 20, 2012)

1st) make sure you have sqlite installed
2nd) try this https://gist.github.com/1619481 (replace version to one you need). Yes, this is not about sqlite, but problem looks very similar


----------



## unull (Feb 20, 2012)

`$ gem install sqlite3 -- --with-sqlite3-include=/usr/local/include` should do if you have installed the devel/sqlite3 port.


----------



## Lorem-Ipsum (Feb 21, 2012)

graudeejs said:
			
		

> 1st) make sure you have sqlite installed
> 2nd) try this https://gist.github.com/1619481 (replace version to one you need). Yes, this is not about sqlite, but problem looks very similar



I am using rvm, when using the port (system) version of lang/ruby18 sqlite3 installs fine. However I need to use rvm to keep my environments separate.



			
				unull said:
			
		

> `$ gem install sqlite3 -- --with-sqlite3-include=/usr/local/include` should do if you have installed the devel/sqlite3 port.



I can't find that devel port anywhere, are you sure it exists? The command fails too with the same error as in my first post.


----------



## Lorem-Ipsum (Feb 21, 2012)

graudeejs said:
			
		

> 1st) make sure you have sqlite installed
> 2nd) try this https://gist.github.com/1619481 (replace version to one you need). Yes, this is not about sqlite, but problem looks very similar



My apologies, I misread your post and thought you were simply advising me to use rvm. I just tried that method but with sqlite3 in place of iconv and it seems to have worked.

Thanks, you've saved me a lot of bother.


----------

