becls/swish

Problem with building

boris-olafrusen opened this issue · 4 comments

This is an error I get when building on archlinux(64), sqlite3 is present in the system:

$ make test
making mat-prereq ... sqlite3.c: In function ‘strftimeFunc’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (*)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:21748:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3ErrorWithMsg’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:29999:54: note: in expansion of macro ‘SQLITE_DYNAMIC’
sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3VdbeMemSetStr’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:74733:19: note: in expansion of macro ‘SQLITE_DYNAMIC’
}else if( xDel==SQLITE_DYNAMIC ){
^~~~~~~~~~~~~~
sqlite3.c: In function ‘valueFromExpr’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:75138:55: note: in expansion of macro ‘SQLITE_DYNAMIC’
sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:75181:29: note: in expansion of macro ‘SQLITE_DYNAMIC’
0, SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3VdbeExec’:
sqlite3.c:90038:38: error: cast between incompatible function types from ‘int (
)(u32, void , void , void )’ {aka ‘int ()(unsigned int, void , void , void )’} to ‘void ()(void , const char )’ [-Werror=cast-function-type]
void (x)(void,const char
) = (void(
)(void
,const char
))db->xTrace;
^
sqlite3.c: In function ‘printfFunc’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:111862:25: note: in expansion of macro ‘SQLITE_DYNAMIC’
SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c: In function ‘generateColumnNames’:
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:125011:58: note: in expansion of macro ‘SQLITE_DYNAMIC’
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c:13956:27: error: cast between incompatible function types from ‘int (
)(void )’ to ‘void ()(void )’ [-Werror=cast-function-type]
#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize)
^
sqlite3.c:125018:52: note: in expansion of macro ‘SQLITE_DYNAMIC’
sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC);
^~~~~~~~~~~~~~
sqlite3.c: In function ‘sqlite3InvokeBusyHandler’:
sqlite3.c:153340:12: error: cast between incompatible function types from ‘int (
)(void , int)’ to ‘int ()(void , int, sqlite3_file )’ {aka ‘int ()(void , int, struct sqlite3_file )’} [-Werror=cast-function-type]
xTra = (int(
)(void
,int,sqlite3_file
))p->xBusyHandler;
^
sqlite3.c: In function ‘sqlite3_busy_timeout’:
sqlite3.c:153418:30: error: cast between incompatible function types from ‘int (
)(void , int, sqlite3_file )’ {aka ‘int ()(void , int, struct sqlite3_file )’} to ‘int ()(void , int)’ [-Werror=cast-function-type]
sqlite3_busy_handler(db, (int(
)(void
,int))sqliteDefaultBusyCallback,
^
sqlite3.c: In function ‘sqlite3_trace’:
sqlite3.c:153759:16: error: cast between incompatible function types from ‘void (
)(void *, const char )’ to ‘int ()(u32, void *, void , void )’ {aka ‘int ()(unsigned int, void , void , void )’} [-Werror=cast-function-type]
db->xTrace = (int(
)(u32,void
,void
,void
))xTrace;
^
cc1: all warnings being treated as errors
make[2]: *** [Mf-a6le:26: sqlite3.o] Error 1
make[1]: *** [Makefile:132: mat-prereq] Error 2
make: *** [Makefile:17: test] Error 2

sqlite3.c comes from SQLite, so you might check https://sqlite.org for suggestions on how to compile it on archlinux(64). I suspect there is a compiler flag you can use to relax the function type warnings.

I managed to compile it separately with gcc -c -fpic sqlite3.c -o sqlite3.o -lpthread -ldl, thank you! Now everything went well is prompt supposed to show version number 0.0.0? Are there any extended examples apart from the documentation? how to run the web server included in the source?

It's important to include -DSQLITE_THREADSAFE=2 when you compile SQLite, and to add -DSQLITE_ENABLE_JSON1 if you want JSON support in SQL.

Yes, the version number is 0.0.0 for now because we're still working towards our first release.

We have one extended example in https://github.com/becls/convert-and-search.

Here's one way to start the web server:

$ cd src
$ ./go

Swish Version 0.0.0
> (http-port-number 8080)
> (app:start)
ok
>

very cool, thanks!