david-christiansen / IdrisSqlite

Effectful bindings for SQLite (forked from IdrisWeb)
MIT License
41 stars 6 forks source link

Does not build on OpenBSD #3

Open bonds opened 7 years ago

bonds commented 7 years ago
~/t/I/src (master|✚1) ❯❯❯ pwd                                               Mon 2017-08-07 12:59:10 -0700
/home/scott/tmp/IdrisSqlite/src
~/t/I/src (master|✚1) ❯❯❯ make -f MakefileC                                 Mon 2017-08-07 12:59:12 -0700
gcc -c sqlite3api.c
In file included from sqlite3api.c:11:
sqlite3api.h:12:21: error: sqlite3.h: No such file or directory
sqlite3api.h:14:16: error: gc.h: No such file or directory
In file included from sqlite3api.c:11:
sqlite3api.h:17: error: expected specifier-qualifier-list before 'sqlite3'
sqlite3api.h:29: error: expected specifier-qualifier-list before 'sqlite3'
sqlite3api.c: In function 'sqlite3_open_idr':
sqlite3api.c:28: error: 'sqlite3' undeclared (first use in this function)
sqlite3api.c:28: error: (Each undeclared identifier is reported only once
sqlite3api.c:28: error: for each function it appears in.)
sqlite3api.c:28: error: 'db' undeclared (first use in this function)
sqlite3api.c:31: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c:36: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c: In function 'sqlite3_close_idr':
sqlite3api.c:46: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:47: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_exec_idr':
sqlite3api.c:66: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:67: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c:68: error: 'DBinfo' has no member named 'buffer'
sqlite3api.c:68: error: 'DBinfo' has no member named 'buffer'
sqlite3api.c: In function 'sqlite3_get_error':
sqlite3api.c:80: error: 'DBinfo' has no member named 'buffer'
sqlite3api.c: In function 'idr_errcode':
sqlite3api.c:84: error: 'sqlite3' undeclared (first use in this function)
sqlite3api.c:84: error: 'sql_db' undeclared (first use in this function)
sqlite3api.c:84: error: expected expression before ')' token
sqlite3api.c: In function 'sqlite3_prepare_idr':
sqlite3api.c:94: error: 'sqlite3_stmt' undeclared (first use in this function)
sqlite3api.c:94: error: 'stmt' undeclared (first use in this function)
sqlite3api.c:99: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:100: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:101: error: 'DBinfo' has no member named 'Ptr_tail'
sqlite3api.c:103: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_get_table_idr':
sqlite3api.c:123: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:126: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c:127: error: 'DBinfo' has no member named 'buffer'
sqlite3api.c:127: error: 'DBinfo' has no member named 'buffer'
sqlite3api.c: In function 'exec_db':
sqlite3api.c:152: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:154: error: 'SQLITE_DONE' undeclared (first use in this function)
sqlite3api.c:157: error: 'SQLITE_ERROR' undeclared (first use in this function)
sqlite3api.c:157: error: 'SQLITE_MISUSE' undeclared (first use in this function)
sqlite3api.c:162: error: 'SQLITE_ROW' undeclared (first use in this function)
sqlite3api.c:164: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:168: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:169: error: 'DBinfo' has no member named 'row_count'
sqlite3api.c:170: error: 'DBinfo' has no member named 'col_count'
sqlite3api.c: In function 'sqlite3_get_num_row_v2':
sqlite3api.c:180: error: 'DBinfo' has no member named 'row_count'
sqlite3api.c: In function 'sqlite3_get_num_col_v2':
sqlite3api.c:190: error: 'DBinfo' has no member named 'col_count'
sqlite3api.c: In function 'sqlite3_get_data_type':
sqlite3api.c:239: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:240: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:243: error: 'SQLITE_ROW' undeclared (first use in this function)
sqlite3api.c:245: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:248: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_get_val_int':
sqlite3api.c:260: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_get_val_text':
sqlite3api.c:277: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:277: warning: assignment makes pointer from integer without a cast
sqlite3api.c: In function 'sqlite3_get_float':
sqlite3api.c:287: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_step_idr':
sqlite3api.c:304: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_bind_int_idr':
sqlite3api.c:317: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:318: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_bind_double_idr':
sqlite3api.c:331: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:333: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_bind_null_idr':
sqlite3api.c:343: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:344: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_bind_text_idr':
sqlite3api.c:355: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:355: error: 'SQLITE_STATIC' undeclared (first use in this function)
sqlite3api.c:356: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_column_count_idr':
sqlite3api.c:372: error: 'sqlite3_stmt' undeclared (first use in this function)
sqlite3api.c:372: error: 'stmt' undeclared (first use in this function)
sqlite3api.c:379: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:380: error: 'SQLITE_OK' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_data_count_idr':
sqlite3api.c:400: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_finalize_idr':
sqlite3api.c:411: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_reset_idr':
sqlite3api.c:428: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_column_name_idr':
sqlite3api.c:439: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:439: warning: initialization makes pointer from integer without a cast
sqlite3api.c: In function 'sqlite3_column_decltype_idr':
sqlite3api.c:446: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:446: warning: initialization makes pointer from integer without a cast
sqlite3api.c: In function 'sqlite3_column_bytes_idr':
sqlite3api.c:454: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_column_blob_idr':
sqlite3api.c:461: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:461: warning: initialization makes pointer from integer without a cast
sqlite3api.c: In function 'sqlite3_column_text_idr':
sqlite3api.c:467: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:467: warning: initialization makes pointer from integer without a cast
sqlite3api.c: In function 'sqlite3_column_int_idr':
sqlite3api.c:474: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_column_null_idr':
sqlite3api.c:483: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c:483: error: 'SQLITE_NULL' undeclared (first use in this function)
sqlite3api.c: In function 'sqlite3_column_double_idr':
sqlite3api.c:488: error: 'DBinfo' has no member named 'ppStmt'
sqlite3api.c: In function 'sqlite3_backup_init_idr':
sqlite3api.c:504: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:505: error: 'DBbackup' has no member named 'source_ptr'
sqlite3api.c:505: warning: initialization makes pointer from integer without a cast
sqlite3api.c:508: error: 'DBinfo' has no member named 'db_ptr'
sqlite3api.c:511: error: 'DBbackup' has no member named 'backup'
sqlite3api.c: In function 'sqlite3_backup_step_idr':
sqlite3api.c:520: error: 'DBbackup' has no member named 'backup'
sqlite3api.c: In function 'sqlite3_backup_finish_idr':
sqlite3api.c:528: error: 'DBbackup' has no member named 'backup'
sqlite3api.c: In function 'sqlite3_backup_remaining_idr':
sqlite3api.c:537: error: 'DBbackup' has no member named 'backup'
sqlite3api.c: In function 'sqlite3_backup_pagecount_idr':
sqlite3api.c:545: error: 'DBbackup' has no member named 'backup'
*** Error 1 in /home/scott/tmp/IdrisSqlite/src (MakefileC:6 'sqlite3api.o')
~/t/I/src (master|✚1)  [1] ❯❯❯ e MakefileC                                  Mon 2017-08-07 12:59:17 -0700

This diff fixes it for me:

diff --git a/src/MakefileC b/src/MakefileC
index 4c35b30..74d971b 100644
--- a/src/MakefileC
+++ b/src/MakefileC
@@ -1,8 +1,10 @@
+INC=-I /usr/local/include
+
 all : sqlite3api.o sqlite3api.so

 sqlite3api.o : sqlite3api.c sqlite3api.h
-       gcc -c sqlite3api.c
+       gcc -c sqlite3api.c $(INC)

 sqlite3api.so : sqlite3api.c sqlite3api.h
-       gcc -fPIC -o sqlite3api.so -shared sqlite3api.c
+       gcc -fPIC -o sqlite3api.so -shared sqlite3api.c $(INC)

But it probably breaks it for everyone else. ;) Any ideas on the 'right' way to add support for other OSes with other include directories to a Idris bindings library like this? I looked around at the other libraries and didn't see an example to follow, and I searched around for how to do this in general with C makefiles, but didn't find anything so far...