sqlite-vec icon indicating copy to clipboard operation
sqlite-vec copied to clipboard

sqlite3_auto_extension is deprecated in macOS

Open davidliudev opened this issue 1 year ago • 2 comments

For macOS build I am receiving this:

cgo-gcc-prolog:55:11: warning: 'sqlite3_auto_extension' is deprecated: first deprecated in macOS 10.10 - Process-global auto extensions are not supported on Apple platforms [-Wdeprecated-declarations]

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h:6870:16: note: 'sqlite3_auto_extension' has been explicitly marked deprecated here

cgo-gcc-prolog:74:11: warning: 'sqlite3_cancel_auto_extension' is deprecated: first deprecated in macOS 10.14 - Process-global auto extensions are not supported on Apple platforms [-Wdeprecated-declarations]

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h:6883:16: note: 'sqlite3_cancel_auto_extension' has been explicitly marked deprecated here

I have looked at the header as describe above and see the below lines:

/*
** CAPI3REF: Automatically Load Statically Linked Extensions
**
** ^This interface causes the xEntryPoint() function to be invoked for
** each new [database connection] that is created.  The idea here is that
** xEntryPoint() is the entry point for a statically linked [SQLite extension]
** that is to be automatically loaded into all new database connections.
**
** ^(Even though the function prototype shows that xEntryPoint() takes
** no arguments and returns void, SQLite invokes xEntryPoint() with three
** arguments and expects an integer result as if the signature of the
** entry point where as follows:
**
** <blockquote><pre>
** &nbsp;  int xEntryPoint(
** &nbsp;    sqlite3 *db,
** &nbsp;    const char **pzErrMsg,
** &nbsp;    const struct sqlite3_api_routines *pThunk
** &nbsp;  );
** </pre></blockquote>)^
**
** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
** point to an appropriate error message (obtained from [sqlite3_mprintf()])
** and return an appropriate [error code].  ^SQLite ensures that *pzErrMsg
** is NULL before calling the xEntryPoint().  ^SQLite will invoke
** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns.  ^If any
** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
**
** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
** on the list of automatic extensions is a harmless no-op. ^No entry point
** will be called more than once for each database connection that is opened.
**
** See also: [sqlite3_reset_auto_extension()]
** and [sqlite3_cancel_auto_extension()]
*/
SQLITE_DEPRECATED_NO_REPLACEMENT("Process-global auto extensions are not supported on Apple platforms", macos(10.10, 10.10), ios(8.2, 8.2), watchos(2.0, 2.0), tvos(9.0, 9.0))
SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));


I am running macOS 15.0 ARM

For now it is still working. But I am wondering that in the future this will break?

davidliudev avatar Nov 01 '24 14:11 davidliudev

Hey @asg017 just wondering if you know how to fix this? It's a bit unsettling 😅

mholt avatar Sep 19 '25 15:09 mholt

@mholt check out https://github.com/asg017/sqlite-vec-go-bindings/pull/9

I'm not a Go developer so idk how bad the implications of reflect are (or if depending on mattn/sqlite is the right choice), but it should side-step this entire issue altogether! Any comments would be deeply appreciated

asg017 avatar Sep 19 '25 18:09 asg017