kou commented on pull request #9811:
URL: https://github.com/apache/arrow/pull/9811#issuecomment-808852451


   It's caused by ignoring `-stdlib=c++` specified by `CXX` environment 
variable that is provided by `R CMD config CXX`.
   We use `CMAKE_CXX_COMPILER` to tell `CXX` environment variable information 
to bundled libraries. But it only has compiler path such as `/usr/bin/clang++` 
in `CXX=/usr/bin/clang++ -std=gnu++14 -stdlib=libc++`. It doesn't have other 
options such as `-std=gnu++14 -stdlib=libc++`. `CMAKE_CXX_COMPILER_ARG1` has 
them.
   
   How about passing `CMAKE_CXX_COMPILER_ARG1` information to bundled libraries?
   
   ```diff
   diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   index e19544182..ef2ccfd0a 100644
   --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
   +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   @@ -620,8 +620,8 @@ endif()
    # ----------------------------------------------------------------------
    # ExternalProject options
    
   -set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} 
${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}")
   -set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}}")
   +set(EP_CXX_FLAGS "${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS} 
${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}")
   +set(EP_C_FLAGS "${CMAKE_C_COMPILER_ARG1} ${CMAKE_C_FLAGS} 
${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}}")
    
    if(NOT MSVC_TOOLCHAIN)
      # Set -fPIC on all external projects
   ```


-- 
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.

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


Reply via email to