stiga-huang commented on code in PR #1889:
URL: https://github.com/apache/orc/pull/1889#discussion_r1576993049


##########
c++/orcConfig.cmake.in:
##########
@@ -0,0 +1,70 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+@PACKAGE_INIT@
+
+set(ORC_VENDOR_DEPENDENCIES "@ORC_VENDOR_DEPENDENCIES@")
+set(ORC_SYSTEM_DEPENDENCIES "@ORC_SYSTEM_DEPENDENCIES@")
+
+if(DEFINED CMAKE_MODULE_PATH)
+  set(ORC_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+else()
+  unset(ORC_CMAKE_MODULE_PATH_OLD)
+endif()
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+
+include(CMakeFindDependencyMacro)
+foreach(dependency ${ORC_SYSTEM_DEPENDENCIES})
+  find_dependency(${dependency})

Review Comment:
   Thanks for the pointer! I moved forward by adding variables like 
SNAPPY_HOME, ZLIB_HOME, PROTOBUF_HOME. But got a strange error on protobuf 
though the headers and libs are all found:
   ```
   -- SNAPPY_HOME: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/snappy-1.1.8/
   -- Found the Snappy header: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/snappy-1.1.8/include/snappy.h
   -- Found the Snappy library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/snappy-1.1.8/lib/libsnappy.so
   -- Found the Snappy static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/snappy-1.1.8/lib/libsnappy.a
   -- ZLIB_HOME: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/zlib-1.2.13/
   -- Found the ZLIB header: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/cloudflarezlib-9e601a3f37/include/zlib.h
   -- Found the ZLIB library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/cloudflarezlib-9e601a3f37/lib/libz.so
   -- Found the ZLIB static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/cloudflarezlib-9e601a3f37/lib/libz.a
   -- ZSTD_HOME: 
   -- Found the zstd header: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/zstd-1.5.2/include/zstd.h
   -- Found the zstd library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/zstd-1.5.2/lib/libzstd.so
   -- Found the zstd static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/zstd-1.5.2/lib/libzstd.a
   -- LZ4_HOME: 
   -- Found the LZ4 header: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/lz4-1.9.3/include/lz4.h
   -- Found the LZ4 library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/lz4-1.9.3/lib/liblz4.so
   -- Found the LZ4 static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/lz4-1.9.3/lib/liblz4.a
   -- PROTOBUF_HOME: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/
   -- Could NOT find Protobuf (missing: Protobuf_DIR)
   -- Found the Protobuf headers: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/include
   -- Found the Protobuf library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/lib/libprotobuf.so
   -- Found the Protoc library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/lib/libprotoc.so
   -- Found the Protoc executable: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/bin/protoc
   -- Found the Protobuf static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/lib/libprotobuf.a
   -- Found the Protoc static library: 
/home/quanlong/workspace/Impala/toolchain/toolchain-packages-gcc10.4.0/protobuf-3.14.0/lib/libprotoc.a
   CMake Error at CMakeLists.txt:366 (find_package):
     Found package configuration file:
   
       /home/quanlong/workspace/orc/build/install/lib/cmake/orc/orcConfig.cmake
   
     but it set orc_FOUND to FALSE so package "orc" is considered to be NOT
     FOUND.  Reason given by package:
   
     orc could not be found because dependency Protobuf could not be found.
   ```
   
   Impala builds on pre-built toolchain binaries including `liborc.a` so it 
doesn't need ORC to find these libraries since no need to build ORC again. I 
modified `orcConfig.cmake` to set `ORC_SYSTEM_DEPENDENCIES` empty and was able 
to build Impala:
   ```
   -set(ORC_SYSTEM_DEPENDENCIES "Snappy;ZLIB;ZSTD;LZ4;Protobuf")
   +set(ORC_SYSTEM_DEPENDENCIES "")
   ```
   Note that the regular process to build Impala is
   
   - Build native-toolchain which builds ORC here: 
https://github.com/cloudera/native-toolchain/blob/78a3723ad8251fbd786c276bd0f6b75a6b5bae74/source/orc/build.sh#L44-L47
     The artifacts are uploaded to S3 and share with all developers
   - Build Impala based on the pre-built toolchain



-- 
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: issues-unsubscr...@orc.apache.org

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

Reply via email to