[ 
https://issues.apache.org/jira/browse/ARROW-17763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17606153#comment-17606153
 ] 

Kouhei Sutou edited comment on ARROW-17763 at 9/17/22 9:28 PM:
---------------------------------------------------------------

Thank you, [~jinshang]. That's an excellent reference!

I was able to get Arrow building in Bazel with Bazel's rules_foreign_cc by 
introducing a small patch to remove the {{ESCAPE_QUOTES}} option when 
{{src/arrow/util/config.h}} is generated:
{quote}{{— cpp/cmake_modules/ThirdpartyToolchain.cmake}}
{{+++ cpp/cmake_modules/ThirdpartyToolchain.cmake}}
{{@@ -4871,6 +4871,6 @@ message(STATUS "All bundled static libraries: 
${ARROW_BUNDLED_STATIC_LIBS}")}}
 # {{Write out the package configurations.}}

{{-configure_file("src/arrow/util/config.h.cmake" "src/arrow/util/config.h" 
ESCAPE_QUOTES)}}
{{+configure_file("src/arrow/util/config.h.cmake" "src/arrow/util/config.h")}}
{{install(FILES "${ARROW_BINARY_DIR}/src/arrow/util/config.h"}}
{{DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util")}}
{quote}
This patch can be applied when the HTTP archive is downloaded and extracted:
{quote}{{http_archive(}}
{{    name = "arrow",}}
{{    build_file = "//third_party/github.com/apache/arrow:BUILD.bazel",}}
{{    strip_prefix = "apache-arrow-9.0.0",}}
{{    patches = 
["//third_party/github.com/apache/arrow:ThirdpartyToolchain.cmake.patch"],}}
{{    urls = [}}
{{        
"https://github.com/apache/arrow/archive/refs/tags/apache-arrow-9.0.0.tar.gz"}}
{{    ],}}
{{)}}
{quote}
Is there a specific rationale for escaping quotes when 
{{src/arrow/util/config.h}} is being generated? Is it feasible/practical to 
remove ESCAPE_QUOTES so that Arrow can be built easier in Bazel projects?

Thank you!


was (Author: JIRAUSER295875):
Thank you, [~jinshang]. That's an excellent reference!

I was able to get Arrow building in Bazel with Bazel's rules_foreign_cc by 
introducing a small patch to remove the {{ESCAPE_QUOTES}} option when 
{{src/arrow/util/config.h}} is generated:
{quote}{{— cpp/cmake_modules/ThirdpartyToolchain.cmake}}
{{+++ cpp/cmake_modules/ThirdpartyToolchain.cmake}}
{{@@ -4871,6 +4871,6 @@ message(STATUS "All bundled static libraries: 
${ARROW_BUNDLED_STATIC_LIBS}")}}
 # {{Write out the package configurations.}}

{{-configure_file("src/arrow/util/config.h.cmake" "src/arrow/util/config.h" 
ESCAPE_QUOTES)}}
{{+configure_file("src/arrow/util/config.h.cmake" "src/arrow/util/config.h")}}
{{install(FILES "${ARROW_BINARY_DIR}/src/arrow/util/config.h"}}
{{DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/util")}}
{quote}
This patch can be applied when the HTTP archive is downloaded and extracted:
{quote}{{http_archive(}}
{{    name = "arrow",}}
{{    build_file = "//third_party/github.com/apache/arrow:BUILD.bazel",}}
{{    strip_prefix = "apache-arrow-9.0.0",}}
{{    patches = 
["//third_party/github.com/apache/arrow:ThirdpartyToolchain.cmake.patch"],}}
{{    urls = [}}
{{        
"https://github.com/apache/arrow/archive/refs/tags/apache-arrow-9.0.0.tar.gz"}}
{{    ],}}
{{)}}
{quote}
Is there a specific rationale for escaping quotes when 
{{src/arrow/util/config.h }}is being generated? Is it feasible/practical to 
remove ESCAPE_QUOTES so that Arrow can be built easier in Bazel projects?

Thank you!

> [C++] Allow Bazel to pass custom __DATE__, __TIME__, and __TIMESTAMP__ flags 
> to Arrow's toolchain
> -------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-17763
>                 URL: https://issues.apache.org/jira/browse/ARROW-17763
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>    Affects Versions: 9.0.0
>            Reporter: Stefan Novak
>            Priority: Major
>
> Hello!
> I've been looking into incorporating Arrow into a Bazel build build project 
> and have been having some challenges getting it to work.
> I've been using Bazel's 
> [rules_foreign_cc|https://bazelbuild.github.io/rules_foreign_cc/main/index.html]
>  to call CMake, however the build process is erroring out as [described by 
> another community 
> member|https://github.com/bazelbuild/rules_foreign_cc/issues/879].
> One thing that I've learned: Bazel's C++ integration will specify 
> {{\_\_DATE\_\_}}, {{\_\_TIME\_\_}}, and {{\_\_TIMESTAMP\_\_}} flags to ensure 
> reproducible builds.
> These values are expected to be quoted strings. However, when Arrow's 
> toolchain 
> [translates|https://github.com/bazelbuild/bazel/blob/5.3.0/tools/cpp/unix_cc_configure.bzl#L622-L624]]
>  {{CMAKE_CXX_FLAGS}} to {{ARROW_CXX_COMPILER_FLAGS}}, CMake is 
> [calling|https://github.com/apache/arrow/blob/apache-arrow-9.0.0/cpp/cmake_modules/ThirdpartyToolchain.cmake#L4874]
>  {{configure_file(...)}} with the {{ESCAPE_QUOTES}} option which is mucking 
> up the parsing.
> Does anyone happen to have any recommendations for a workaround or a fix?
> Thank you! I appreciate everyone's efforts in continuing to develop Arrow.
> Cheers,
> Stefan



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to