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

[C++] ARM64 Windows: Can't build 'arrow_bundled_dependencies.lib' successfully #44368

Closed
zhanweiw opened this issue Oct 10, 2024 · 3 comments
Closed
Assignees
Milestone

Comments

@zhanweiw
Copy link

Describe the bug, including details regarding any error messages, version, and platform.

I'll get below error message while I compile Arrow in ARM64 windows. May I get your support on this issue? Thanks in advance!

[190/191] Install the project...-- Install configuration: "RELEASE"
-- Installing: C:/zhanweiw/source/Python/Src/arrow/Install/include/arrow/util/config.h
CMake Error at src/arrow/cmake_install.cmake:40 (file):
  file INSTALL cannot find
  "C:/zhanweiw/source/Python/Src/arrow/cpp/build/release/arrow_bundled_dependencies.lib":
  File exists.
Call Stack (most recent call first):
  cmake_install.cmake:37 (include)

More info can be found here:
#44310 (comment)

Component(s)

C++

@kou
Copy link
Member

kou commented Oct 11, 2024

Could you try the following?

diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake
index 692efa7837..3e0a1536c3 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -119,6 +119,17 @@ function(arrow_create_merged_static_lib output_target)
 
     set(BUNDLE_COMMAND ${LIBTOOL_MACOS} "-no_warning_for_no_symbols" "-static" "-o"
                        ${output_lib_path} ${all_library_paths})
+  elseif(MSVC)
+    if(CMAKE_LIBTOOL)
+      set(BUNDLE_TOOL ${CMAKE_LIBTOOL})
+    else()
+      find_program(BUNDLE_TOOL lib HINTS "${CMAKE_CXX_COMPILER}/..")
+      if(NOT BUNDLE_TOOL)
+        message(FATAL_ERROR "Cannot locate lib.exe to bundle libraries")
+      endif()
+    endif()
+    set(BUNDLE_COMMAND ${BUNDLE_TOOL} /NOLOGO /OUT:${output_lib_path}
+                       ${all_library_paths})
   elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|GNU|Intel|IntelLLVM)$")
     set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar)
 
@@ -140,18 +151,6 @@ function(arrow_create_merged_static_lib output_target)
     endif()
 
     set(BUNDLE_COMMAND ${ar_tool} -M < ${ar_script_path})
-
-  elseif(MSVC)
-    if(CMAKE_LIBTOOL)
-      set(BUNDLE_TOOL ${CMAKE_LIBTOOL})
-    else()
-      find_program(BUNDLE_TOOL lib HINTS "${CMAKE_CXX_COMPILER}/..")
-      if(NOT BUNDLE_TOOL)
-        message(FATAL_ERROR "Cannot locate lib.exe to bundle libraries")
-      endif()
-    endif()
-    set(BUNDLE_COMMAND ${BUNDLE_TOOL} /NOLOGO /OUT:${output_lib_path}
-                       ${all_library_paths})
   else()
     message(FATAL_ERROR "Unknown bundle scenario!")
   endif()

@zhanweiw
Copy link
Author

@kou Thanks you so much! WIth this change, I can compile "arrow_bundled_dependencies.lib" successfully.

kou added a commit to kou/arrow that referenced this issue Oct 13, 2024
…ven with "clang-cl"

We can use MSVC tool such as "lib" with "clang-cl" build because it's
a MSVC like build.
@kou kou changed the title [C++] ARM64 Windows: Can't build 'arrow_bundled_dependencies.lib' successfully. [C++] ARM64 Windows: Can't build 'arrow_bundled_dependencies.lib' successfully Oct 13, 2024
kou added a commit that referenced this issue Oct 16, 2024
…th "clang-cl" (#44391)

### Rationale for this change

We need to use "clang-cl" for Windows ARM64. We can use MSVC tool such as "lib" for generating bundled dependencies with "clang-cl" build because it's a MSVC like build.

### What changes are included in this PR?

Prefer "lib" to `${CMAKE_AR}` with "clang-cl" for generating bundled dependencies. It seems that `${CMAKE_AR}` doesn't generate `arrow_bundled_dependencies.lib`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #44368

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
@kou
Copy link
Member

kou commented Oct 16, 2024

Issue resolved by pull request 44391
#44391

@kou kou added this to the 19.0.0 milestone Oct 16, 2024
@kou kou closed this as completed Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants