Advice on building luasql please

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Advice on building luasql please

Simon Orde-2

Hi

 

I emailed a question about this to the Kepler project but have heard nothing, so I thought I’d try here.  I have been trying to build luasql drivers for sqlite3, mysql, sqlite and odbc, using luarocks, without success.  I have installed luarocks and have successfully managed to build various other lua modules with it.  But if I try and install any of the luasql modules, I get errors.

 

I am building in a Visual Studio 2017 environment, in a command shell on Windows 10,  with paths etc, set up correctly, I believe.  I am building for lua5.3.  If I run the command “luarocks53 install lua-sqlite3” I get this error message:

 

Error: Could not find header file for SQLITE

  No file sqlite3.h in c:/external/include

You may have to install SQLITE in your system and/or pass SQLITE_DIR or SQLITE_INCDIR to the luarocks command.

Example: luarocks install luasql-sqlite3 SQLITE_DIR=/usr/local

 

This suggests that I need to install SQLITE first.  However, if I run command “luarocks53 install sqlite” it says “Error: no results matching query were found”.  If I run the command “luarocks53 install sqlite3” I get the same error message that I got when I tried to install luasql-sqlite3.

 

I’ve tried looking on the SQLITE site but can’t work out what I need to download to get the build to work.  Can anyone tell me what I need to do to get the install to work for sqlite3 please?  And also for ODBC and MySql?  I get similar errors for them.

 

Thanks in advance

 

Simon

 

Reply | Threaded
Open this post in threaded view
|

Re: Advice on building luasql please

Tomás Guisasola-2
Hi Simon

> I am building in a Visual Studio 2017 environment, in a command shell on Windows 10,  with paths etc, set up correctly, I believe.  I am building for lua5.3.  If I run the command “luarocks53 install lua-sqlite3” I get this error message:
>
> Error: Could not find header file for SQLITE
>   No file sqlite3.h in c:/external/include
> You may have to install SQLITE in your system and/or pass SQLITE_DIR or SQLITE_INCDIR to the luarocks command.
> Example: luarocks install luasql-sqlite3 SQLITE_DIR=/usr/local
>
> This suggests that I need to install SQLITE first.
Yes, you do.

>  However, if I run command “luarocks53 install sqlite” it says “Error: no results matching query were found”.  If I run the command “luarocks53 install sqlite3” I get the same error message that I got when I tried to install luasql-sqlite3.
LuaRocks cannot install SQLite.  You have to install it using another
tool since it is not related to Lua. The same aplies to other SGBDs
you may be interested in.

> I’ve tried looking on the SQLITE site but can’t work out what I need to download to get the build to work.  Can anyone tell me what I need to do to get the install to work for sqlite3 please?  And also for ODBC and MySql?  I get similar errors for them.
It seems you didn't understand what the drivers mean.  I'll try to
explain.  The SGBDs are tools made to work over your OS.  They usually
provide an optional interface to some languages to allow programs to
communicate to the SGBD, but Lua is not one of them.  Thus, the LuaSQL
drivers do this job.  They are written in C, using two interfaces,
Lua's C API and the database C API, and they establish these bridge
over the two systems: the SGBD and Lua.

That said, to compile and build any LuaSQL driver you have to install
Lua C API library (where you'll find lua.h etc.) and the SGBD C API
library (where you'll find sqlite3.h, for instance).  And tell
LuaRocks where these files could be found by using SQLITE_INCDIR.
When installing LuaRocks you already configured it to find Lua's
files.

Regards,
Tomás

Reply | Threaded
Open this post in threaded view
|

RE: Advice on building luasql please

Simon Orde-2
Hi Tomas

Thanks for the post.  I presume when you say "SGBD" you mean what I would call "DBMS"?  I know what a DBMS is.  You say "you have to install ... the SGBD C API library (where you'll find sqlite3.h, for instance). "  So you're saying that I have to install the SQLite C API library - right?  OK - well that's what I cannot do.

I have downloaded just about every zip file I can find on the SQLite website.  Between them I can put together a folder that contains sqlite3.h, sqlite3.dll, and sqlite3.def (I got the sqlite3.h from the source code zip).  But when I try to build against this folder using luarocks (with SQLITE_DIR pointing to this folder) I get a link error because it cannot find 'sqlite3.lib'.  And neither can I.  I haven't found a sqlite3.lib file anywhere.

According to this StackOverflow page - https://stackoverflow.com/questions/23718146/creating-an-sqlite3-lib-file-using-sqlite3-in-visual-studios - "The suggested way of using the SQLite library is to embed it directly in your application, i.e., download the amalgamation source code, and just add the sqlite3.c and .h files to your project in the sample place where you have the other source files."  Except that I can't do that because I'm not trying to embed the SQLite library into my application.  I'm trying to build a luasql dll that has SQLite embedded in it.  

Any suggestions about where I can find the files I need (e.g. sqlite3.lib and the version of sqlite3.h and sqlite3.dll that go with it) to build the luasql sqlite3 dll?

Failing that, does anyone already have the binaries I need?  i.e. ones that are compatible with Visual Studio 2017?

All help much appreciated.

Simon


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Tomás Guisasola
Sent: 29 May 2019 2:29 PM
To: Lua mailing list
Subject: Re: Advice on building luasql please

Hi Simon

> I am building in a Visual Studio 2017 environment, in a command shell on Windows 10,  with paths etc, set up correctly, I believe.  I am building for lua5.3.  If I run the command “luarocks53 install lua-sqlite3” I get this error message:
>
> Error: Could not find header file for SQLITE
>   No file sqlite3.h in c:/external/include
> You may have to install SQLITE in your system and/or pass SQLITE_DIR or SQLITE_INCDIR to the luarocks command.
> Example: luarocks install luasql-sqlite3 SQLITE_DIR=/usr/local
>
> This suggests that I need to install SQLITE first.
Yes, you do.

>  However, if I run command “luarocks53 install sqlite” it says “Error: no results matching query were found”.  If I run the command “luarocks53 install sqlite3” I get the same error message that I got when I tried to install luasql-sqlite3.
LuaRocks cannot install SQLite.  You have to install it using another
tool since it is not related to Lua. The same aplies to other SGBDs
you may be interested in.

> I’ve tried looking on the SQLITE site but can’t work out what I need to download to get the build to work.  Can anyone tell me what I need to do to get the install to work for sqlite3 please?  And also for ODBC and MySql?  I get similar errors for them.
It seems you didn't understand what the drivers mean.  I'll try to
explain.  The SGBDs are tools made to work over your OS.  They usually
provide an optional interface to some languages to allow programs to
communicate to the SGBD, but Lua is not one of them.  Thus, the LuaSQL
drivers do this job.  They are written in C, using two interfaces,
Lua's C API and the database C API, and they establish these bridge
over the two systems: the SGBD and Lua.

That said, to compile and build any LuaSQL driver you have to install
Lua C API library (where you'll find lua.h etc.) and the SGBD C API
library (where you'll find sqlite3.h, for instance).  And tell
LuaRocks where these files could be found by using SQLITE_INCDIR.
When installing LuaRocks you already configured it to find Lua's
files.

Regards,
Tomás


Reply | Threaded
Open this post in threaded view
|

Re: Advice on building luasql please

Jonathan Goble
I'm not familiar with doing this, but try this link:
https://raginginverno.wordpress.com/2013/01/23/welcome/ It explains
how to generate a .lib file from the .def file. Seems pretty
straightforward.

For the record, the issue here is that when you compile a DLL in
Visual Studio, VS generates both a .dll file and a .lib file. The
library actually resides in the .dll file, but in order to link a
program or another library to that DLL, you need to point it to the
.lib file, which contains the symbols and other information needed for
successful linkage.

On Wed, May 29, 2019 at 12:54 PM Simon Orde
<[hidden email]> wrote:

>
> Hi Tomas
>
> Thanks for the post.  I presume when you say "SGBD" you mean what I would call "DBMS"?  I know what a DBMS is.  You say "you have to install ... the SGBD C API library (where you'll find sqlite3.h, for instance). "  So you're saying that I have to install the SQLite C API library - right?  OK - well that's what I cannot do.
>
> I have downloaded just about every zip file I can find on the SQLite website.  Between them I can put together a folder that contains sqlite3.h, sqlite3.dll, and sqlite3.def (I got the sqlite3.h from the source code zip).  But when I try to build against this folder using luarocks (with SQLITE_DIR pointing to this folder) I get a link error because it cannot find 'sqlite3.lib'.  And neither can I.  I haven't found a sqlite3.lib file anywhere.
>
> According to this StackOverflow page - https://stackoverflow.com/questions/23718146/creating-an-sqlite3-lib-file-using-sqlite3-in-visual-studios - "The suggested way of using the SQLite library is to embed it directly in your application, i.e., download the amalgamation source code, and just add the sqlite3.c and .h files to your project in the sample place where you have the other source files."  Except that I can't do that because I'm not trying to embed the SQLite library into my application.  I'm trying to build a luasql dll that has SQLite embedded in it.
>
> Any suggestions about where I can find the files I need (e.g. sqlite3.lib and the version of sqlite3.h and sqlite3.dll that go with it) to build the luasql sqlite3 dll?
>
> Failing that, does anyone already have the binaries I need?  i.e. ones that are compatible with Visual Studio 2017?
>
> All help much appreciated.
>
> Simon
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Tomás Guisasola
> Sent: 29 May 2019 2:29 PM
> To: Lua mailing list
> Subject: Re: Advice on building luasql please
>
> Hi Simon
>
> > I am building in a Visual Studio 2017 environment, in a command shell on Windows 10,  with paths etc, set up correctly, I believe.  I am building for lua5.3.  If I run the command “luarocks53 install lua-sqlite3” I get this error message:
> >
> > Error: Could not find header file for SQLITE
> >   No file sqlite3.h in c:/external/include
> > You may have to install SQLITE in your system and/or pass SQLITE_DIR or SQLITE_INCDIR to the luarocks command.
> > Example: luarocks install luasql-sqlite3 SQLITE_DIR=/usr/local
> >
> > This suggests that I need to install SQLITE first.
> Yes, you do.
>
> >  However, if I run command “luarocks53 install sqlite” it says “Error: no results matching query were found”.  If I run the command “luarocks53 install sqlite3” I get the same error message that I got when I tried to install luasql-sqlite3.
> LuaRocks cannot install SQLite.  You have to install it using another
> tool since it is not related to Lua. The same aplies to other SGBDs
> you may be interested in.
>
> > I’ve tried looking on the SQLITE site but can’t work out what I need to download to get the build to work.  Can anyone tell me what I need to do to get the install to work for sqlite3 please?  And also for ODBC and MySql?  I get similar errors for them.
> It seems you didn't understand what the drivers mean.  I'll try to
> explain.  The SGBDs are tools made to work over your OS.  They usually
> provide an optional interface to some languages to allow programs to
> communicate to the SGBD, but Lua is not one of them.  Thus, the LuaSQL
> drivers do this job.  They are written in C, using two interfaces,
> Lua's C API and the database C API, and they establish these bridge
> over the two systems: the SGBD and Lua.
>
> That said, to compile and build any LuaSQL driver you have to install
> Lua C API library (where you'll find lua.h etc.) and the SGBD C API
> library (where you'll find sqlite3.h, for instance).  And tell
> LuaRocks where these files could be found by using SQLITE_INCDIR.
> When installing LuaRocks you already configured it to find Lua's
> files.
>
> Regards,
> Tomás
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Advice on building luasql please

Tomás Guisasola-2
Hi Simon and Jonathan

Sorry for the mistake.  I should have written DBMS, sure :-)

I think Jonathan message explains everything you need to do.  Hope it works!

Regards,
Tomás

Em qua, 29 de mai de 2019 às 14:17, Jonathan Goble
<[hidden email]> escreveu:

>
> I'm not familiar with doing this, but try this link:
> https://raginginverno.wordpress.com/2013/01/23/welcome/ It explains
> how to generate a .lib file from the .def file. Seems pretty
> straightforward.
>
> For the record, the issue here is that when you compile a DLL in
> Visual Studio, VS generates both a .dll file and a .lib file. The
> library actually resides in the .dll file, but in order to link a
> program or another library to that DLL, you need to point it to the
> .lib file, which contains the symbols and other information needed for
> successful linkage.
>
> On Wed, May 29, 2019 at 12:54 PM Simon Orde
> <[hidden email]> wrote:
> >
> > Hi Tomas
> >
> > Thanks for the post.  I presume when you say "SGBD" you mean what I would call "DBMS"?  I know what a DBMS is.  You say "you have to install ... the SGBD C API library (where you'll find sqlite3.h, for instance). "  So you're saying that I have to install the SQLite C API library - right?  OK - well that's what I cannot do.
> >
> > I have downloaded just about every zip file I can find on the SQLite website.  Between them I can put together a folder that contains sqlite3.h, sqlite3.dll, and sqlite3.def (I got the sqlite3.h from the source code zip).  But when I try to build against this folder using luarocks (with SQLITE_DIR pointing to this folder) I get a link error because it cannot find 'sqlite3.lib'.  And neither can I.  I haven't found a sqlite3.lib file anywhere.
> >
> > According to this StackOverflow page - https://stackoverflow.com/questions/23718146/creating-an-sqlite3-lib-file-using-sqlite3-in-visual-studios - "The suggested way of using the SQLite library is to embed it directly in your application, i.e., download the amalgamation source code, and just add the sqlite3.c and .h files to your project in the sample place where you have the other source files."  Except that I can't do that because I'm not trying to embed the SQLite library into my application.  I'm trying to build a luasql dll that has SQLite embedded in it.
> >
> > Any suggestions about where I can find the files I need (e.g. sqlite3.lib and the version of sqlite3.h and sqlite3.dll that go with it) to build the luasql sqlite3 dll?
> >
> > Failing that, does anyone already have the binaries I need?  i.e. ones that are compatible with Visual Studio 2017?
> >
> > All help much appreciated.
> >
> > Simon
> >
> >
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Tomás Guisasola
> > Sent: 29 May 2019 2:29 PM
> > To: Lua mailing list
> > Subject: Re: Advice on building luasql please
> >
> > Hi Simon
> >
> > > I am building in a Visual Studio 2017 environment, in a command shell on Windows 10,  with paths etc, set up correctly, I believe.  I am building for lua5.3.  If I run the command “luarocks53 install lua-sqlite3” I get this error message:
> > >
> > > Error: Could not find header file for SQLITE
> > >   No file sqlite3.h in c:/external/include
> > > You may have to install SQLITE in your system and/or pass SQLITE_DIR or SQLITE_INCDIR to the luarocks command.
> > > Example: luarocks install luasql-sqlite3 SQLITE_DIR=/usr/local
> > >
> > > This suggests that I need to install SQLITE first.
> > Yes, you do.
> >
> > >  However, if I run command “luarocks53 install sqlite” it says “Error: no results matching query were found”.  If I run the command “luarocks53 install sqlite3” I get the same error message that I got when I tried to install luasql-sqlite3.
> > LuaRocks cannot install SQLite.  You have to install it using another
> > tool since it is not related to Lua. The same aplies to other SGBDs
> > you may be interested in.
> >
> > > I’ve tried looking on the SQLITE site but can’t work out what I need to download to get the build to work.  Can anyone tell me what I need to do to get the install to work for sqlite3 please?  And also for ODBC and MySql?  I get similar errors for them.
> > It seems you didn't understand what the drivers mean.  I'll try to
> > explain.  The SGBDs are tools made to work over your OS.  They usually
> > provide an optional interface to some languages to allow programs to
> > communicate to the SGBD, but Lua is not one of them.  Thus, the LuaSQL
> > drivers do this job.  They are written in C, using two interfaces,
> > Lua's C API and the database C API, and they establish these bridge
> > over the two systems: the SGBD and Lua.
> >
> > That said, to compile and build any LuaSQL driver you have to install
> > Lua C API library (where you'll find lua.h etc.) and the SGBD C API
> > library (where you'll find sqlite3.h, for instance).  And tell
> > LuaRocks where these files could be found by using SQLITE_INCDIR.
> > When installing LuaRocks you already configured it to find Lua's
> > files.
> >
> > Regards,
> > Tomás
> >
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: Advice on building luasql please

Hugo Musso Gualandi
In reply to this post by Simon Orde-2
>  "SGBD" you mean what I would call "DBMS"?

Database Management System is "Sistema Gerenciador de Banco de Dados"
in Portuguese :)


Reply | Threaded
Open this post in threaded view
|

Re: Advice on building luasql please

Ignacio Burgueño-2
In reply to this post by Simon Orde-2
A million years ago I was using this script to download, build sqlite3 and luasql.sqlite3.
Please review it before running it because it has lots of hardcoded paths that don't make sense outside my machine.

Hope this helps.