7

I'm new to sqlite , I just got the binary of sqlite by using wget http://www.sqlite.org/sqlite-shell-linux-x86-3071300.zip, then extract sqlite3 from the zip file, it does not work, it's driving me crazy, please HELP.

My OS is Ubuntu 12.04 64-bit, the steps of execution of sqlite as follows,

u1@newhost:/tmp$ ls -hl sqli*
-rwxrwxr-x 1 u1 u1 568K Jun 11 17:35 sqlite3
-rw-rw-r-- 1 u1 u1 310K Jun 12 02:53 sqlite-shell-linux-x86-3071300.zip
u1@newhost:/tmp$ file sqlite3
sqlite3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x8637c6613a485b675a05f155564cc0eda4b2d3cc, stripped
u1@newhost:/tmp$ ./sqlite3 mydb.db
-bash: ./sqlite3: No such file or directory
u1@newhost:/tmp$

For security reason, I removed . from the $PATH, so I just use ./sqlite3 to launch

UPDATE BELOW:

this way works for Fedora 15 32-bit

[root@newhostfedora15 ~]# ./sqlite3 test.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .e

this also works on CentOS 5.6 64-bit

BUT DOES NOT work for root on My Ubuntu 12.04 64-bit either,

root@newhost:~# unzip sqlite-shell-linux-x86-3071300.zip
Archive:  sqlite-shell-linux-x86-3071300.zip
  inflating: sqlite3
root@newhost:~# ./sqlite3 f
-bash: ./sqlite3: No such file or directory
root@newhost:~# ldd ./sqlite3
        not a dynamic executable

I got this issue as the result, it works on Ubuntu 12.04 32-bit, CenetOS 5.6 64-bit, DOES NOT WORK on Ubuntu 12.04 64-bit, Fedora 17 64-bit, sqlite's 32-bit binary is great enough although it doesn't work for every platform. I'll keep it in mind that to it is best to compile my own 64-bit binary from the source or it will be awesome if sqlite 64-bit binary is provide through the official web-site :P

0

1 Answer 1

8

With Ubuntu (as well as many other Linux distributions) the preferred method of installing software is to use the package management infrastructure. One tool for package management on Ubuntu is apt-get.

For example, to install sqlite3:

sudo apt-get update
sudo apt-get install sqlite3

this will download the official Ubuntu build of sqlite, and install it on your system. This way, you don't have to deal with the downloading yourself, or debugging problems with incompatible binary versions.

[The first command, sudo apt-get update just downloads the most recent list of packages available. You don't need to do this every time you want to install a package]

Then, you can just run sqlite3:

sqlite3

In case you really want to run the non-packaged sqlite binary, you need to ensure you have all the necessary bits for your machine. The sqlite binary in the archive is a 32-bit dynamically linked executable (as you saw by running file), so we'll at least need a 32-bit dynamic linker, plus any necessary libraries.

For the dynamic linker, we need the i386 build of the libc6 package. You can install this with:

sudo apt-get install libc6:i386

Then, you should be able to run ldd on the binary to show what other libraries it may need. For example, on my system:

[jk@pablo sqlite]$ ldd ./sqlite3 
linux-gate.so.1 =>  (0xf76f1000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf76c1000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf750d000)
/lib/ld-linux.so.2 (0xf76f2000)

Since all of those libraries are present (ldd will report not found if something is missing), we should be fine to run the sqlite3 command.

10
  • Jeremy Kerr, thanks for your words, and I know apt-get isntall sqlite3 works :-), but I can't figure out why it does not work in the direct binary way of installation. I'll try this on Fedora and CentOS later.
    – vicd
    Jun 13, 2012 at 14:11
  • In this case, it's probably because the ELF binary is referencing a dynamic library (or dynamic linker) that isn't present on your system. ldd ./sqlite3 will tell you which libraries it requires. Jun 13, 2012 at 14:29
  • I forgot that I'm running a 64-bit, I think this may cause the issue, I'm checking now.... OMG, but it seems that there is no 64-bit binary file on their site. :D
    – vicd
    Jun 13, 2012 at 14:35
  • it's ok with 32-bit sqlite binary file running on 64-bit CentOS, I just tested this! So I'm taking your suggestion ldd to have a check on My Ubuntu 12.04 64-bit.
    – vicd
    Jun 13, 2012 at 14:42
  • 1
    ldd ./sqlite3 the result is : not a dynamic executable, Please see the update of my post, I'm checking if it works on Ubuntu 12.04 32-bit, OOOOOMMMGGG
    – vicd
    Jun 13, 2012 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .