joemarshall commented on code in PR #37822:
URL: https://github.com/apache/arrow/pull/37822#discussion_r1574510160


##########
python/CMakeLists.txt:
##########
@@ -683,14 +725,22 @@ if(PYARROW_BUILD_SUBSTRAIT)
     message(FATAL_ERROR "You must build Arrow C++ with ARROW_SUBSTRAIT=ON")
   endif()
   find_package(ArrowSubstrait REQUIRED)
-  if(PYARROW_BUNDLE_ARROW_CPP)
-    bundle_arrow_lib(${ARROW_SUBSTRAIT_SHARED_LIB} SO_VERSION 
${ARROW_SO_VERSION})
-    if(MSVC)
-      bundle_arrow_import_lib(${ARROW_SUBSTRAIT_IMPORT_LIB})
+
+  if(ARROW_BUILD_SHARED)
+    if(PYARROW_BUNDLE_ARROW_CPP)
+      bundle_arrow_lib(${ARROW_SUBSTRAIT_SHARED_LIB} SO_VERSION 
${ARROW_SO_VERSION})
+      if(MSVC)
+        bundle_arrow_import_lib(${ARROW_SUBSTRAIT_IMPORT_LIB})
+      endif()
     endif()
+    set(SUBSTRAIT_LINK_LIBS ArrowSubstrait::arrow_substrait_shared)
+  else()
+  # only link to the output of substrait, not to libarrow etc.
+  # if we link to the target directly we end up with multiple copies
+  # of libarrow / parquet etc. 
+  set(SUBSTRAIT_LINK_LIBS 
$<TARGET_FILE:ArrowSubstrait::arrow_substrait_static> )

Review Comment:
   Not across multiple shared libraries it doesn't. If you use the target 
directly, cmake links libarrow into substrait itself, in addition to the copy 
in libarrow_python and we have two copies of libarrow in the final python 
module.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to