1

I'm trying to use sqlite3 with lua (am already using c++, but I'm a n00b with lua- I read this) but I'm getting the following when trying to build the library or whatever:

C:\lib\lsqlite3-7>mingw32-make
process_begin: CreateProcess(NULL, pkg-config --version, ...) failed.
makefile:53: *** windows32.  Stop.

I'm not at all surprised at a makefile failing but I can't do them (is it spaces or tabs? where is it they have to go?), I would have thought there was a binary for windows?

Any simple answers appreciated. I haven't got the time to learn make or install cygwin or whatever.

1 Answer 1

1

You might consider using LuaSQL as your wrapper instead, since it is already included in the Lua for Windows package and so it is likely already on your system. It includes support for SQLite3 among other databases.

It does look like you are trying to build the latest release of lsqlite3, but that this release was not packaged to be easily built on or for Windows. I didn't attempt to track down a binary since LuaForge only has a source package. It looks like building it successfully will require manually editing the Makefile, and then running the Makefile under either MSYS or Cygwin so that the *nix utilities it assumes exist are available to it.

Update: June, 2012

Since writing this answer, I've had occasion to consider using lsqlite3 myself for a project that will not require the flexibility of binding to many distinct database providers, so building in a tight dependency on SQLite makes sense. Given that, the lsqlite3 wrapper is a good fit due to its small size and clean implementation of a lot of the important bits of the SQLite C API.

To build it, I used MSYS which provides a minimal unix-like command prompt and supporting utilities for use with the MinGW port of GCC. In that environment, I had to make a small modification to the Makefile to force it to use manual configuration, and to provide the configuration details identifying where lua.h, lua51.dll, sqlite3.h, and sqlite3.dll were hiding on my system.

The only real trick to that is to correctly map Windows path names to MSYS path names by changing C: to /c/, and to avoid using any folder names with spaces in them. So with Lua for Windows on C:\Program Files (x86)\Lua\5.1, that maps to /c/PROGRA~2/Lua/5.1, using the Windows 8.3 short name to avoid the spaces.

A key point to recommend MSYS over other unix-like build environments on Windows is that it is specifically intended for this purpose. The programs and DLLs build from it are free of any unexpected dependencies. Specifically, this is unlike Cygwin which is intended to provide a complete unix-like experience layered on top of Windows.

With lsqlite3.dll freshly built, all I had to do was install it somewhere on my Lua package.cpath along with sqlite3.dll and the examples and test cases all appear to work.

Sign up to request clarification or add additional context in comments.

3 Comments

Right, I made the Makefile to work with Mingw/MSYS. You can also build using the lsqlite3 rockspec's "builtin" target if luarocks is installed in such a way that it can build binaries.
Hi, sorry for the delay but recreational programming has had to take a back seat. I'lll try Lua for windows when I get the chance. Thanks for the tip.
Example luasql code works if you substitute sqlite3 for postgres in the example code of lua for windows. Get it at code.google.com/p/luaforwindows/downloads/list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.