Skip to content

Commit

Permalink
Fix DuckDB bundling and add support for DuckDB install on MacOS (#11069)
Browse files Browse the repository at this point in the history
Summary:
DuckDB fails to build after the recent support for INSTALL_PREFIX

Resolves #11058

Pull Request resolved: #11069

Reviewed By: pedroerp

Differential Revision: D63355653

Pulled By: kagamiori

fbshipit-source-id: c04cd0afeb8f15724b8baaf151544d42a60bf6a6
  • Loading branch information
majetideepak authored and facebook-github-bot committed Sep 25, 2024
1 parent 7483a76 commit 08bca2a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
20 changes: 12 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ endif()
if(DEFINED ENV{INSTALL_PREFIX})
message(STATUS "Dependency install directory set to: $ENV{INSTALL_PREFIX}")
list(APPEND CMAKE_PREFIX_PATH "$ENV{INSTALL_PREFIX}")
# Allow installed package headers to be picked up before brew/system package
# headers
include_directories(BEFORE "$ENV{INSTALL_PREFIX}/include")
endif()

list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake"
Expand Down Expand Up @@ -192,6 +189,18 @@ if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_ENABLE_SPARK_FUNCTIONS ON)
endif()

if(${VELOX_ENABLE_DUCKDB})
set_source(DuckDB)
resolve_dependency(DuckDB)
endif()

if(DEFINED ENV{INSTALL_PREFIX})
# Allow installed package headers to be picked up before brew/system package
# headers. We set this after DuckDB bundling since DuckDB uses its own
# dependencies.
include_directories(BEFORE "$ENV{INSTALL_PREFIX}/include")
endif()

# We look for OpenSSL here to cache the result enforce the version across our
# dependencies.
find_package(OpenSSL REQUIRED)
Expand Down Expand Up @@ -413,11 +422,6 @@ else()
endif()
resolve_dependency(glog)

if(${VELOX_ENABLE_DUCKDB})
set_source(DuckDB)
resolve_dependency(DuckDB)
endif()

set_source(fmt)
resolve_dependency(fmt 9.0.0)

Expand Down
10 changes: 10 additions & 0 deletions scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ PYTHON_VENV=${PYHTON_VENV:-"${SCRIPTDIR}/../.venv"}
export OS_CXXFLAGS=" -isystem $(brew --prefix)/include "
NPROC=$(getconf _NPROCESSORS_ONLN)

BUILD_DUCKDB="${BUILD_DUCKDB:-true}"
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)}
MACOS_VELOX_DEPS="bison flex gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 snappy xz zstd"
MACOS_BUILD_DEPS="ninja cmake"
Expand Down Expand Up @@ -147,6 +148,14 @@ function install_fast_float {
cmake_install_dir fast_float
}

function install_duckdb {
if $BUILD_DUCKDB ; then
echo 'Building DuckDB'
wget_and_untar https://github.com/duckdb/duckdb/archive/refs/tags/v0.8.1.tar.gz duckdb
cmake_install_dir duckdb -DBUILD_UNITTESTS=OFF -DENABLE_SANITIZER=OFF -DENABLE_UBSAN=OFF -DBUILD_SHELL=OFF -DEXPORT_DLL_SYMBOLS=OFF -DCMAKE_BUILD_TYPE=Release
fi
}

function install_velox_deps {
run_and_time install_velox_deps_from_brew
run_and_time install_ranges_v3
Expand All @@ -159,6 +168,7 @@ function install_velox_deps {
run_and_time install_wangle
run_and_time install_mvfst
run_and_time install_fbthrift
run_and_time install_duckdb
}

(return 2> /dev/null) && return # If script was sourced, don't run commands.
Expand Down

0 comments on commit 08bca2a

Please sign in to comment.