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 [...]