[ 
https://issues.apache.org/jira/browse/ORC-1732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dongjoon Hyun resolved ORC-1732.
--------------------------------
    Fix Version/s: 2.1.0
                   2.0.2
       Resolution: Fixed

Issue resolved by pull request 1963
[https://github.com/apache/orc/pull/1963]

> [C++] Can't detect Protobuf installed by Homebrew on macOS
> ----------------------------------------------------------
>
>                 Key: ORC-1732
>                 URL: https://issues.apache.org/jira/browse/ORC-1732
>             Project: ORC
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Kouhei Sutou
>            Assignee: Hao Zou
>            Priority: Major
>             Fix For: 2.1.0, 2.0.2
>
>
> Downstream issue: https://github.com/apache/arrow/issues/42149
> We can use system Protobuf if we specify one of them:
> * PROTOBUF_HOME environment variable
> * Protobuf_ROOT CMake variable
> * Protobuf_ROOT environment variable
> * PROTOBUF_ROOT CMake variable
> * PROTOBUF_ROOT environment variable
>  
> See also:
> * 
> https://github.com/apache/orc/blob/8003801e78ff6156a1f18ec62b631d6ba4768b00/cmake_modules/ThirdpartyToolchain.cmake#L466
> * 
> https://github.com/apache/orc/blob/8003801e78ff6156a1f18ec62b631d6ba4768b00/cmake_modules/ThirdpartyToolchain.cmake#L80-L90
> If system Protobuf CMake package is found, we extract include directory from 
> libprotobuf::protoc CMake target:
> https://github.com/apache/orc/blob/8003801e78ff6156a1f18ec62b631d6ba4768b00/cmake_modules/FindProtobuf.cmake#L66
> But libprotobuf::protoc CMake target doesn't have include directory 
> configuration:
> https://github.com/protocolbuffers/protobuf/blob/0302c4c43821ac893e8f1071576f80edef5c6398/cmake/libprotoc.cmake#L19-L20
> If we can't extract include directory, system Protobuf detection is failed:
> https://github.com/apache/orc/blob/8003801e78ff6156a1f18ec62b631d6ba4768b00/cmake_modules/FindProtobuf.cmake#L101-L107
> So we never detect system Protobuf by system Protobuf CMake package.
> FYI: We can extract include directory from protobuf::libprotobuf (not 
> ...::libprotoc) CMake target:
> {noformat}
> diff --git a/cmake_modules/FindProtobuf.cmake 
> b/cmake_modules/FindProtobuf.cmake
> index 82429a23..ab73195c 100644
> --- a/cmake_modules/FindProtobuf.cmake
> +++ b/cmake_modules/FindProtobuf.cmake
> @@ -63,7 +63,7 @@ if (Protobuf_FOUND)
>          set (PROTOC_STATIC_LIB protobuf::libprotoc)
>      endif ()
>  
> -    get_target_property (PROTOBUF_INCLUDE_DIR protobuf::libprotoc 
> INTERFACE_INCLUDE_DIRECTORIES)
> +    get_target_property (PROTOBUF_INCLUDE_DIR protobuf::libprotobuf 
> INTERFACE_INCLUDE_DIRECTORIES)
>  
>  else()
>      find_path (PROTOBUF_INCLUDE_DIR google/protobuf/io/zero_copy_stream.h 
> HINTS
> {noformat}
>  
> But there is a test failure with Protobuf 27.1:
> {noformat}
> [ RUN      ] TestFileScan.testErrorHandling
> /Users/runner/work/orc/orc/tools/test/TestFileScan.cc:211: Failure
> Expected: (std::string::npos) != (error.find(errorMsg)), actual: 
> 18446744073709551615 vs 18446744073709551615
> Caught exception in 
> /Users/runner/work/orc/orc/examples/corrupt/stripe_footer_bad_column_encodings.orc:
>  bad StripeFooter from 
> zlib(/Users/runner/work/orc/orc/examples/corrupt/stripe_footer_bad_column_encodings.orc
>  from 336 for 79)
> [  FAILED  ] TestFileScan.testErrorHandling (126 ms)
> {noformat}
> See also:
> * The above change + minimal CI configuration on macOS used when I looked at 
> this: 
> https://github.com/apache/orc/compare/main...kou:orc:cpp-protobuf?expand=1
> * A CI result: 
> https://github.com/kou/orc/actions/runs/9628707685/job/26557240526#step:6:126



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

Reply via email to