tdhock commented on issue #34689: URL: https://github.com/apache/arrow/issues/34689#issuecomment-1545897774
Well I tried building libarrow from source, then building R package from source (linking against my newly built libarrow), but I get the same segfault. I think there is an issue with the C++ build, which gives me the following output: ``` (arrow) tdhock@maude-MacBookPro:~/arrow-git/cpp/build(main)$ CC=$HOME/bin/gcc CXX=$HOME/bin/g++ cmake .. --preset ninja-debug-basic -DCMAKE_INSTALL_PREFIX=$HOME -DARROW_CXXFLAGS=-march=core2 -DARROW_PARQUET=ON Preset CMake variables: ARROW_BUILD_INTEGRATION="ON" ARROW_BUILD_STATIC="OFF" ARROW_BUILD_TESTS="ON" ARROW_COMPUTE="ON" ARROW_CSV="ON" ARROW_DATASET="ON" ARROW_EXTRA_ERROR_CONTEXT="ON" ARROW_FILESYSTEM="ON" ARROW_JSON="ON" ARROW_WITH_RE2="OFF" ARROW_WITH_UTF8PROC="OFF" CMAKE_BUILD_TYPE="Debug" -- Building using CMake version: 3.22.1 -- Arrow version: 13.0.0 (full: '13.0.0-SNAPSHOT') -- Arrow SO version: 1300 (full: 1300.0.0) ... -- CMAKE_C_FLAGS: -Wall -Wno-conversion -Wno-sign-conversion -Wunused-result -fno-semantic-interposition -msse4.2 -march=core2 -- CMAKE_CXX_FLAGS: -Wno-noexcept-type -fdiagnostics-color=always -Wall -Wno-conversion -Wno-sign-conversion -Wunused-result -fno-semantic-interposition -msse4.2 -march=core2 -- CMAKE_C_FLAGS_DEBUG: -g -Werror -O0 -ggdb -- CMAKE_CXX_FLAGS_DEBUG: -g -Werror -O0 -ggdb -- --------------------------------------------------------------------- -- Arrow version: 13.0.0-SNAPSHOT -- -- Build configuration summary: -- Generator: Ninja -- Build type: DEBUG -- Source directory: /home/tdhock/arrow-git/cpp -- Install prefix: /home/tdhock -- -- Compile and link options: -- -- ARROW_CXXFLAGS=-march=core2 [default=""] -- Compiler flags to append when compiling Arrow ... ``` Note above that I used `-DARROW_CXXFLAGS=-march=core2` on the command line to tell it to compile for my core2 CPU, but there is an additional flag, `-msse4.2` in `CMAKE_CXX_FLAGS` that appears by default, and seems to be incorrect. GCC man page below explains that SSE4.2 is not supported on my core 2 CPU, but was actually introduced on the next generation of CPUs (nehalem), ``` -march=cpu-type ... core2 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16, SAHF and FXSR instruction set support. nehalem Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support. ``` It seems that there is documentation about the `-msse4.2` flag being default https://github.com/apache/arrow/blob/1624d5aaf4f524487079066dc730176d82b986f5/docs/source/cpp/env_vars.rst and how to disable that flag by setting cmake variable ARROW_SIM_LEVEL=NONE, so I will try that. However it seems like this should be easy to detect in your cmake config at build time, by running lscpu |grep sse4_2, etc, so I would have expected a warning or error such as "your CPU does not support sse4.2, but the compile is using the -msse4.2 flag, so the compiled libarrow binaries will not work on your CPU. If you want to run libarrow on your CPU, you need to disable this flag by setting the cmake variable ARROW_SIM_LEVEL=NONE" or similar. (this is pretty much what is explained in the docs, but they are not so easy to find, would be much more user-friendly to output a warning/error like this during build time) -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org