There are lots of threads that have similar questions, but many deal with c++ code and have c++ solutions. However, from what I gather on the various threads, I might be missing a library when gcc is trying to link libraries.
I don't know which library I need to include though, for JSON1 to build successfully.
For loading SQLite extensions, their official instructions on the Mac is:
gcc -g -fPIC -dynamiclib YourCode.c -o YourCode.dylib
So I have done:
$ gcc -g -fPIC -dynamiclib sqlite-src-3180000/ext/misc/json1.c -o json1
sqlite-src-3180000/ext/misc/json1.c:344:11: warning: implicit declaration of function
'sqlite3_value_subtype' is invalid in C99 [-Wimplicit-function-declaration]
if( sqlite3_value_subtype(pValue)==JSON_SUBTYPE ){
^
sqlite-src-3180000/ext/misc/json1.c:501:3: warning: implicit declaration of function
'sqlite3_result_subtype' is invalid in C99 [-Wimplicit-function-declaration]
sqlite3_result_subtype(pCtx, JSON_SUBTYPE);
^
2 warnings generated.
Undefined symbols for architecture x86_64:
"_sqlite3_result_subtype", referenced from:
_jsonArrayFunc in json1-5de683.o
_jsonExtractFunc in json1-5de683.o
_jsonObjectFunc in json1-5de683.o
_jsonQuoteFunc in json1-5de683.o
_jsonArrayFinal in json1-5de683.o
_jsonObjectFinal in json1-5de683.o
_jsonReturnJson in json1-5de683.o
...
"_sqlite3_value_subtype", referenced from:
_jsonAppendValue in json1-5de683.o
"_sqlite3_vsnprintf", referenced from:
_jsonPrintf in json1-5de683.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I missing?
This is my gcc details, if it helps:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin