SQLite Forum

How to compile an extension from scratch? The CSV virtual table in particular
Login
I'm trying to get the CSV virtual table working as per example on <https://www.sqlite.org/csv.html>:

```
.load ./csv
CREATE VIRTUAL TABLE temp.t1 USING csv(filename='thefile.csv');
SELECT * FROM t1;
```

But I don't understand the compilation process. I'm on MacOS and installed `sqlite3` with Homebrew. Now I've got just one file `csv.c` from the [repo mirror on GitHub](https://github.com/sqlite/sqlite) and try to compile it in an arbitrary directory as described on <https://www.sqlite.org/loadext.html>:

```
% gcc -g -fPIC -dynamiclib csv.c -o csv.dylib
csv.c:643:27: error: use of undeclared identifier 'SQLITE_VTAB_DIRECTONLY'
  sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
                          ^
1 error generated.
```

`Makefile.in` does not contain much traces of `csv.c`.

A user on StackOverflow followed a different path and didn't succeed either: <https://stackoverflow.com/questions/59969377/how-to-compile-sqlite3-extension-csv-virtual-table>

What steps should I follow from the very beginning to get `.load ./csv` working?