SQLite Forum

How to compile an extension from scratch? The CSV virtual table in particular
Login
It works! Thank you very much!

Here's the full script for compiling the CSV extension from scratch (based on <https://www.sqlite.org/loadext.html> and <https://github.com/sqlite/sqlite/blob/master/README.md>):

```
wget https://www.sqlite.org/src/tarball/sqlite.tar.gz
tar xzf sqlite.tar.gz
mkdir bld
cd bld
../sqlite/configure
make
gcc -g -I. -fPIC -dynamiclib ../sqlite/ext/misc/csv.c -o csv.dylib
```

And testing it:

```
echo -e 'col_text,col_int\napples,3\noranges,5' > sample.csv
./sqlite3 '' '.load csv' 'CREATE VIRTUAL TABLE temp.t1 USING csv(filename="sample.csv");' 'SELECT * FROM t1;'
```