lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, 06 Jan 2014 16:56:00 +0100, Gilles Ganault
<gilles.ganault@free.fr> wrote:
>gcc -O2 -fPIC -I/usr/include/lua5.1 -c lsqlite3.c -o lsqlite3.o
>-I/tmp/sqlite3/sqlite-amalgamation-3080200
>gcc -shared -o lsqlite3.so -L/usr/local/lib lsqlite3.o
>-L/usr/local/lib -lsqlite3
>/usr/bin/ld: cannot find -lsqlite3
>collect2: ld returned 1 exit status
>cp: cannot stat `lsqlite3.so': No such file or directory
>
>Error: Build error: Failed installing lsqlite3.so in
>/usr/local/lib/luarocks/rocks/lsqlite3/0.9.1-2/lib

That part is solved: For some reason, I had to rerun "apt-get update"
for apt-get to locate the package:
===========================
# apt-get install libsqlite3-dev

# luarocks install lsqlite3
SQLITE_INCDIR=/tmp/sqlite3/sqlite-amalgamation-3080200

# luarocks list

Installed rocks:
----------------

lsqlite3
   0.9.1-2 (installed) - /usr/local/lib/luarocks/rocks
===========================

But still no trace of the SQLite database file after calling this
script through a Lua-capable web server:
===========================
mg.write('HTTP/1.0 200 OK\r\n', 'Content-Type: text/plain\r\n',
'\r\n')
mg.write(os.date("%A"))

sqlite3 = require('lsqlite3')

local db = sqlite3.open('requests.db')

db:exec([[
  CREATE TABLE IF NOT EXISTS requests (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp NOT NULL,
    method NOT NULL,
    uri NOT NULL,
    addr
  );
]])

db:close()
===========================

It does display today's day, but no trace of "requests.db". Is there a
way to investigate what the problem is?