You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "johnwparent (via GitHub)" <gi...@apache.org> on 2026/07/09 15:31:11 UTC

[PR] GH-50449: Invalid version script argument supplied to MSVC linker [arrow]

johnwparent opened a new pull request, #50450:
URL: https://github.com/apache/arrow/pull/50450

   ### Rationale for this change
   
   Preventing an invalid argument to be supplied to the MSVC linker, which can potentially break arrow builds on paths with spaces on Windows when using MSVC.
   
   ### What changes are included in this PR?
   
   `cpp/CMakeLists.txt` has been updated to add a specific check for the MSVC toolchain, and if true, sets `CXX_LINKER_SUPPORTS_VERSION_SCRIPT` to `FALSE`.
   
   ### Are these changes tested?
   
   Yes, see the build of `arrow` in this CI run in Spack's built with this patch and a path with a space: https://gitlab.spack.io/spack/spack-packages/-/jobs/22970695
   
   ### Are there any user-facing changes?
   
   No
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #50450:
URL: https://github.com/apache/arrow/pull/50450#issuecomment-4929788619

   > is do we want to control symbol visibility with MSVC the same way the version script is doing here?
   
   Yes. It's better. We don't want to export symbols for bundled dependencies because they may be conflicted with other products that use Apache Arrow C++.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #50450:
URL: https://github.com/apache/arrow/pull/50450#issuecomment-4931263682

   OK. Then we don't need this feature for MSVC.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "johnwparent (via GitHub)" <gi...@apache.org>.
johnwparent commented on code in PR #50450:
URL: https://github.com/apache/arrow/pull/50450#discussion_r3554906519


##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

Review Comment:
   I let this be the more restrictive condition as I wasn't sure if any "MSVC like" compilers would support the version file, I'm not aware of any that do, so I think this suggestion is probably fine, but I'm not aware of the scope of Arrow's deployment,  and just wanted to point out there are side effects from changing this check beyond terseness, just to be safe.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "johnwparent (via GitHub)" <gi...@apache.org>.
johnwparent commented on PR #50450:
URL: https://github.com/apache/arrow/pull/50450#issuecomment-4929810477

   > > is do we want to control symbol visibility with MSVC the same way the version script is doing here?
   > 
   > Yes. It's better. We don't want to export symbols for bundled dependencies because they may be conflicted with other products that use Apache Arrow C++.
   
   Unless you're re-exporting this symbols deliberately, for DLLs with MSVC, you don't need to worry, the transitive symbols are hidden by default.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #50450:
URL: https://github.com/apache/arrow/pull/50450#discussion_r3555920704


##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()

Review Comment:
   Could you remove this because we require CMake 3.25 or later now?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #50450:
URL: https://github.com/apache/arrow/pull/50450#discussion_r3554669816


##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

Review Comment:
   ```suggestion
   elseif(MSVC)
   ```



##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+  # msvc does not support version scripts, but check_linker_flag won't return false
+  # due to how msvc's linker reports unrecognized arguments

Review Comment:
   ```suggestion
     # due to how MSVC's linker reports unrecognized arguments
   ```



##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+  # msvc does not support version scripts, but check_linker_flag won't return false

Review Comment:
   ```suggestion
     # MSVC does not support version scripts, but check_linker_flag won't return false
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "johnwparent (via GitHub)" <gi...@apache.org>.
johnwparent commented on PR #50450:
URL: https://github.com/apache/arrow/pull/50450#issuecomment-4929646723

   > Interesting.
   > 
   > If we use `LINKER:-version-script=...` instead of `-Wl,--version-script=...`, does `check_linker_flag()` with MSVC report `FALSE`?
   > 
   > If `check_linker_flag()` with MSVC doesn't report `FALSE` for any flags, I feel that it's a problem of CMake. Could you report it to CMake?
   
   It's an inherent behavior of MSVC's linker, but it does look like that module attempts to catch diagnostic output. I'll see if we're interested in a patch. 
   
   Another question, that I didn't both to ask for Spack, but is relevant to this patch, is do we want to control symbol visibility with MSVC the same way the version script is doing here? In which case we can write a .def or similar file instead of skipping this entirely. 
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-50449: [C++] Invalid version script argument supplied to MSVC linker [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #50450:
URL: https://github.com/apache/arrow/pull/50450#discussion_r3555915489


##########
cpp/CMakeLists.txt:
##########
@@ -362,6 +362,10 @@ if(CMAKE_VERSION VERSION_LESS 3.18)
   else()
     set(CXX_LINKER_SUPPORTS_VERSION_SCRIPT TRUE)
   endif()
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

Review Comment:
   All MSVC like compilers behave like https://github.com/apache/arrow/pull/50450#issuecomment-4929810477 , right? (All symbols are hidden by default.)
   
   If so, can we use `elseif(MSVC)` here?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org