New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLite load_extension syntax doesn't work Ubuntu 18.04 #1437
Comments
The sqlite docs at https://www.sqlite.org/c3ref/load_extension.html say:
The module loading code lives here: Ubuntu 16.04: sqlite 3.11.0 https://github.com/mackyle/sqlite/blob/version-3.11.0/src/loadext.c#L432 There was a change visible in 3.22.0 around module loading that has been reverted in the latest sqlite3 code. Maybe it's the source of the problem here. Honestly, I think this is a bug in the version of sqlite that's bundled with Ubuntu 18.04. The recipe @ianthetechie supplied works just fine with Ubuntu 16.04, which is a big red flag in my book that the Ubuntu packages are messed up. I don't think Valhalla should be in the business of trying operating-system specific extensions. |
That makes sense. Good catch. I knew it was expecting a file name (more or less), but overlooked that line in the docs. |
This has been fixed in 18.10, for release 18.04 you can create a symlink:
|
See pelias/docker#28 (comment) for more info |
Awesome. And yes, the symlink is what we have been doing. Thanks for the update. |
Reopening this. We have code for doing this in a bunch of places throughout mjolnir. It looks appx like: // loading SpatiaLite as an extension
sqlite3_enable_load_extension(db_handle, 1);
#if SQLITE_VERSION_NUMBER > 3008007
sql = "SELECT load_extension('mod_spatialite')";
#else
sql = "SELECT load_extension('libspatialite')";
#endif
ret = sqlite3_exec(db_handle, sql.c_str(), nullptr, nullptr, &err_msg);
if (ret != SQLITE_OK) {
LOG_ERROR("load_extension() error: " + std::string(err_msg));
sqlite3_free(err_msg);
sqlite3_close(db_handle);
return;
} Imho we should pull this out into a utility function that takes the |
@kevinkreiser I've seen the same failover logic in this lib: https://github.com/shaxbee/go-spatialite/blob/master/spatialite.go#L29 |
The current syntax for loading the spatialite module does not appear to work on Ubuntu 18.04. It appears to be looking for a filename, not the base object library name. See a transcript of the session below run on my build server for an illustration of the syntax currently employed in the codebase vs the working syntax.
The text was updated successfully, but these errors were encountered: