Skip to content

Instantly share code, notes, and snippets.

@danieltdt
Created June 2, 2013 08:51
Show Gist options
  • Save danieltdt/5693070 to your computer and use it in GitHub Desktop.
Save danieltdt/5693070 to your computer and use it in GitHub Desktop.
Install UnQLite as a shared library on Linux (tested on ubuntu 12.04).
#!/usr/bin/env bash
# Before executing it, you must download UnQLite source code (http://www.unqlite.org/downloads.html)
# unzip all the files and execute this script inside the unzipped folder. For example:
# mkdir /tmp/unqlite; cd /tmp/unqlite; unzip ~/Downloads/unqlite-db-116.zip
gcc -Wall -fPIC -c *.c
gcc -shared -Wl,-soname,libunqlite.so.1 -o libunqlite.so.1.0 *.o
sudo cp `pwd`/libunqlite.so.1.0 /usr/local/lib/
sudo cp `pwd`/unqlite.h /usr/local/include/
sudo ln -sf /usr/local/lib/libunqlite.so.1.0 /usr/local/lib/libunqlite.so.1
sudo ln -sf /usr/local/lib/libunqlite.so.1 /usr/local/lib/libunqlite.so
@djurczak
Copy link

Thanks for the compilation instructions, saved me at least an hour of headache.

Running this on an Ubuntu box using vagrant I ran into an issue where my ruby (through rvm) was complaining about not being able to open the just compiled library:

LoadError: libunqlite.so.1: cannot open shared object file: No such file or directory - /home/vagrant/.rvm/gems/ruby-1.9.3-p429/gems/unqlite-0.1.0/lib/unqlite/unqlite_native.so

To solve this I simply had to let it know explicitly about them:

ldconfig /usr/local/lib/libunqlite.so

@no-glue
Copy link

no-glue commented Oct 16, 2014

does this work on ubuntu 14.04?

@danieltdt
Copy link
Author

Sorry @no-glue , I don't use ubuntu anymore and I can't test :(
It should work because the only thing it does is symlink to ubuntu default folders... Try run ldconfig /usr/local/lib/libunqlite.so also, it may help.

@alexandre-mbm
Copy link

This teaches to compile and install sqlite3 as Ruby gem on Windows 7. I did it. Works. @danieltdt, do you know instruct me something analogous with UnQLite?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment