c0dzilla opened a new issue, #37107:
URL: https://github.com/apache/arrow/issues/37107

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   I followed the instructions at 
https://arrow.apache.org/docs/developers/cpp/building.html#building-arrow-cpp 
to build Arrow C++ from source.
   
   After running:
   
   ```
   cmake .. --preset ninja-debug-minimal
   cmake --build .
   ```
   
   Compilation fails with unused-variable errors:
   ```
   [102/183] Building CXX object 
src/arrow/CMakeFiles/arrow_objlib.dir/util/ree_util.cc.o
   FAILED: /usr/bin/c++ -DARROW_EXPORTING -DARROW_EXTRA_ERROR_CONTEXT 
-DARROW_HAVE_RUNTIME_AVX2 -DARROW_HAVE_RUNTIME_BMI2 -DARROW_HAVE_RUNTIME_SSE4_2 
-DARROW_HAVE_SSE4_2 -DARROW_WITH_BACKTRACE -DARROW_WITH_TIMING_TESTS 
-DURI_STATIC_BUILD -I/home/codzilla/arrow/cpp/build/src 
-I/home/codzilla/arrow/cpp/src -I/home/codzilla/arrow/cpp/src/generated 
-isystem /home/codzilla/arrow/cpp/thirdparty/flatbuffers/include -isystem 
/home/codzilla/arrow/cpp/thirdparty/hadoop/include -isystem 
/home/codzilla/arrow/cpp/build/xsimd_ep/src/xsimd_ep-install/include -isystem 
/home/codzilla/arrow/cpp/build/jemalloc_ep-prefix/src 
-fdiagnostics-color=always  -Wall -Wno-conversion -Wno-sign-conversion 
-Wunused-result -Wdate-time -fno-semantic-interposition -msse4.2  -g -Werror 
-O0 -ggdb  -std=c++1z -fPIC -pthread -MD -MT 
src/arrow/CMakeFiles/arrow_objlib.dir/util/ree_util.cc.o -MF 
src/arrow/CMakeFiles/arrow_objlib.dir/util/ree_util.cc.o.d -o 
src/arrow/CMakeFiles/arrow_objlib.dir/util/ree_util.cc.o -c /home/cod
 zilla/arrow/cpp/src/arrow/util/ree_util.cc
   In file included from 
/home/codzilla/arrow/cpp/src/arrow/util/ree_util.cc:24:0:
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h: In instantiation of 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const RunEndCType*, 
int64_t, int64_t, int64_t) [with RunEndCType = short int; int64_t = long int]’:
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:130:28:   required from 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const arrow::ArraySpan&) 
[with RunEndCType = short int; int64_t = long int]’
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.cc:79:54:   required from 
here
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:105:27: error: unused 
variable ‘_’ [-Werror=unused-variable]
      auto [_, physical_length] =
                              ^
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h: In instantiation of 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const RunEndCType*, 
int64_t, int64_t, int64_t) [with RunEndCType = int; int64_t = long int]’:
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:130:28:   required from 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const arrow::ArraySpan&) 
[with RunEndCType = int; int64_t = long int]’
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.cc:82:54:   required from 
here
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:105:27: error: unused 
variable ‘_’ [-Werror=unused-variable]
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h: In instantiation of 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const RunEndCType*, 
int64_t, int64_t, int64_t) [with RunEndCType = long int; int64_t = long int]’:
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:130:28:   required from 
‘int64_t arrow::ree_util::internal::FindPhysicalLength(const arrow::ArraySpan&) 
[with RunEndCType = long int; int64_t = long int]’
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.cc:85:52:   required from 
here
   /home/codzilla/arrow/cpp/src/arrow/util/ree_util.h:105:27: error: unused 
variable ‘_’ [-Werror=unused-variable]
   cc1plus: all warnings being treated as errors
   [102/183] Building CXX object 
src/arrow/CMakeFiles/arrow_objlib.dir/util/thread_pool.cc.o
   ninja: build stopped: subcommand failed.
   
   ```
   
   I was able to compile after commenting ` string(APPEND CMAKE_C_FLAGS_DEBUG " 
-Werror")` inside `arrow/cpp/cmake_modules/SetupCxxFlags.cmake` .
   
   g++ version on the system is 7.3.0:
   ```
   codzilla@hogwarts:~/arrow/cpp/build$ g++ --version
   g++ (Ubuntu 7.3.0-23ubuntu2~16.04.york0) 7.3.0
   Copyright (C) 2017 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   
   ```
   
   Looking at one of the lines the compiler complains about:
   ```
   template <typename RunEndCType>
   int64_t FindPhysicalLength(const RunEndCType* run_ends, int64_t 
run_ends_size,
                              int64_t length, int64_t offset) {
     auto [_, physical_length] =
         FindPhysicalRange<RunEndCType>(run_ends, run_ends_size, length, 
offset);
     return physical_length;
   }
   ```
   
   This looks like a compiler bug since it should not complain about "_" as an 
unused variable. Some searching on GCC Bugzilla shows that it seems to have 
been fixed in GCC 8.0: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?format=multiple&id=81767
   
   The requirements mentioned at 
https://arrow.apache.org/docs/developers/cpp/building.html#building-arrow-cpp 
contain the following:
   ```
   On Linux, gcc 7.1 and higher should be sufficient.
   ```
   
   Does the version on the page require an update?
   
   ### Component(s)
   
   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: [email protected]

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

Reply via email to