Skip to content

Fix DuckDB integration failure during out-of-source builds #142

@UsedByFeiYang

Description

@UsedByFeiYang

When performing an out-of-source build (e.g., building in a /build directory), the AliSQL compilation fails because it cannot find libduckdb_bundle.a.
The root cause is a discrepancy between the DuckDB build location and the path defined in CMake:

  1. The BUILD_COMMAND in MYSQL_USE_BUNDLED_DUCKDB uses make -C "${DUCKDB_SOURCE_DIR}", which forces DuckDB to be built inside the source tree (extra/duckdb/build/).
  2. However, the MY_DUCKDB_LIB variable is defined using ${CMAKE_BINARY_DIR}, which points to the build directory.

This results in the following error during the linking stage of mysqld:
make[2]: *** No rule to make target 'extra/duckdb/build/debug/libduckdb_bundle.a', needed by 'runtime_output_directory/mysqld'. Stop.

Steps to Reproduce:
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug [other_args]
make

Suggested Fix:
In the CMake file defining MYSQL_USE_BUNDLED_DUCKDB, the MY_DUCKDB_LIB path should be updated to point to the actual output location in the source directory to ensure consistency with the make -C command.

replace
SET(MY_DUCKDB_LIB "${BINARY_DIR}/${DUCKDB_BUILD_DIR}/libduckdb_bundle.a")
to
SET(MY_DUCKDB_LIB "${DUCKDB_SOURCE_DIR}/build/${DUCKDB_BUILD_DIR}/libduckdb_bundle.a")`

Alternatively, the BUILD_COMMAND should be refactored to perform a proper out-of-source build within ${BINARY_DIR}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions