Closed thchha closed 4 years ago
Hey @thchha !
I've updated the code. Please pull it an try again.
It seems, the sqlite3_exec wasn't the problem. I was still using the "old lua module system". Starting from 5.2 lua hat a compile time flag LUA_COMPAT_MODULE which made this available. But it seems not to be working anymore... hmpf...
The actual solution works on my debian with your sqlite3-dev version and lua 5.1, 5.2 and 5.3. (See the Makefile.)
Please let me know if this solves it for you.
;-)
Btw., loading the library has changed:
lsqlite = require("lsqlite")
local db = lsqlite.open("database.db")
-- ...
Thanks @maxdoom-com!!!
You solved my problems - The resulting shared libraries work for each version: lua 5.1
, lua 5.2
and lua5.3
! :tada: :grinning: :muscle:
Nonetheless, the resulting libraries only work when compiled with gcc-8
.
Version 9
and 10
and c99
do not result in functional libraries.
I am fairly new to C, so I am not able to contribute an patch yet, but I will revisit this issue, once I get more familiar with compilers. c99
also comes with two additional warnings, (without `-Wpedantic).
Again, thanks for your very fast fix!!
:happy:
c99 is a bigger issue. the code is c89 style by intention.
i wrote this library twice, first in a more modern style until i realised that, when i'm using an elder style, where "inline c procedures" (or whatever they are called) the code shrinks very much. this feature was removed with c90 standart and is nowadays only an extension of gcc.
here an example:
int foo(int a, int b)
{
int bar()
{
return a+b;
}
return bar();
}
i will try to check the compiler flags of gcc 9/10 how to properly address them.
hi, again @thchha !
i figured it out. it's some kind of problem between gcc-9/-10 and the sqlite3.so on debian. maybe on other systems as well.
you may compile the library with gcc-9/-10 by including sqlite in the compilation process this way:
make -f Makefile-Amalgamed
the resulting lsqlite.so is much larger, but it works. the reason for the larger size is, that we are not using the sqlite3.so from debian but our own compiled in.
hope this helps ;-)
Hey, thanks for your library - satisfies exactly my needs! :- )
I can't build your library on Debian
bullseye
AMD64, which only comes with > gcc-8.After building and referencing the
.so
, my scripts report an error, same for the provided test.lua:So i tried compiling with
gcc-8
,9
,10
,c99
, withlua 5.1
andlua 5.3 (including compat)
. When compiling withlua 5.3
,luaL_open
can not be found.where
libsqllite3-dev
is the version3.31.1-5
. on ARM64 (using Lua5.1 || 5.3
) version:3.27.2-3
it is working as expected! :+1:Before asking, i checked the news on sqlite.org. The function sqlite_exec() is still listed in their API, so I am not able to resolve this on my own :- (