duckdb / sqlite_scanner

DuckDB extension to read and write to SQLite databases
https://duckdb.org/docs/extensions/sqlite
MIT License
208 stars 21 forks source link

sqlite_scanner cannot build from source #55

Closed shaastru closed 11 months ago

shaastru commented 1 year ago

What happens?

The current main branch cannot build due to reference to non-existing file in DuckDB.

To Reproduce

Preface: I want to build sqlite_scanner from source. The prebuilt binary is not enough for my use-case since the prebuilt binary only comes in 64 bit.

  1. Pull the current main branch of sqlite_scanner on 13th of July 2023(Last commit SHA 05dd50b3fc91ee4974964086efbc16be74fa115f).

  2. Execute the build instructions from the Makefile necessary to generate a debug build:

    mkdir -p build/debug && \
    cd build/debug && \
    cmake $(GENERATOR) -DCMAKE_BUILD_TYPE=Debug ${BUILD_FLAGS} ../../duckdb/CMakeLists.txt -DEXTERNAL_EXTENSION_DIRECTORIES=../../sqlite_scanner -B. && \
    cmake --build . --config Debug

For generator I use MSVC(Visual Studio 17 2022) so the result is a sqlite_scanner.sln file with 118 projects, but the result should be the same independent of generator.

  1. Open the project file in Visual Studio 17 2022 and build the projects. Three will fail(sqlite_ext_library, sqlite_ext_storage, sqlite_scanner_loadable_extension) with the following errors:

For sqlite_ext_library project: sqlite_scanner\src\sqlite_db.cpp(4,10): fatal error C1083: Cannot open include file: 'duckdb/storage/table_storage_info.hpp': No such file or directory sqlite_scanner\src\include\sqlite_storage.hpp(11,10): fatal error C1083: Cannot open include file: 'duckdb/storage/storage_extension.hpp': No such file or directory sqlite_scanner\src\sqlite_scanner.cpp(14,10): fatal error C1083: Cannot open include file: 'duckdb/storage/storage_extension.hpp': No such file or directory sqlite_scanner\src\include\sqlite_storage.hpp(11,10): fatal error C1083: Cannot open include file: 'duckdb/storage/storage_extension.hpp': No such file or directory

For sqlite_ext_storage project: sqlite_scanner\src\include\storage/sqlite_catalog.hpp(12,10): fatal error C1083: Cannot open include file: 'duckdb/common/enums/access_mode.hpp': No such file or directory

The error regarding duckdb/common/enums/access_mode.hpp is explained by the fact that the access_mode file was first added to DuckDB in the commit with SHA d293c5a1bd260173339cad1c73a1a499b705d517 in 2023/01/17, which is after the branch of DuckDB which sqlite_scanner uses(Note: As of Nov 11, 2022, sqlite_scanner uses the branch https://github.com/duckdb/duckdb/tree/0a75d208959870dfbbf3638b08a2fa6801dbd59f).

The error is therefore clear: The source file sqlite_scanner\src\include\storage/sqlite_catalog.hpp tries to include a file from DuckDB(duckdb/common/enums/access_mode.hpp) which is only introduced in a later version of DuckDB.

I would like to be able to build sqlite_scanner from source. But currently, this does not seem to be possible. Please let me know if I have misunderstood something.

OS:

Windows 10 Version 22H2 for x64

SQLite Version:

Not Applicable

DuckDB Version:

https://github.com/duckdb/duckdb/tree/0a75d208959870dfbbf3638b08a2fa6801dbd59f

DuckDB Client:

Not Applicable

Full Name:

Simon Haastrup

Affiliation:

Netcompany-Intrasoft

Have you tried this on the latest master branch?

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

Mytherin commented 11 months ago

Thanks for the report!

It looks to me like you have not pulled the source code from DuckDB, which is fetched through a submodule. You need to update the git submodules and use git pull in the duckdb directory to fetch the DuckDB source code.