Closed laigor closed 2 years ago
Compilation fails because UNIXODBC is not defined. I don't know the correct way to solve this problem. To work around the problem, I use the following command to install luasql-odbc:
luarocks CFLAGS="-DUNIXODBC" install luasql-odbc
Hi laigor
This flag resolves the library against which the driver will be compiled. Note the code at the beginning of src/ls_odbc.c
Thus, if you have an unixodbc installation, that workaround should work, I think.
Regards, Tomás
Em dom., 26 de set. de 2021 às 11:23, laigor @.***> escreveu:
Compilation fails because UNIXODBC is not defined. I don't know the correct way to solve this problem. To work around the problem, I use the following command to install luasql-odbc: luarocks CFLAGS="-DUNIXODBC" install luasql-odbc
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Am I the only one who installs luasql-odbc in linux via luarocks? UNIXODBC should be detected automatically, or at least the documentation should indicate how to properly install luasql-odbc in Linux.
Hi
I don't know if you are the only user of luasql-odbc, sorry. Personally I use Postgres, and have almost no feedback from users.
Regards, Tomás
Em ter., 28 de set. de 2021 às 07:11, laigor @.***> escreveu:
Am I the only one who installs luasql-odbc in linux via luarocks? UNIXODBC should be detected automatically, or at least the documentation should indicate how to properly install luasql-odbc in Linux.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/keplerproject/luasql/issues/129#issuecomment-929049206, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAB3MMWT4V2CH2DLI3DD3UEGID5ANCNFSM5ETGKMYQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Same issue #131
Am I the only one who installs luasql-odbc in linux via luarocks?
No, you are not :-). I encountered the same issues you addressed with this issue today.
UNIXODBC should be detected automatically
This this was fixed meanwhile, but unfortunately there is no new version available on luraocks.org
that contains that fix. Would be really helpful if a new version could be released soon.
I've managed to install it by patching file manually
luarocks unpack luasql-odbc
cd luasql-odbc-2.6.0-1/luasql
nano src/ls_odbc.c
change line 19 from
#elif defined(UNIXODBC)
to
#else
luarocks make luasql-odbc-2.6.0-1.rockspec
and thats it.
ps.: It still throws some warnings
❯ luarocks make luasql-odbc-2.6.0-1.rockspec
gcc -O2 -fPIC -I/usr/include/lua5.2 -c src/luasql.c -o src/luasql.o -I/usr/include
gcc -O2 -fPIC -I/usr/include/lua5.2 -c src/ls_odbc.c -o src/ls_odbc.o -I/usr/include
src/ls_odbc.c: In function ‘raw_execute’:
src/ls_odbc.c:689:37: warning: passing argument 2 of ‘SQLRowCount’ from incompatible pointer type [-Wincompatible-pointer-types]
689 | if(error(SQLRowCount(stmt->hstmt, &numrows))) {
| ^~~~~~~~
| |
| SQLINTEGER * {aka int *}
In file included from src/ls_odbc.c:20:
/usr/include/sql.h:768:44: note: expected ‘SQLLEN *’ {aka ‘long int *’} but argument is of type ‘SQLINTEGER *’ {aka ‘int *’}
768 | SQLLEN *RowCount);
| ~~~~~~~~^~~~~~~~
src/ls_odbc.c: In function ‘set_param’:
src/ls_odbc.c:707:57: warning: passing argument 10 of ‘SQLBindParameter’ from incompatible pointer type [-Wincompatible-pointer-types]
707 | SQL_DOUBLE, 0, 0, NULL, 0, &cbNull))) {
| ^~~~~~~
| |
| SQLINTEGER * {aka int *}
In file included from src/ls_odbc.c:22:
/usr/include/sqlext.h:2049:21: note: expected ‘SQLLEN *’ {aka ‘long int *’} but argument is of type ‘SQLINTEGER *’ {aka ‘int *’}
2049 | SQLLEN *pcbValue);
| ~~~~~~~~~~~~~~~~^~~~~~~~
src/ls_odbc.c:723:30: warning: passing argument 10 of ‘SQLBindParameter’ from incompatible pointer type [-Wincompatible-pointer-types]
723 | &data->type))) {
| ^~~~~~~~~~~
| |
| SQLINTEGER * {aka int *}
In file included from src/ls_odbc.c:22:
/usr/include/sqlext.h:2049:21: note: expected ‘SQLLEN *’ {aka ‘long int *’} but argument is of type ‘SQLINTEGER *’ {aka ‘int *’}
2049 | SQLLEN *pcbValue);
| ~~~~~~~~~~~~~~~~^~~~~~~~
src/ls_odbc.c:742:30: warning: passing argument 10 of ‘SQLBindParameter’ from incompatible pointer type [-Wincompatible-pointer-types]
742 | &data->type))) {
| ^~~~~~~~~~~
| |
| SQLINTEGER * {aka int *}
In file included from src/ls_odbc.c:22:
/usr/include/sqlext.h:2049:21: note: expected ‘SQLLEN *’ {aka ‘long int *’} but argument is of type ‘SQLINTEGER *’ {aka ‘int *’}
2049 | SQLLEN *pcbValue);
| ~~~~~~~~~~~~~~~~^~~~~~~~
src/ls_odbc.c:758:30: warning: passing argument 10 of ‘SQLBindParameter’ from incompatible pointer type [-Wincompatible-pointer-types]
758 | &data->type))) {
| ^~~~~~~~~~~
| |
| SQLINTEGER * {aka int *}
In file included from src/ls_odbc.c:22:
/usr/include/sqlext.h:2049:21: note: expected ‘SQLLEN *’ {aka ‘long int *’} but argument is of type ‘SQLINTEGER *’ {aka ‘int *’}
2049 | SQLLEN *pcbValue);
| ~~~~~~~~~~~~~~~~^~~~~~~~
gcc -shared -o luasql/odbc.so -L/usr/local/lib src/luasql.o src/ls_odbc.o -L/usr/lib -Wl,-rpath,/usr/lib: -lodbc
luasql-odbc 2.6.0-1 is now installed in /usr/local (license: MIT/X11)
installed :