Skip to content

Commit

Permalink
Fix undefined symbol error
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Jun 28, 2024
1 parent 5b4dbdf commit aec7b71
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
19 changes: 10 additions & 9 deletions cpp/CMake/ConfigArrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,32 @@ set(ARROW_STATIC_LIBRARY_SUFFIX ".a")

set(ARROW_LIB_NAME "arrow")
set(PARQUET_LIB_NAME "parquet")
set(ARROW_BUNDLED_DEPS "arrow_bundled_dependencies")

function(FIND_ARROW_LIB LIB_NAME)
if(NOT TARGET Arrow::${LIB_NAME})
set(ARROW_LIB_FULL_NAME
${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${ARROW_STATIC_LIBRARY_SUFFIX})
add_library(Arrow::${LIB_NAME} SHARED IMPORTED)
add_library(Arrow::${LIB_NAME} STATIC IMPORTED)
find_library(
ARROW_LIB_${LIB_NAME}
NAMES ${ARROW_LIB_FULL_NAME}
PATHS ${ARROW_LIB_DIR} ${ARROW_LIB64_DIR}
NO_DEFAULT_PATH)
if(NOT ARROW_LIB_${LIB_NAME})
message(FATAL_ERROR "Arrow library Not Found: ${ARROW_LIB_FULL_NAME}")
endif()
message(STATUS "Found Arrow library: ${ARROW_LIB_${LIB_NAME}}")
if(LIB_NAME STREQUAL ${ARROW_BUNDLED_DEPS})
set_target_properties(
Arrow::${LIB_NAME} PROPERTIES IMPORTED_LOCATION
${ARROW_LIB_${LIB_NAME}})
else()
message(STATUS "Found Arrow library: ${ARROW_LIB_${LIB_NAME}}")
set_target_properties(
Arrow::${LIB_NAME}
PROPERTIES IMPORTED_LOCATION "${ARROW_LIB_${LIB_NAME}}"
INTERFACE_INCLUDE_DIRECTORIES
"${ARROW_HOME}/install/include")
PROPERTIES IMPORTED_LOCATION ${ARROW_LIB_${LIB_NAME}}
INTERFACE_INCLUDE_DIRECTORIES ${ARROW_HOME}/install/include)
endif()
file(
COPY ${ARROW_LIB_${LIB_NAME}}
DESTINATION ${root_directory}/releases/
FOLLOW_SYMLINK_CHAIN)
endif()
endfunction()

Expand Down
4 changes: 3 additions & 1 deletion cpp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ endif()

find_arrow_lib(${ARROW_LIB_NAME})
find_arrow_lib(${PARQUET_LIB_NAME})
find_arrow_lib(${ARROW_BUNDLED_DEPS})

if(ENABLE_HBM)
include(BuildMemkind)
Expand Down Expand Up @@ -314,7 +315,8 @@ else()
set(LIBHDFS3_DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

target_link_libraries(gluten PUBLIC Arrow::arrow Arrow::parquet)
target_link_libraries(gluten PUBLIC Arrow::parquet Arrow::arrow
Arrow::arrow_bundled_dependencies)
target_link_libraries(gluten PRIVATE google::glog)

install(TARGETS gluten DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down
5 changes: 0 additions & 5 deletions cpp/velox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,6 @@ endif()
target_link_libraries(velox PUBLIC gluten)
add_velox_dependencies()

# Arrow libraries appear after Velox dependencies to avoid linker error
find_arrow_lib(${ARROW_LIB_NAME})
find_arrow_lib(${PARQUET_LIB_NAME})
target_link_libraries(velox PUBLIC Arrow::arrow Arrow::parquet)

target_link_libraries(velox PUBLIC Folly::folly)
find_re2()
target_link_libraries(velox PUBLIC ${RE2_LIBRARY})
Expand Down
20 changes: 16 additions & 4 deletions ep/build-velox/src/modify_velox.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,34 @@ index 5c7bf770a..9f897f577 100644
# target even when velox is built as a subproject which uses

diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index ce4c24dbe..700e53983 100644
index ce4c24dbe..46cc3302b 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -26,7 +26,10 @@ if(VELOX_ENABLE_ARROW)
@@ -26,7 +26,11 @@ if(VELOX_ENABLE_ARROW)
endif()
set(ARROW_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/arrow_ep")
set(ARROW_CMAKE_ARGS
- -DARROW_PARQUET=OFF
+ -DARROW_DEPENDENCY_USE_SHARED=OFF
+ -DARROW_PARQUET=ON
+ -DARROW_FILESYSTEM=ON
+ -DARROW_PROTOBUF_USE_SHARED=OFF
+ -DARROW_DEPENDENCY_USE_SHARED=OFF
+ -DARROW_DEPENDENCY_SOURCE=BUNDLED
-DARROW_WITH_THRIFT=ON
-DARROW_WITH_LZ4=ON
-DARROW_WITH_SNAPPY=ON
@@ -69,6 +72,8 @@ if(VELOX_ENABLE_ARROW)
@@ -39,8 +43,8 @@ if(VELOX_ENABLE_ARROW)
-DARROW_TESTING=ON
-DCMAKE_INSTALL_PREFIX=${ARROW_PREFIX}/install
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
- -DARROW_BUILD_STATIC=ON
- -DThrift_SOURCE=${THRIFT_SOURCE})
+ -DARROW_BUILD_SHARED=OFF
+ -DARROW_BUILD_STATIC=ON)
set(ARROW_LIBDIR ${ARROW_PREFIX}/install/${CMAKE_INSTALL_LIBDIR})

add_library(thrift STATIC IMPORTED GLOBAL)
@@ -69,6 +73,8 @@ if(VELOX_ENABLE_ARROW)
arrow_ep
PREFIX ${ARROW_PREFIX}
URL ${VELOX_ARROW_SOURCE_URL}
Expand Down

0 comments on commit aec7b71

Please sign in to comment.