Skip to content
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

Build issue with system sqlite3 on Mac #6011

Closed
rouault opened this issue Jul 1, 2022 · 3 comments
Closed

Build issue with system sqlite3 on Mac #6011

rouault opened this issue Jul 1, 2022 · 3 comments
Assignees

Comments

@rouault
Copy link
Member

rouault commented Jul 1, 2022

Reported in https://lists.osgeo.org/pipermail/gdal-dev/2022-July/055995.html , building on MacOS with system sqlite3 fails because some symbols are missing

==========
[ 82%] Building CXX object ogr/ogrsf_frmts/sqlite/CMakeFiles/ogr_SQLite.dir/ogrsqlitedatasource.cpp.o
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp:733:21: error: use of undeclared identifier 'sqlite3_enable_load_extension'
                if( sqlite3_enable_load_extension(hDB, 1) == SQLITE_OK )
                    ^
/Users/nsands/Documents/Development/3rdParty/GDAL3/gdal-3.5.0/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp:746:21: error: use of undeclared identifier 'sqlite3_load_extension'
                if( sqlite3_load_extension(hDB, aosExtensions[i], nullptr, &pszErrMsg) != SQLITE_OK )
                    ^
2 errors generated.
make[2]: *** [ogr/ogrsf_frmts/sqlite/CMakeFiles/ogr_SQLite.dir/ogrsqlitedatasource.cpp.o] Error 1
make[1]: *** [ogr/ogrsf_frmts/sqlite/CMakeFiles/ogr_SQLite.dir/all] Error 2
make: *** [all] Error 2

Googling around, this is a known issue for other projects too, e.g https://bugs.python.org/issue44997

@forestgnome
Copy link

I would rather recommend in
ogr/ogrsf_frmts/sqlite/CMakeLists.txt:
line 31:
option(OGR_SQLITE_ALLOW_LOAD_EXTENSIONS "Whether SQLite extension loading is enabled through the OGR_SQLITE_LOAD_EXTENSIONS configuration option" OFF)

to disable code side loading, even as default for all platforms, or are there any plugin dependencies (??). Sooner or later this option could be misused (outside of the GDAL visibility control), as there is no sandbox-security mechanism.

@rouault
Copy link
Member Author

rouault commented Jul 5, 2022

to disable code side loading

this is not really different from the GDAL pluging loading mechanism that is enabled by default (controlled by CMake variable GDAL_AUTOLOAD_PLUGINS), so I don't see to turn sqlite extension loading off by default, if it is available.

@forestgnome
Copy link

yes, you are right with GDAL_AUTOLOAD_PLUGINS.

@rouault rouault self-assigned this Jul 6, 2022
@rouault rouault closed this as completed in b97db60 Jul 7, 2022
rouault added a commit that referenced this issue Jul 7, 2022
CMake: fix build issue with system sqlite3 on Mac (fixes #6011)
rouault added a commit that referenced this issue Jul 8, 2022
[Backport release/3.5] CMake: fix build issue with system sqlite3 on Mac (fixes #6011)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants