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

Fix DuckDB bundling and add support for DuckDB install on MacOS #11069

Closed

Conversation

majetideepak
Copy link
Collaborator

@majetideepak majetideepak commented Sep 23, 2024

DuckDB fails to build after the recent support for INSTALL_PREFIX

Resolves #11058

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 23, 2024
Copy link

netlify bot commented Sep 23, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 9ce2d24
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66f153007dcccf0008101af1

@majetideepak
Copy link
Collaborator Author

@yingsu00 Can you verify if this fixes your issue?

@@ -192,6 +189,18 @@ if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_ENABLE_SPARK_FUNCTIONS ON)
endif()

if(${VELOX_ENABLE_DUCKDB})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to happen after line 48? Is it possible to unify the two if(DEFINED ENV{INSTALL_PREFIX}) blocks? If not, will you please add a comment? Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_directories modifies a global property which is applied to targets at the time of creation. So moving it to after duckdb is resolved keeps the changes away from it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yingsu00 Yes, your proposal that moving CMAKE_PREFIX_PATH setup along w/ include_directoryies works.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,14 +45,6 @@ if(DEFINED ENV{CONDA_PREFIX})
   endif()
 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"
      "${PROJECT_SOURCE_DIR}/CMake/third-party")

@@ -192,6 +184,21 @@ 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})
+  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()

And the output log:

-- Setting DuckDB source to AUTO
-- Building DuckDB from source
-- Using BUNDLED DuckDB
-- Dependency install directory set to: /velox_dependency_install
-- Found OpenSSL: /opt/homebrew/Cellar/openssl@3/3.3.2/lib/libcrypto.dylib (found version "3.3.2")
-- Using ccache: /opt/homebrew/bin/ccache

Copy link
Collaborator

@assignUser assignUser Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent an installed duckdb in INSTALL_PREFIX from being found and always build it from source, so not what we want :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. I never thought about installing duckdb in INSTALL_PREFIX, but we do not install duckdb in macOS setup script, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@assignUser assignUser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

In the future maybe a target based approach applied to only velox targets would be better, we can try that in tandem with the planned changes to flags and warnings.

@@ -192,6 +189,18 @@ if(${VELOX_BUILD_PYTHON_PACKAGE})
set(VELOX_ENABLE_SPARK_FUNCTIONS ON)
endif()

if(${VELOX_ENABLE_DUCKDB})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include_directories modifies a global property which is applied to targets at the time of creation. So moving it to after duckdb is resolved keeps the changes away from it.

@assignUser
Copy link
Collaborator

Once @yingsu00 confirms this fixes the issue this is ready-to-merge

@yingsu00
Copy link
Collaborator

Once @yingsu00 confirms this fixes the issue this is ready-to-merge

It works for me locally with latest folly.

@assignUser assignUser added the ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall label Sep 24, 2024
@facebook-github-bot
Copy link
Contributor

@kagamiori has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@kagamiori merged this pull request in 08bca2a.

Copy link

Conbench analyzed the 1 benchmark run on commit 08bca2a7.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

@majetideepak majetideepak deleted the fix-duckdb-build branch October 5, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duckdb build failure "error: use of undeclared identifier 'FMT_SNPRINTF'"
6 participants