# SQLIte3 DL driver deprecated, how to use native?

**URL:** <https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229>\
**Category:** ruby-talk\
**Created:** [29 August 2007 10:50 UTC](https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229 "2007-08-29T10:50:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_Catflap](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@Eddie\_Catflap](https://rubytalk.org/u/Eddie_Catflap)\
**Post date:** [29 August 2007 10:50 UTC](https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229/1 "2007-08-29T10:50:33Z")

</div>

Hi.

I'm writing what's pretty much my first piece of code using Ruby. Very happy  
with it so far and have managed to cobble together a bit of code to archive  
a large amount of text (basically a message board archive) into a sqlite  
database. And it works! One thing is intriguing me though. I'm seeing an  
error generated by the line:

db = SQLite3::Database.new( 'test.db' )

The warning message is:

The DL driver for sqlite3-ruby is deprecated and will be removed  
in a future release. Please update your installation to use the  
Native driver.

I've spent the best part of two days looking for how to get the system to  
use the native driver. I'm running on Solaris 10 (sparc). Sqlite3 resides  
under /usr/local/bin (and it's libraries under /usr/local/lib ). I've  
installed SWIG and reinstalled the sqlite3-ruby gem. Nothing seems to make a  
difference. Am I missing a trick here? It may be that this isn't the right  
place to ask a question like this, although there seemed to be a fair amount  
of SQLite3 related queries in the archive. If this is the wrong place, feel  
free to tell me to sod off, I won't be offended 😉

Here's how I install the sqlite3-ruby gem, and the output - any clues here?  
It would seem the native driver is being compiled, should I be doing  
something other than using SQLite3::Database.new to choose it?

bash-3.00# gem install sqlite3-ruby  
Need to update 16 gems from [http://gems.rubyforge.org](http://gems.rubyforge.org)  
................  
complete  
Select which gem to install for your platform (sparc-solaris2.10)

1. sqlite3-ruby 1.2.1 (mswin32)  
2. sqlite3-ruby 1.2.1 (ruby)  
3. sqlite3-ruby 1.2.0 (mswin32)  
4. sqlite3-ruby 1.2.0 (ruby)  
5. sqlite3-ruby 1.1.0 (mswin32)  
6. sqlite3-ruby 1.1.0 (ruby)  
7. sqlite3-ruby 1.0.1 (ruby)  
8. sqlite3-ruby 1.0.1 (mswin32)  
9. sqlite3-ruby 1.0.0 (mswin32)  
10. sqlite3-ruby 1.0.0 (ruby)  
11. sqlite3-ruby 0.9.0 (ruby)  
12. sqlite3-ruby 0.9.0 (mswin32)  
13. sqlite3-ruby 0.6.0 (ruby)  
14. sqlite3-ruby 0.5.0 (ruby)  
15. Cancel installation

> 2

Building native extensions. This could take a while...  
make: \*\*\* No rule to make target `ruby.h', needed by `sqlite3\_api\_wrap.o'.  
Stop.  
make: \*\*\* No rule to make target `ruby.h', needed by `sqlite3\_api\_wrap.o'.  
Stop.  
ruby extconf.rb install sqlite3-ruby  
checking for sqlite3.h... yes  
checking for sqlite3\_open() in -lsqlite3... no

make

make install

make clean  
Successfully installed sqlite3-ruby-1.2.1  
Installing ri documentation for sqlite3-ruby-1.2.1...

lib/sqlite3/database.rb:638:65: Skipping require of dynamic string:  
"sqlite3/driver/#{driver.to\_s.downcase}/driver"

lib/sqlite3/database.rb:643:59: Skipping require of dynamic string:  
"sqlite3/driver/#{d.downcase}/driver"  
Installing RDoc documentation for sqlite3-ruby-1.2.1...

lib/sqlite3/database.rb:638:65: Skipping require of dynamic string:  
"sqlite3/driver/#{driver.to\_s.downcase}/driver"

lib/sqlite3/database.rb:643:59: Skipping require of dynamic string:  
"sqlite3/driver/#{d.downcase}/driver"

Regards

---

<div class="post-metadata">

**Author:** ![Jeremy\_Hinegardner](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jeremy\_Hinegardner](https://rubytalk.org/u/Jeremy_Hinegardner)\
**Post date:** [29 August 2007 13:43 UTC](https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229/2 "2007-08-29T13:43:36Z")

</div>

Hi,

> Hi.
> 
> I'm writing what's pretty much my first piece of code using Ruby. Very happy  
> with it so far and have managed to cobble together a bit of code to archive  
> a large amount of text (basically a message board archive) into a sqlite  
> database. And it works! One thing is intriguing me though. I'm seeing an  
> error generated by the line:
> 
> db = SQLite3::Database.new( 'test.db' )
> 
> The warning message is:
> 
> The DL driver for sqlite3-ruby is deprecated and will be removed  
> in a future release. Please update your installation to use the  
> Native driver.
> 
> I've spent the best part of two days looking for how to get the system to  
> use the native driver. I'm running on Solaris 10 (sparc). Sqlite3 resides  
> under /usr/local/bin (and it's libraries under /usr/local/lib ). I've  
> installed SWIG and reinstalled the sqlite3-ruby gem. Nothing seems to make a  
> difference. Am I missing a trick here? It may be that this isn't the right  
> place to ask a question like this, although there seemed to be a fair amount  
> of SQLite3 related queries in the archive. If this is the wrong place, feel  
> free to tell me to sod off, I won't be offended 😉
> 
> Here's how I install the sqlite3-ruby gem, and the output - any clues here?  
> It would seem the native driver is being compiled, should I be doing  
> something other than using SQLite3::Database.new to choose it?

[...]

> Building native extensions. This could take a while...  
> make: \*\*\* No rule to make target `ruby.h', needed by `sqlite3\_api\_wrap.o'.  
> Stop.  
> make: \*\*\* No rule to make target `ruby.h', needed by `sqlite3\_api\_wrap.o'.

It would appear that rubygems cannot find your ruby.h for your ruby  
installation, which it needs to build the native driver. I have not  
installed ruby on Solaris myself, but is there a ruby.h in the directory  
printed out with this:

&nbsp;&nbsp;&nbsp;&nbsp;ruby -rrbconfig -e 'puts ::Config::CONFIG["includedir"]'

enjoy,

-jeremy

> **···**
>
> On Wed, Aug 29, 2007 at 07:50:33PM +0900, Eddie Catflap wrote:
> 
> # --
> 
> Jeremy Hinegardner jeremy@hinegardner.org

---

<div class="post-metadata">

**Author:** ![Eddie\_Catflap](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@Eddie\_Catflap](https://rubytalk.org/u/Eddie_Catflap)\
**Post date:** [29 August 2007 14:11 UTC](https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229/3 "2007-08-29T14:11:49Z")

</div>

Hi Jeremy

Thanks for the quick reply!

> Hi,
> 
> It would appear that rubygems cannot find your ruby.h for your ruby  
> installation, which it needs to build the native driver. I have not  
> installed ruby on Solaris myself, but is there a ruby.h in the directory  
> printed out with this:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;ruby -rrbconfig -e 'puts ::Config::CONFIG["includedir"]'

You are onto something there - there isn't:

-bash-3.00$ ruby -rrbconfig -e 'puts ::Config::CONFIG["includedir"]'  
/usr/local/include  
-bash-3.00$ ls /usr/local/include  
c++ libcharset.h ncurses readline zconf.h  
iconv.h localcharset.h python2.5 sqlite3.h zlib.h

However I have found it under /usr/local/lib/ruby/1.8/sparc-solaris2.10  
/ruby.h

I'm guessing the ruby package installed on this system (from  
Sunfreeware.comby the looks of things) sticks the header files in a  
strange place. Adding  
this dir to PATH or LD\_LIBRARY\_PATH wasn't enough to resolve the problem.  
I'll do a bit more digging around, thanks for pointing me in the right  
direction - I'll update this once I get the answer.

> **···**
>
> On 8/29/07, Jeremy Hinegardner \<jeremy@hinegardner.org\> wrote:

---

<div class="post-metadata">

**Author:** ![Eddie\_Catflap](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@Eddie\_Catflap](https://rubytalk.org/u/Eddie_Catflap)\
**Post date:** [3 September 2007 16:17 UTC](https://rubytalk.org/t/sqlite3-dl-driver-deprecated-how-to-use-native/40229/4 "2007-09-03T16:17:56Z")

</div>

Here's how I resolved this and managed to get the native driver to compile,  
for anyone who's interested.

I went down the route of removing all gems, rubygems and ruby itself, then  
reinstalled ruby from source (not the prebuilt package from sunfreeware).  
Then reinstalled rubygems and all the gems I had before.

The sqlite3-ruby gem however would not even compile the ruby driver once I'd  
done that! Completed failed - So I downloaded the source and went down the  
ruby setup.rb config route:

bash-3.00# ruby setup.rb config  
---\> lib  
---\> lib/sqlite3  
---\> lib/sqlite3/driver  
---\> lib/sqlite3/driver/dl  
\<--- lib/sqlite3/driver/dl  
---\> lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver  
\<--- lib/sqlite3  
\<--- lib  
---\> ext  
---\> ext/sqlite3\_api  
/usr/local/bin/ruby /var/tmp/sqlite3-ruby-1.2.1/ext/sqlite3\_api/extconf.rb  
checking for sqlite3.h... yes  
checking for sqlite3\_open() in -lsqlite3... no  
---\> ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api  
\<--- ext

The next step failed however:

bash-3.00# ruby setup.rb setup  
---\> lib  
---\> lib/sqlite3  
---\> lib/sqlite3/driver  
---\> lib/sqlite3/driver/dl  
\<--- lib/sqlite3/driver/dl  
---\> lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver  
\<--- lib/sqlite3  
\<--- lib  
---\> ext  
---\> ext/sqlite3\_api  
make  
make: \*\*\* No rule to make target `ruby.h', needed by `sqlite3\_api\_wrap.o'.  
Stop.  
'system make ' failed  
Try 'ruby setup.rb --help' for detailed usage.

After much wailing and gnashing of teeth I came across the following url:

[http://readlist.com/lists/sqlite.org/sqlite-users/0/4442.html](http://readlist.com/lists/sqlite.org/sqlite-users/0/4442.html)

Where a Mr Stephen Fitch described his (similar, but not exact) problem with  
the package on Solaris 10. His solution was to

export LD\_OPTIONS="-lposix4"

before running ruby setup.rb config etc, so I tried it.. and it worked!

bash-3.00# ruby setup.rb config  
---\> lib  
---\> lib/sqlite3  
---\> lib/sqlite3/driver  
---\> lib/sqlite3/driver/dl  
\<--- lib/sqlite3/driver/dl  
---\> lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver  
\<--- lib/sqlite3  
\<--- lib  
---\> ext  
---\> ext/sqlite3\_api  
/usr/local/bin/ruby /var/tmp/sqlite3-ruby-1.2.1/ext/sqlite3\_api/extconf.rb  
checking for sqlite3.h... yes  
checking for sqlite3\_open() in -lsqlite3... yes  
creating Makefile  
---\> ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api  
\<--- ext  
bash-3.00# ruby setup.rb setup  
---\> lib  
---\> lib/sqlite3  
---\> lib/sqlite3/driver  
---\> lib/sqlite3/driver/dl  
\<--- lib/sqlite3/driver/dl  
---\> lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver/native  
\<--- lib/sqlite3/driver  
\<--- lib/sqlite3  
\<--- lib  
---\> ext  
---\> ext/sqlite3\_api  
make  
gcc -I. -I. -I/usr/local/lib/ruby/1.8/sparc-solaris2.10 -I/var/tmp/sqlite3-  
ruby-1.2.1/ext/sqlite3\_api -DHAVE\_SQLITE3\_H -I/usr/local/include -fPIC -g  
-O2 -c sqlite3\_api\_wrap.c  
gcc -shared -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -L'/usr/local/lib'  
-Wl,-R'/usr/local/lib' -o sqlite3\_api.so sqlite3\_api\_wrap.o -lsqlite3 -ldl  
-lcrypt -lm -lc  
---\> ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api/win32  
\<--- ext/sqlite3\_api  
\<--- ext

After that it was just a case of ruby setup.rb install, test it out and.. no  
more 'deprecated' warnings. So thanks to Mr Fitch, wherever you may be.
