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++] Path processing on different platforms #39023

Closed
MonicaLiu0311 opened this issue Dec 1, 2023 · 5 comments
Closed

[C++] Path processing on different platforms #39023

MonicaLiu0311 opened this issue Dec 1, 2023 · 5 comments
Assignees
Milestone

Comments

@MonicaLiu0311
Copy link

MonicaLiu0311 commented Dec 1, 2023

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

This is a copy of microsoft/vcpkg#35242. Maybe the path needs to be processed:

Change Dir: 'G:/v/b1/arrow/x64-windows-dbg'

Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v -v -j31 install
[1/193] cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -Dcfgdir= -P G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/tmp/mimalloc_ep-mkdirs.cmake && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-mkdir"
[2/193] cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg\mimalloc_ep-prefix\src && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -P G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-download-DEBUG.cmake && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-download"
[3/193] cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E echo_append && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-update"
[4/193] cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E echo_append && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-patch"
[5/193] cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg\mimalloc_ep-prefix\src\mimalloc_ep-build && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -P G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure-DEBUG.cmake && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure"
FAILED: mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure 
cmd.exe /C "cd /D G:\v\b1\arrow\x64-windows-dbg\mimalloc_ep-prefix\src\mimalloc_ep-build && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -P G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure-DEBUG.cmake && G:\v\downloads\tools\cmake-3.27.1-windows\cmake-3.27.1-windows-i386\bin\cmake.exe -E touch G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure"
CMake Error at G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure-DEBUG.cmake:4 (set):
  Syntax error in cmake code at

    G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-stamp/mimalloc_ep-configure-DEBUG.cmake:4

  when parsing string

    G:/v/downloads/tools/cmake-3.27.1-windows/cmake-3.27.1-windows-i386/bin/cmake.exe;-DCMAKE_C_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe;-DCMAKE_CXX_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe;-DCMAKE_AR=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/lib.exe;-DBUILD_SHARED_LIBS=OFF;-DBUILD_STATIC_LIBS=ON;-DBUILD_TESTING=OFF;-DCMAKE_BUILD_TYPE=DEBUG;-DCMAKE_CXX_FLAGS= /nologo /DWIN32 /D_WINDOWS  /utf-8 /GR /EHsc /MP  /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -MDd;-DCMAKE_CXX_FLAGS_MISIZEREL=/O1 /Ob1 /DNDEBUG -MD;-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7  -MD;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=/Z7 /O2 /Ob1 /DNDEBUG -MD;-DCMAKE_CXX_STANDARD=17;-DCMAKE_C_FLAGS= /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ;-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1  -MDd;-DCMAKE_C_FLAGS_MISIZEREL=/O1 /Ob1 /DNDEBUG -MD;-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7  -MD;-DCMAKE_C_FLAGS_RELWITHDEBINFO=/Z7 /O2 /Ob1 /DNDEBUG -MD;-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON;-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON;-DCMAKE_INSTALL_LIBDIR=lib;-DCMAKE_OSX_SYSROOT=;-DCMAKE_VERBOSE_MAKEFILE=ON;-DCMAKE_C_COMPILER_LAUNCHER=C:\Users\admin\git_projects\ccache.exe;-DCMAKE_CXX_COMPILER_LAUNCHER=C:\Users\admin\git_projects\ccache.exe;-DCMAKE_INSTALL_PREFIX=G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep/src/mimalloc_ep;-DMI_OVERRIDE=OFF;-DMI_LOCAL_DYNAMIC_TLS=ON;-DMI_BUILD_OBJECT=OFF;-DMI_BUILD_SHARED=OFF;-DMI_BUILD_TESTS=OFF;-GNinja;-S;G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep;-B;G:/v/b1/arrow/x64-windows-dbg/mimalloc_ep-prefix/src/mimalloc_ep-build

  Invalid character escape '\U'.


ninja: build stopped: subcommand failed.

Windows does not recognize the following path because its delimiter is \ instead of /:

-DCMAKE_C_COMPILER_LAUNCHER=C:\Users\admin\git_projects\ccache.exe;-DCMAKE_CXX_COMPILER_LAUNCHER=C:\Users\admin\git_projects\ccache.exe;

Is it possible to pass a path representation similar to that used by CMake to solve the problem.

Component(s)

C/C++

@kou kou changed the title Path processing on different platforms [C++] Path processing on different platforms Dec 1, 2023
@kou
Copy link
Member

kou commented Dec 1, 2023

Does this work?

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 978f03198..3a6f36350 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -975,9 +975,11 @@ set(EP_COMMON_CMAKE_ARGS
 
 # Enable s/ccache if set by parent.
 if(CMAKE_C_COMPILER_LAUNCHER AND CMAKE_CXX_COMPILER_LAUNCHER)
+  file(TO_CMAKE_PATH "${CMAKE_C_COMPILER_LAUNCHER}" EP_CMAKE_C_COMPILER_LAUNCHER)
+  file(TO_CMAKE_PATH "${CMAKE_CXX_COMPILER_LAUNCHER}" EP_CMAKE_CXX_COMPILER_LAUNCHER)
   list(APPEND EP_COMMON_CMAKE_ARGS
-       -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-       -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER})
+       -DCMAKE_C_COMPILER_LAUNCHER=${EP_CMAKE_C_COMPILER_LAUNCHER}
+       -DCMAKE_CXX_COMPILER_LAUNCHER=${EP_CMAKE_CXX_COMPILER_LAUNCHER})
 endif()
 
 if(NOT ARROW_VERBOSE_THIRDPARTY_BUILD)

@MonicaLiu0311
Copy link
Author

I don't have ccache.exe and can't test it. This patch is based on my speculation, but I'm not sure if it's a good approach.

You can ask @autoantwort to help test it.

@autoantwort
Copy link

Sorry for the late reply. This patch fixes the issue 👍

kou added a commit to kou/arrow that referenced this issue Jan 25, 2025
@kou
Copy link
Member

kou commented Jan 25, 2025

Thanks. I've opened a PR for it: GH-45349

kou added a commit that referenced this issue Jan 25, 2025
…nalPackage (#45349)

### Rationale for this change

We need to convert it on Windows.

### What changes are included in this PR?

Convert it to CMake path.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #39023

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

kou commented Jan 25, 2025

Issue resolved by pull request 45349
#45349

@kou kou added this to the 20.0.0 milestone Jan 25, 2025
@kou kou closed this as completed Jan 25, 2025
lriggs pushed a commit to lriggs/arrow that referenced this issue Jan 30, 2025
… ExternalPackage (apache#45349)

### Rationale for this change

We need to convert it on Windows.

### What changes are included in this PR?

Convert it to CMake path.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#39023

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
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

3 participants