duckdb_spatial icon indicating copy to clipboard operation
duckdb_spatial copied to clipboard

Build from source in Alpine Linux

Open kaon opened this issue 2 months ago • 2 comments

CMake Error at build/release/_deps/spatial_extension_fc-src/CMakeLists.txt:55 (find_package):
  Could not find a package configuration file provided by
  "unofficial-sqlite3" with any of the following names:

    unofficial-sqlite3Config.cmake
    unofficial-sqlite3-config.cmake

  Add the installation prefix of "unofficial-sqlite3" to CMAKE_PREFIX_PATH or
  set "unofficial-sqlite3_DIR" to a directory containing one of the above
  files.  If "unofficial-sqlite3" provides a separate development package or
  SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
make: *** [Makefile:339: release] Error 1

How can we get the unofficial sqlite3 package for building?

kaon avatar Oct 15 '25 02:10 kaon

Hello! You need to setup VCPKG to pull in the required dependencies to build spatial. unofficial-sqlite3 is the name for the sqlite package in VCPKG.

Maxxen avatar Oct 24 '25 11:10 Maxxen

Same problem on FreeBSD (and maybe elsewhere where vcpkg is not used).

I can pass configuration with this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2853057..7b472ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,22 +46,21 @@ add_library(${EXTENSION_NAME} STATIC ${EXTENSION_SOURCES})
 
 # annoyingly for expat on windows
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} MD.lib)
-set(ZLIB_USE_STATIC_LIBS ON)
+set(ZLIB_USE_STATIC_LIBS OFF)
 set(OPENSSL_USE_STATIC_LIBS ON)
 find_package(ZLIB REQUIRED)
 find_package(PROJ CONFIG REQUIRED)
 find_package(GDAL CONFIG REQUIRED)
 find_package(EXPAT REQUIRED)
-find_package(unofficial-sqlite3 CONFIG REQUIRED)
+find_package(SQLite3 REQUIRED)
 
 # Important: The link order matters, its the reverse order of dependency
-set(EXTENSION_DEPENDENCIES GDAL::GDAL PROJ::proj EXPAT::EXPAT
-                           unofficial::sqlite3::sqlite3 ZLIB::ZLIB)
+set(EXTENSION_DEPENDENCIES GDAL::GDAL PROJ::proj EXPAT::EXPAT ${SQLite3_LIBRARIES} ${ZLIB_LIBRARIES})
 
 if(SPATIAL_USE_GEOS)
   message(STATUS "Building with GEOS functionality")
   find_package(GEOS REQUIRED)
-  set(EXTENSION_DEPENDENCIES ${EXTENSION_DEPENDENCIES} GEOS::geos_c)
+  set(EXTENSION_DEPENDENCIES ${EXTENSION_DEPENDENCIES} GEOS::geos_c GEOS::geos)
   add_definitions(-DSPATIAL_USE_GEOS=1)
 endif()

cc @yurivict

lbartoletti avatar Oct 24 '25 17:10 lbartoletti