0

I've encountered a problem with discc, a compile job distribution tool, where a (cmake) build was not distributed to other specified systems (as defined in ~/.distcc/host).

I configured the build system like so:

cmake -DCMAKE_C_COMPILER_LAUNCHER=distcc -DCMAKE_CXX_COMPILER_LAUNCHER=distcc [...]

For other (similar) builds it turned out distcc worked just fine and hence, was configured properly.

What can possibly be the issue?

DomTomCat
  • 8,189
  • 1
  • 49
  • 64

1 Answers1

1

It turns out that distcc refuses to work with the march=native compile option. Which certainly makes sense, since binaries with mixed optimization flags may be combined.

Just to let you know, if you have a build system using march=native, like the cmake instructions:

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()

You'll have to disable it, to be able to use distcc with slaves. You'll have to specifiy the architecture flags manually.

Alternatively, try to detect the use of distcc:

include(CheckCXXCompilerFlag)
STRING(FIND "${CMAKE_CXX_COMPILER_LAUNCHER}" "distcc" found)
if (${found} LESS 0)
    message(STATUS "trying to use -march=native")
    CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
    if(COMPILER_SUPPORTS_MARCH_NATIVE)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
    endif()
else()
    message(STATUS "detected 'distcc' build, hence not using -march=native")
endif()

for this to be successful, make sure you use distcc with the respective cmake compiler launcher tool:

cmake -DCMAKE_C_COMPILER_LAUNCHER=distcc -DCMAKE_CXX_COMPILER_LAUNCHER=distcc [...]
DomTomCat
  • 8,189
  • 1
  • 49
  • 64