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

Eduardo Ponce edited comment on ARROW-14436 at 10/22/21, 6:38 PM:
------------------------------------------------------------------

I would be curious if [this SO 
discussion|https://stackoverflow.com/a/24305849/11366330] helps fix this issue 
without the need to actually disable color-diagnostics.

Something along these lines:
{code:java}
find_program(CCACHE_FOUND "ccache")
set(CCACHE_SUPPORT ON CACHE BOOL "Enable ccache support")
if (CCACHE_FOUND AND CCACHE_SUPPORT)
  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC
      OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    # without this compiler messages in `make` backend would be uncolored
    set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
  endif()
  set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache")
else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
endif()

{code}


was (Author: edponce):
I would be curious if [this SO 
discussion|https://stackoverflow.com/a/24305849/11366330] helps fix this issue 
without the need to actually disable color-diagnostics.

Something along these lines:
{code}
find_program(CCACHE_FOUND "ccache")
set(CCACHE_SUPPORT ON CACHE BOOL "Enable ccache support")
if (CCACHE_FOUND AND CCACHE_SUPPORT)
  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC
      OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    # without this compiler messages in `make` backend would be uncolored
    set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
  endif()
  set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache")
endif()

{code}

> [C++] Disable color diagnostics when compiling with ccache
> ----------------------------------------------------------
>
>                 Key: ARROW-14436
>                 URL: https://issues.apache.org/jira/browse/ARROW-14436
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Krisztian Szucs
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 7.0.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Copied from https://github.com/apache/arrow/issues/11279
> Steps to reproduce:
> Compile arrow_objlib with ccache, clang and CCACHE_DEBUG=1 
> CCACHE_LOGFILE=./ccache.log
> Find in ./ccache.log:
> Failed; falling back to running the real compiler
> Result: unsupported compiler option
> Dropping -fcolor-diagnostics fixes the issue.
> I suggest either opting into color diagnostics with WITH_COLOR_DIAGNOSTICS or 
> adding a way to disable it via DISABLE_COLOR_DIAGNOSTICS.
> It would be good if this wouldn't be tied to ARROW_USE_CCACHE since its also 
> relevant for:
> -DARROW_USE_CCACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=emscripten_ccache.
> I can open a PR if you tell me which way you prefer.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to