lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
535 stars 192 forks source link

Error in making #67

Closed afshar-mohammad closed 7 years ago

afshar-mohammad commented 7 years ago

gcc -O2 -std=gnu99 -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic -fPIC -I/usr/include/lua5.1 -DLUASQL_VERSION_NUMBER='"2.3.4"' -c src/luasql.c -o src/luasql.o gcc -O2 -std=gnu99 -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic -fPIC -I/usr/include/lua5.1 -DLUASQL_VERSION_NUMBER='"2.3.4"' src/ls_mysql.c -o src/mysql.so -shared src/luasql.o -I/usr/include/mysql -L/usr/lib -lmysqlclient -lz src/ls_mysql.c:19:19: error: mysql.h: No such file or directory src/ls_mysql.c:69: error: expected specifier-qualifier-list before ‘MYSQL’ src/ls_mysql.c:77: error: expected specifier-qualifier-list before ‘MYSQL_RES’ src/ls_mysql.c:130: warning: ISO C forbids forward references to ‘enum’ types src/ls_mysql.c:130: warning: ‘enum enum_field_types’ declared inside parameter list src/ls_mysql.c:130: warning: its scope is only this definition or declaration, which is probably not what you want src/ls_mysql.c:130: error: parameter 1 (‘type’) has incomplete type src/ls_mysql.c: In function ‘getcolumntype’: src/ls_mysql.c:133: error: ‘FIELD_TYPE_VAR_STRING’ undeclared (first use in this function) src/ls_mysql.c:133: error: (Each undeclared identifier is reported only once src/ls_mysql.c:133: error: for each function it appears in.) src/ls_mysql.c:133: error: ‘FIELD_TYPE_STRING’ undeclared (first use in this function) src/ls_mysql.c:135: error: ‘FIELD_TYPE_DECIMAL’ undeclared (first use in this function) src/ls_mysql.c:135: error: ‘FIELD_TYPE_SHORT’ undeclared (first use in this function) src/ls_mysql.c:135: error: ‘FIELD_TYPE_LONG’ undeclared (first use in this function) src/ls_mysql.c:136: error: ‘FIELD_TYPE_FLOAT’ undeclared (first use in this function) src/ls_mysql.c:136: error: ‘FIELD_TYPE_DOUBLE’ undeclared (first use in this function) src/ls_mysql.c:136: error: ‘FIELD_TYPE_LONGLONG’ undeclared (first use in this function) src/ls_mysql.c:137: error: ‘FIELD_TYPE_INT24’ undeclared (first use in this function) src/ls_mysql.c:137: error: ‘FIELD_TYPE_YEAR’ undeclared (first use in this function) src/ls_mysql.c:137: error: ‘FIELD_TYPE_TINY’ undeclared (first use in this function) src/ls_mysql.c:139: error: ‘FIELD_TYPE_TINY_BLOB’ undeclared (first use in this function) src/ls_mysql.c:139: error: ‘FIELD_TYPE_MEDIUM_BLOB’ undeclared (first use in this function) src/ls_mysql.c:140: error: ‘FIELD_TYPE_LONG_BLOB’ undeclared (first use in this function) src/ls_mysql.c:140: error: ‘FIELD_TYPE_BLOB’ undeclared (first use in this function) src/ls_mysql.c:142: error: ‘FIELD_TYPE_DATE’ undeclared (first use in this function) src/ls_mysql.c:142: error: ‘FIELD_TYPE_NEWDATE’ undeclared (first use in this function) src/ls_mysql.c:144: error: ‘FIELD_TYPE_DATETIME’ undeclared (first use in this function) src/ls_mysql.c:146: error: ‘FIELD_TYPE_TIME’ undeclared (first use in this function) src/ls_mysql.c:148: error: ‘FIELD_TYPE_TIMESTAMP’ undeclared (first use in this function) src/ls_mysql.c:150: error: ‘FIELD_TYPE_ENUM’ undeclared (first use in this function) src/ls_mysql.c:150: error: ‘FIELD_TYPE_SET’ undeclared (first use in this function) src/ls_mysql.c:152: error: ‘FIELD_TYPE_NULL’ undeclared (first use in this function) src/ls_mysql.c: In function ‘create_colinfo’: src/ls_mysql.c:164: error: ‘MYSQL_FIELD’ undeclared (first use in this function) src/ls_mysql.c:164: error: ‘fields’ undeclared (first use in this function) src/ls_mysql.c:167: warning: implicit declaration of function ‘mysql_fetch_fields’ src/ls_mysql.c:167: error: ‘cur_data’ has no member named ‘my_res’ src/ls_mysql.c:173: error: type of formal parameter 1 is incomplete src/ls_mysql.c: In function ‘cur_nullify’: src/ls_mysql.c:189: warning: implicit declaration of function ‘mysql_free_result’ src/ls_mysql.c:189: error: ‘cur_data’ has no member named ‘my_res’ src/ls_mysql.c: In function ‘cur_fetch’: src/ls_mysql.c:201: error: ‘MYSQL_RES’ undeclared (first use in this function) src/ls_mysql.c:201: error: ‘res’ undeclared (first use in this function) src/ls_mysql.c:201: error: ‘cur_data’ has no member named ‘my_res’ src/ls_mysql.c:203: error: ‘MYSQL_ROW’ undeclared (first use in this function) src/ls_mysql.c:203: error: expected ‘;’ before ‘row’ src/ls_mysql.c:204: error: ‘row’ undeclared (first use in this function) src/ls_mysql.c:209: warning: implicit declaration of function ‘mysql_fetch_lengths’ src/ls_mysql.c: In function ‘cur_numrows’: src/ls_mysql.c:319: warning: implicit declaration of function ‘mysql_num_rows’ src/ls_mysql.c:319: error: ‘cur_data’ has no member named ‘my_res’ src/ls_mysql.c: At top level: src/ls_mysql.c:327: error: expected declaration specifiers or ‘...’ before ‘MYSQL_RES’ src/ls_mysql.c: In function ‘create_cursor’: src/ls_mysql.c:337: error: ‘cur_data’ has no member named ‘my_res’ src/ls_mysql.c:337: error: ‘result’ undeclared (first use in this function) src/ls_mysql.c: In function ‘conn_gc’: src/ls_mysql.c:351: warning: implicit declaration of function ‘mysql_close’ src/ls_mysql.c:351: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘escape_string’: src/ls_mysql.c:380: warning: implicit declaration of function ‘mysql_real_escape_string’ src/ls_mysql.c:380: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘conn_execute’: src/ls_mysql.c:398: warning: implicit declaration of function ‘mysql_real_query’ src/ls_mysql.c:398: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:400: warning: implicit declaration of function ‘mysql_error’ src/ls_mysql.c:400: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:403: error: ‘MYSQL_RES’ undeclared (first use in this function) src/ls_mysql.c:403: error: ‘res’ undeclared (first use in this function) src/ls_mysql.c:403: warning: implicit declaration of function ‘mysql_store_result’ src/ls_mysql.c:403: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:404: warning: implicit declaration of function ‘mysql_field_count’ src/ls_mysql.c:404: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:407: error: too many arguments to function ‘create_cursor’ src/ls_mysql.c:412: warning: implicit declaration of function ‘mysql_affected_rows’ src/ls_mysql.c:412: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:416: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘conn_commit’: src/ls_mysql.c:427: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘conn_rollback’: src/ls_mysql.c:437: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘conn_setautocommit’: src/ls_mysql.c:448: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:451: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: In function ‘conn_getlastautoid’: src/ls_mysql.c:463: warning: implicit declaration of function ‘mysql_insert_id’ src/ls_mysql.c:463: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c: At top level: src/ls_mysql.c:470: error: expected declaration specifiers or ‘...’ before ‘MYSQL’ src/ls_mysql.c: In function ‘create_connection’: src/ls_mysql.c:477: error: ‘conn_data’ has no member named ‘my_conn’ src/ls_mysql.c:477: error: ‘my_conn’ undeclared (first use in this function) src/ls_mysql.c: In function ‘env_connect’: src/ls_mysql.c:495: error: ‘MYSQL’ undeclared (first use in this function) src/ls_mysql.c:495: error: ‘conn’ undeclared (first use in this function) src/ls_mysql.c:499: warning: implicit declaration of function ‘mysql_init’ src/ls_mysql.c:503: warning: implicit declaration of function ‘mysql_real_connect’ src/ls_mysql.c:511: error: too many arguments to function ‘create_connection’ src/ls_mysql.c: In function ‘luaopen_luasql_mysql’: src/ls_mysql.c:605: error: expected ‘)’ before ‘MYSQL_SERVER_VERSION’ src/ls_mysql.c:605: error: too few arguments to function ‘lua_pushlstring’ make: *** [src/mysql.so] Error 1

tomasguisasola commented 7 years ago

Very difficult to understand your problem, which is quite simple. The really important message is:

src/ls_mysql.c:19:19: error: mysql.h: No such file or directory

Thus, you have to correct the include path informed to the compiler: "-I/usr/include/mysql" is not working ("-I/usr/include/mysql/mysql.h" works in my installation).

The command "locate mysql.h" should tell you where the file is. If there is no such file you'll have to install it ("sudo apt-get install libmysqlclient-dev" works for me).