简体   繁体   中英

distcc - are there cases it requires a synchronized network filesystem

Two simplified makefiles

makefile1

a.txt:
    echo “123144234” > a.txt

t2: a.txt
    cat a.txt > b.txt

makefile2

t1:
    echo “123144234” > a.txt

t2: t1
    cat a.txt > b.txt

Both makefiles have the same functionality.

Both makefiles can be run in parallel because the dependency of t2 on t1 .

However, there is a critical difference which might?/does? make a difference when it comes to distributed builds.

In makefile1 , t2 depends directly on the artifact a.txt which is also the same as the name of the target itself a.txt . However, in makefile2 , while the recipe and artifact of t1 is same as for a.txt , the name of the target is not a.txt .

This difference is key because gnu make (and I assume distcc ) does NOT parse the recipe - nor analyze the filesystem at runtime - to determine all the artifacts for a given target. In makefile2 , gnu make does NOT create ANY relationship between a.txt and t1 .

When the build is done as make -j ie parallel but not distributed, this difference is irrelevant because all make targets are run on the same machine ie all the make instances access the same filesystem.

But let's consider what could?/does? happen during a distributed build if the two targets are built on two separate machines

In both makefiles, the recipe for t2 would be run AFTER the recipe for a.txt / t1 .

However, in makefile1 the dependency of t2 on a.txt is explicit ie distcc knows that to make t2 on a separate machine, it must send the file a.txt to that separate machine.

QUESTION

  1. If makefile2 is run using distcc , without a synchronized distributed filesystem, and t2 is make d on another machine, will there be a build error because a.txt is not present on the other machine?
  2. What are the options for a distributed Linux filesystem?

distcc is merely a replacement for gcc . It uses local gcc to preprocess the source file, then sends it for compilation to another machine, receives back the object file and saves it into the local filesystem. distcc doesn't require a shared.network filesystem or clock synchronization between the participating hosts.

There is alse new "pump" functionality that preprocesses on remote servers, but it doesn't require a shared.network filesystem or clock synchronization either.

Your make always runs locally.

Answering your questions:

  1. distcc doesn't run make . make runs distc instead of gcc . make examines dependencies and their timestamps locally.
  2. make runs locally and it doesn't care whether the filesystem it uses is local or.networked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM