[ 
https://issues.apache.org/jira/browse/ARROW-17580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17601712#comment-17601712
 ] 

Alenka Frim commented on ARROW-17580:
-------------------------------------

_Update about the {{{}CXXFLAGS{}}}:_

CMake does in fact read them. I have tried again with a clean built. I have set 
{{CXXFLAGS}} env var to a random value and the built failed. See:
{code:java}
(pyarrow-dev-9) (base) alenkafrim@Alenkas-MacBook-Pro arrow % printenv CXXFLAGS
-Woverloaded-virtual ../dist/configure{code}
{code:java}
(pyarrow-dev-9) (base) alenkafrim@Alenkas-MacBook-Pro arrow % arrow cmake-debug
ARROW_BUILD_TYPE=debug
~/repos/arrow/cpp/build ~/repos/arrow
-- Building using CMake version: 3.24.1
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
 - broken
CMake Error at 
/opt/homebrew/Cellar/cmake/3.24.1/share/cmake/Modules/CMakeTestCXXCompiler.cmake:62
 (message):
  The C++ compiler
    
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
  is not able to compile a simple test program.
  It fails with the following output:
    Change Dir: /Users/alenkafrim/repos/arrow/cpp/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/opt/homebrew/bin/ninja cmTC_3527f && [1/2] Building 
CXX object CMakeFiles/cmTC_3527f.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_3527f.dir/testCXXCompiler.cxx.o 
    
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
   -Woverloaded-virtual ../dist/configure  -arch arm64 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
 -MD -MT CMakeFiles/cmTC_3527f.dir/testCXXCompiler.cxx.o -MF 
CMakeFiles/cmTC_3527f.dir/testCXXCompiler.cxx.o.d -o 
CMakeFiles/cmTC_3527f.dir/testCXXCompiler.cxx.o -c 
/Users/alenkafrim/repos/arrow/cpp/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    clang: error: no such file or directory: '../dist/configure'
    ninja: build stopped: subcommand failed.
{code}
If I change the value of {{CXXFLAGS to -O0 it gets added to the CMAKE_CXX_FLAGS 
at the beginning of the list:}}
{code:java}
...
-- ******************************************
-- ARROW_CXXFLAGS: -ggdb
-- PYARROW_CXXFLAGS: 
-- CXXFLAGS: 
-- CXX_COMMON_FLAGS:  -Wall -Wextra -Wdocumentation -Wshorten-64-to-32 
-Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand 
-Wno-return-stack-address -Werror -Wno-unknown-warning-option -Wno-pass-failed 
-stdlib=libc++ -march=armv8-a
-- CMAKE_CXX_FLAGS:  -O0 -Qunused-arguments -fcolor-diagnostics -ggdb -O0  
-Wall -Wextra -Wdocumentation -Wshorten-64-to-32 -Wno-missing-braces 
-Wno-unused-parameter -Wno-constant-logical-operand -Wno-return-stack-address 
-Werror -Wno-unknown-warning-option -Wno-pass-failed -stdlib=libc++ 
-march=armv8-a -ggdb
-- ******************************************
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alenkafrim/repos/arrow/cpp/build
~/repos/arrow
(pyarrow-dev-9) (base) alenkafrim@Alenkas-MacBook-Pro arrow % printenv CXXFLAGS
-O0{code}
 

> [Doc][C++][Python] Unclear how to influence compilation flags
> -------------------------------------------------------------
>
>                 Key: ARROW-17580
>                 URL: https://issues.apache.org/jira/browse/ARROW-17580
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Documentation, Python
>            Reporter: Antoine Pitrou
>            Priority: Critical
>
> Frequently people need to customize compilation flags for C++ and/or C files.
> Unfortunately, both for Arrow C++ and PyArrow, it is very difficult to find 
> out the proper way to do this.
> For Arrow C++, it seems {{ARROW_CXXFLAGS}} should be passed to CMake, while 
> the {{CXXFLAGS}} environment variable is ignored (it probably shouldn't?). 
> For PyArrow, I have not found a way to do it. -The {{CXXFLAGS}} environment 
> variable is ignored, and -the {{PYARROW_CXXFLAGS}} CMake variable has two 
> problems:
> * it is only recognized for Cython-generated files, not for PyArrow C++ 
> sources
> * it only affects linker calls, while it should actually affect compiler 
> calls (edit: does it?)
> *Edit: I was wrong, the {{CXXFLAGS}} environment variable is not ignored.*



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

Reply via email to