SQLite Forum

How can I compile the newest percentile.c?
Login

How can I compile the newest percentile.c?

(1) By anonymous on 2020-04-12 16:47:18 [link] [source]

The newest percentile.c: https://sqlite.org/src/file/ext/misc https://sqlite.org/src/artifact/b9086e223d583bda

Has the flag: SQLITE_INNOCUOUS

When I try to compile it using the instructions here: https://www.sqlite.org/loadext.html

gcc -g -fPIC -dynamiclib percentile.c -o percentile.dylib

I get the error:

percentile.c:217:44: error: use of undeclared identifier 'SQLITE_INNOCUOUS'
                               SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
                                           ^
1 error generated.

That flag was introduced as part of this change: https://sqlite.org/src/info/4c21373c21c9b17b

Can someone toll me how I can compile this dylib without getting the error above?

Thanks!

(2) By Richard Hipp (drh) on 2020-04-12 17:02:45 in reply to 1 [source]

The SQLITE_INNOCUOUS flag is a new feature for SQLite version 3.31.0. Whatever SQLite library you have installed must be older than that.

Either update the SQLite library that you are compiling against, or use an older version of the percentile.c source code.

(3) By Keith Medcalf (kmedcalf) on 2020-04-12 18:06:26 in reply to 2 updated by 3.1 [link] [source]

or just -DSQLITE_INNOCUOUS=0 for that compilation unit.

(3.1) By Keith Medcalf (kmedcalf) on 2020-04-12 18:07:51 edited from 3.0 in reply to 2 updated by 3.2 [link] [source]

or just -DSQLITE_INNOCUOUS=0 for that compilation unit.  That is:

```
gcc -g -fPIC -DSQLITE_INNOCUOUS=0 -dynamiclib percentile.c -o percentile.dylib
```

(3.2) By Keith Medcalf (kmedcalf) on 2020-04-12 18:10:03 edited from 3.1 in reply to 2 [link] [source]

or just -DSQLITE_INNOCUOUS=0 for that compilation unit. That is:

gcc -g -fPIC -DSQLITE_INNOCUOUS=0 -dynamiclib percentile.c -o percentile.dylib

but don't forget to get rid of that define when you eventually use a more up-to-date version of the sqlite3 library.