apache / arrow

Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing
https://arrow.apache.org/
Apache License 2.0
13.96k stars 3.4k forks source link

[C++] 'boost/numeric/conversion/cast.hpp': No such file or directory #43167

Open kabicm opened 1 week ago

kabicm commented 1 week ago

Describe the bug, including details regarding any error messages, version, and platform.

When compiling the latest version (16.1.0) of arrow C++ with the PARQUET support on macos (M2), I am getting:

'boost/numeric/conversion/cast.hpp': No such file or directory

The compilation error disappears when inside the file arrow/cpp/src/parquet/CMakeLists.txt, Boost::headers is added as a depencency e.g. as:

list(APPEND PARQUET_SHARED_PRIVATE_LINK_LIBS thrift::thrift Boost::headers)
list(APPEND PARQUET_STATIC_LINK_LIBS thrift::thrift Boost::headers)

This only occurs with the latest (16.1.0) version.

Component(s)

C++

kou commented 1 week ago

Could you show full error log?

kabicm commented 1 week ago
FAILED: src/parquet/CMakeFiles/parquet_objlib.dir/types.cc.o
/opt/homebrew/bin/ccache /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -DARROW_HAVE_NEON -DARROW_WITH_TIMING_TESTS -DHAVE_INTTYPES_H -DHAVE_NETDB_H -DHAVE_NETINET_IN_H -DPARQUET_EXPORTING -DPARQUET_THRIFT_VERSION_MAJOR=0 -DPARQUET_THRIFT_VERSION_MINOR=20 -I/Users/xxxxx/Projects/arrow/cpp/build-debug-gcc/src -I/Users/xxxxx/Projects/arrow/cpp/src -I/Users/xxxxx/Projects/arrow/cpp/src/generated -isystem /Users/xxxxx/Projects/arrow/cpp/build-debug-gcc/xsimd_ep/src/xsimd_ep-install/include -isystem /opt/homebrew/Cellar/thrift/0.20.0/include -fno-aligned-new  -Qunused-arguments -fcolor-diagnostics  -Wall -Wextra -Wdocumentation -Wshorten-64-to-32 -Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand -Wno-return-stack-address -Wdate-time -Wno-unknown-warning-option -Wno-pass-failed -march=armv8-a -w -g -Werror -O0 -ggdb  -std=c++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fPIC -MD -MT src/parquet/CMakeFiles/parquet_objlib.dir/types.cc.o -MF src/parquet/CMakeFiles/parquet_objlib.dir/types.cc.o.d -o src/parquet/CMakeFiles/parquet_objlib.dir/types.cc.o -c /Users/xxxxx/Projects/arrow/cpp/src/parquet/types.cc
In file included from /Users/xxxxx/Projects/arrow/cpp/src/parquet/types.cc:31:
In file included from /Users/xxxxx/Projects/arrow/cpp/src/generated/parquet_types.h:14:
In file included from /opt/homebrew/Cellar/thrift/0.20.0/include/thrift/TBase.h:24:
In file included from /opt/homebrew/Cellar/thrift/0.20.0/include/thrift/protocol/TProtocol.h:46:
In file included from /opt/homebrew/Cellar/thrift/0.20.0/include/thrift/transport/TTransport.h:25:
/opt/homebrew/Cellar/thrift/0.20.0/include/thrift/transport/TTransportException.h:23:10: fatal error: 'boost/numeric/conversion/cast.hpp' file not found
#include <boost/numeric/conversion/cast.hpp>
kou commented 1 week ago

OK. It seems that $(brew --prefix thrift)/lib/pkgconfig/thrift.pc misses -I${BOOST_INCLUDE_DIR} in Cflags. Could you report this to Apache Thrift? https://issues.apache.org/jira/projects/THRIFT/issues/

BTW, does this work?

diff --git a/cpp/cmake_modules/FindThriftAlt.cmake b/cpp/cmake_modules/FindThriftAlt.cmake
index f3e49021d5..98a706deb9 100644
--- a/cpp/cmake_modules/FindThriftAlt.cmake
+++ b/cpp/cmake_modules/FindThriftAlt.cmake
@@ -191,6 +191,10 @@ if(ThriftAlt_FOUND)
     # thrift/windows/config.h for Visual C++.
     set_target_properties(thrift::thrift PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32")
   endif()
+  # Workaround: thrift.pc doesn't have Boost dependency.
+  if(TARGET Boost::headers)
+    target_link_libraries(thrift::thrift INTERFACE Boost::headers)
+  endif()

   if(Thrift_COMPILER_FOUND)
     add_executable(thrift::compiler IMPORTED)
kabicm commented 12 hours ago

Works now, thanks!

kou commented 19 minutes ago

Great. Could you report this to Apache Thrift?